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())) {

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?

0 votes

1 answers

1458 views

ANSWER

documentManager is a variable of type CoreSession
12/09/2012



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?
12/10/2012