public DLFileShortcut updateFileShortcut( long userId, long fileShortcutId, long folderId, long toFolderId, String toName) throws PortalException, SystemException { // File shortcut User user = userPersistence.findByPrimaryKey(userId); DLFolder folder = dlFolderPersistence.findByPrimaryKey(folderId); validate(user, toFolderId, toName); DLFileShortcut fileShortcut = dlFileShortcutPersistence.findByPrimaryKey(fileShortcutId); fileShortcut.setModifiedDate(new Date()); fileShortcut.setFolderId(folderId); fileShortcut.setToFolderId(toFolderId); fileShortcut.setToName(toName); dlFileShortcutPersistence.update(fileShortcut); // Folder folder.setLastPostDate(fileShortcut.getModifiedDate()); dlFolderPersistence.update(folder); return fileShortcut; }
public DLFileShortcut addFileShortcut( String uuid, long userId, long folderId, long toFolderId, String toName, Boolean addCommunityPermissions, Boolean addGuestPermissions, String[] communityPermissions, String[] guestPermissions) throws PortalException, SystemException { // File shortcut User user = userPersistence.findByPrimaryKey(userId); folderId = getFolderId(user.getCompanyId(), folderId); DLFolder folder = dlFolderPersistence.findByPrimaryKey(folderId); Date now = new Date(); validate(user, toFolderId, toName); long fileShortcutId = counterLocalService.increment(); DLFileShortcut fileShortcut = dlFileShortcutPersistence.create(fileShortcutId); fileShortcut.setUuid(uuid); fileShortcut.setCompanyId(user.getCompanyId()); fileShortcut.setUserId(user.getUserId()); fileShortcut.setUserName(user.getFullName()); fileShortcut.setCreateDate(now); fileShortcut.setModifiedDate(now); fileShortcut.setFolderId(folderId); fileShortcut.setToFolderId(toFolderId); fileShortcut.setToName(toName); dlFileShortcutPersistence.update(fileShortcut); // Resources if ((addCommunityPermissions != null) && (addGuestPermissions != null)) { addFileShortcutResources( folder, fileShortcut, addCommunityPermissions.booleanValue(), addGuestPermissions.booleanValue()); } else { addFileShortcutResources(folder, fileShortcut, communityPermissions, guestPermissions); } // Folder folder.setLastPostDate(fileShortcut.getModifiedDate()); dlFolderPersistence.update(folder); return fileShortcut; }
public void updateFileShortcuts( long oldToFolderId, String oldToName, long newToFolderId, String newToName) throws PortalException, SystemException { Iterator itr = dlFileShortcutPersistence.findByTF_TN(oldToFolderId, oldToName).iterator(); while (itr.hasNext()) { DLFileShortcut fileShortcut = (DLFileShortcut) itr.next(); fileShortcut.setToFolderId(newToFolderId); fileShortcut.setToName(newToName); dlFileShortcutPersistence.update(fileShortcut); } }