Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public Object hangleCreateNewFolder(Request request, Response response){
- String path = request.params(":path");
- String[] pathSplitted = path.split("/");
- Random rand = new Random();
- int folderID;
- for(;;){
- folderID = rand.nextInt(10000) + 1;
- if(folderMetadataRepostiory.loadFolderOfID(folderID) == null){
- break;
- }
- }
- FolderMetadata folderMetadata = new FolderMetadata(folderID,
- pathSplitted[pathSplitted.length-2],
- path.toLowerCase(),
- path,
- folderMetadataRepostiory.loadFolderOfPath(path.replace(pathSplitted[pathSplitted.length-2]+"/","")).getFolderId(),
- new Date().toString(),
- 10);
- folderMetadataRepostiory.storeFolderMetadata(folderMetadata);
- folderFolderContentsRepository.storeFolderFolderContens(new FolderFolderContents(
- folderMetadataRepostiory.loadFolderOfPath(path.replace(pathSplitted[pathSplitted.length-2]+"/","")).getFolderId(),
- folderID
- ));
- response.status(CREATED);
- return folderMetadata;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement