cancel
Showing results for 
Search instead for 
Did you mean: 

documentManager.exists() behaves strangely

roccapl_
Confirmed Champ
Confirmed Champ

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())) {
log.info("it doesn't exist");
}
else {
log.info("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?

3 REPLIES 3

roccapl_
Confirmed Champ
Confirmed Champ

documentManager is a variable of type CoreSession

roccapl_
Confirmed Champ
Confirmed Champ

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.

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?