Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#13241 Added more FolderTransformer #13251

Merged
merged 1 commit into from
Dec 28, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -78,23 +78,37 @@ protected boolean exists(String folderInode) throws DotDataException {

@Override
protected void delete(Folder f) throws DotDataException {
Identifier id = APILocator.getIdentifierAPI().find(f.getIdentifier());
HibernateUtil.delete(f);
fc.removeFolder(f, id);
CacheLocator.getIdentifierCache().removeFromCacheByVersionable(f);

Identifier id = APILocator.getIdentifierAPI().find(f.getIdentifier());
new DotConnect()
.setSQL("delete from folder where folder.inode = ? ")
.addParam(f.getInode()).loadResult();

new DotConnect()
.setSQL("delete from inode where inode = ? ")
.addParam(f.getInode()).loadResult();
fc.removeFolder(f, id);


CacheLocator.getIdentifierCache().removeFromCacheByVersionable(f);
}


@Override
protected Folder find(String folderInode) throws DotDataException {
Folder folder = fc.getFolder(folderInode);
if (folder == null) {
try{
folder = (Folder) new HibernateUtil(Folder.class).load(folderInode);
DotConnect dc = new DotConnect()
.setSQL("SELECT folder.*, folder_1_.* from folder folder, inode folder_1_ where folder.inode = ? ")
.addParam(folderInode);

folder = TransformerLocator.createFolderTransformer(dc.loadObjectResults()).asList().get(0);
Identifier id = APILocator.getIdentifierAPI().find(folder.getIdentifier());
fc.addFolder(folder, id);
}
catch(Exception e){
throw new DotDataException(e.getMessage());
throw new DotDataException(e.getMessage(),e);
}

}
Expand Down