Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public FolderMetadata handleCreateNewFolder(Request request, Response response){
- try{
- PathManager pathManager = new PathManager(request.params(":path"));
- if(folderMetadataRepostiory.fetchByPathDisplay(pathManager.getPath()) != null){
- int parentID = folderMetadataRepostiory.fetchByPathDisplay(pathManager.getParentPath()).get(0).getParentFolderId();
- FolderMetadata folderMetadata = new FolderMetadata(null,
- pathManager.getFileName(),
- pathManager.pathToLowerCase(),
- pathManager.getPath(),
- parentID,
- new Date().toString(),
- null); // TO DO
- FolderMetadata inserted = folderMetadataRepostiory.insertFolder(folderMetadata);
- folderFolderContentsRepository.insertFolder(new FolderFolderContents(parentID, folderMetadata.getFolderId()));
- response.status(CREATED);
- return inserted;
- }
- else{
- response.status(FOLDEREXISTS);
- return null;
- }
- }
- catch(WrongPathFormat ex){
- response.status(INVALIDPATHPARAMETER);
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement