Fix get Folder
This commit is contained in:
parent
222b337308
commit
0ec65d1d30
|
@ -78,10 +78,23 @@ public class WorkspaceManager {
|
||||||
sgClient.open(id).asFolder().delete();
|
sgClient.open(id).asFolder().delete();
|
||||||
}
|
}
|
||||||
|
|
||||||
public FolderContainer getSubFolder(FolderContainer parentFolder,String path) throws StorageHubException {
|
public FolderContainer getSubFolder(FolderContainer parentFolder,String path) throws StorageHubException {
|
||||||
|
return getSubFolder(parentFolder,path,"");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns sub folder. Creates it if missing
|
||||||
|
*
|
||||||
|
* @param parentFolder
|
||||||
|
* @param path
|
||||||
|
* @return
|
||||||
|
* @throws StorageHubException
|
||||||
|
*/
|
||||||
|
public FolderContainer getSubFolder(FolderContainer parentFolder,String path, String description) throws StorageHubException {
|
||||||
try{
|
try{
|
||||||
return parentFolder.openByRelativePath(path).asFolder();
|
return parentFolder.openByRelativePath(path).asFolder();
|
||||||
}catch(StorageHubException e) {
|
}catch(StorageHubException e) {
|
||||||
log.debug("Missing subPath "+path);
|
log.debug("Missing subPath "+path);
|
||||||
FolderContainer targetParent=parentFolder;
|
FolderContainer targetParent=parentFolder;
|
||||||
String targetName=path;
|
String targetName=path;
|
||||||
|
@ -91,8 +104,9 @@ public class WorkspaceManager {
|
||||||
targetParent=getSubFolder(parentFolder,parent);
|
targetParent=getSubFolder(parentFolder,parent);
|
||||||
targetName=path.substring(path.lastIndexOf("/")+1);
|
targetName=path.substring(path.lastIndexOf("/")+1);
|
||||||
}
|
}
|
||||||
log.debug("Creating "+targetName);
|
FolderOptions opts = new FolderOptions(targetName,description,targetParent);
|
||||||
return createFolder(new FolderOptions(targetName,"",targetParent));
|
log.debug("Creating FOLDER {}", opts);
|
||||||
|
return createFolder(opts);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -624,8 +624,6 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
||||||
}
|
}
|
||||||
if(!policy.canWrite(doc,u)) throw new UnauthorizedAccess("No edit rights on project "+id);
|
if(!policy.canWrite(doc,u)) throw new UnauthorizedAccess("No edit rights on project "+id);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
doc.getLifecycleInformation().cleanState();
|
doc.getLifecycleInformation().cleanState();
|
||||||
doc.getLifecycleInformation().setLastOperationStatus(LifecycleInformation.Status.OK);
|
doc.getLifecycleInformation().setLastOperationStatus(LifecycleInformation.Status.OK);
|
||||||
|
|
||||||
|
@ -968,10 +966,11 @@ public class ProfiledMongoManager extends MongoManager implements MongoManagerI<
|
||||||
log.trace("Folder ID is {} ",folderID);
|
log.trace("Folder ID is {} ",folderID);
|
||||||
FolderContainer sectionFolder=null;
|
FolderContainer sectionFolder=null;
|
||||||
if(folderID==null || folderID.isEmpty()) {
|
if(folderID==null || folderID.isEmpty()) {
|
||||||
FolderContainer base = ws.createFolder(new WorkspaceManager.FolderOptions(
|
|
||||||
docID, "Base Folder for profiled document. UseCaseDescriptor " + profileID, null));
|
// Get BASE Folder for project
|
||||||
sectionFolder = ws.createFolder(new WorkspaceManager.FolderOptions(
|
FolderContainer base = ws.getSubFolder(ws.getAppBase(),docID,"Base Folder for profiled document. UseCaseDescriptor " + profileID);
|
||||||
docID + "_" + uuid, "Registered Fileset uuid " + uuid, base));
|
// Create Folder for FileSet
|
||||||
|
sectionFolder = ws.createFolder(new WorkspaceManager.FolderOptions(docID + "_" + uuid, "Registered Fileset uuid " + uuid, base));
|
||||||
toReturn.put(RegisteredFileSet.FOLDER_ID, sectionFolder.getId());
|
toReturn.put(RegisteredFileSet.FOLDER_ID, sectionFolder.getId());
|
||||||
}else {
|
}else {
|
||||||
sectionFolder = ws.getFolderById(folderID);
|
sectionFolder = ws.getFolderById(folderID);
|
||||||
|
|
Loading…
Reference in New Issue