documentManager.exists() behaves strangely

This is the problem: let's say I create a Workspace called “lalala”.

Now I run my code

DocumentModel lalalaWs = new DocumentModelImpl(“/default-domain/workspaces/“, “lalala”, “Workspace”);
if (!documentManager.exists(lalalaWs.getRef())) {"it doesn't exist");

} else {"it exists");


and it prints “it exists”, then I delete the Workspace and call the code again and it still prints “it exists”

is it a bug or am I doing something wrong?

0 votes

1 answers



documentManager is a variable of type CoreSession

The function exists() returns true becuause the “Delete” button moves the workspace to the Trash. The file is present but in a different state. The workspace should be removed from the Thrash to be permanently deleted.

0 votes

But now how can I check using the core java api if a workspace is in the trash, remove it and create a new one or else taking it back from the trash?