I'm facing a strange problem. All I want is to create a new folder with the DFC. But when I execute the code (JUnit or inside the Application) no folder is created and surprisingly no exception is thrown. So I guess the error is somewhere else.
This is my code:
public void createNewFolder(String sFolderName, String sParentId)
{
IDfSession session = null;
try
{
session = getSession();
IDfFolder newFolder = (IDfFolder) session.newObject("dm_folder");
newFolder.setObjectName(sFolderName);
newFolder.link(sParentId);
newFolder.save();
String sDump = newFolder.dump();
System.out.println("Folder ["+sFolderName+"] saved.");
System.out.println("Folder has id ["+newFolder.getId("r_object_id")+"]");
}
catch (DfException e)
{
e.printStackTrace();
}
finally
{
m_sessionManager.release(session);
}
I'm getting a sysobject id in return, but when I'm trying to fetch it with a dql statement then I cannot find it.
I tried to execute a dql create query alternatively which creates the folder. This does not work with JUnit or in the running Application, but when I execute it manually it simply works.
This is my getSession() method
private IDfSession getSession()
{
try
{
if (m_sessionManager == null)
{
return establishConnection();
}
else
{
return m_sessionManager.getSession(m_sRepository);
}
}
catch (DfException e)
{
e.printStackTrace();
}
return null;
}
Any ideas on that?