/** Load the collection */ public void loadCollection() { if (id != null) { collection = ObjectLoader.loadCollectionLazy( ObjectHelper.getURI(CollectionImeji.class, id), sessionBean.getUser()); if (collection != null && getCollection().getId() != null) { ItemController ic = new ItemController(sessionBean.getUser()); collectionSize = ic.countContainerSize(collection.getId()); } } else { BeanHelper.error(sessionBean.getLabel("error") + "No ID in URL"); } }
/** * Initialize the elements of the page * * @return */ @Override public String getInitPage() { uri = ObjectHelper.getURI(CollectionImeji.class, id); collection = ObjectLoader.loadCollectionLazy(uri, sb.getUser()); browseInit(); browseContext = getNavigationString() + id; return ""; }
/** * Withdraw the current {@link CollectionImeji} * * @return * @throws Exception */ public String withdraw() throws Exception { CollectionController cc = new CollectionController(); try { cc.withdraw(collection, sb.getUser()); BeanHelper.info(sb.getMessage("success_collection_withdraw")); } catch (Exception e) { BeanHelper.error(sb.getMessage("error_collection_withdraw")); BeanHelper.error(e.getMessage()); logger.error("Error discarding collection", e); } return "pretty:"; }
/** * Delete the current {@link CollectionImeji} * * @return */ public String delete() { CollectionController cc = new CollectionController(); try { cc.delete(collection, sb.getUser()); BeanHelper.info(sb.getMessage("success_collection_delete")); } catch (Exception e) { BeanHelper.error(sb.getMessage("success_collection_delete")); BeanHelper.error(e.getMessage()); logger.error("Error deleting collection", e); } return "pretty:collections"; }
/** * Release the current {@link CollectionImeji} * * @return */ public String release() { CollectionController cc = new CollectionController(); try { cc.release(collection, sb.getUser()); BeanHelper.info(sb.getMessage("success_collection_release")); } catch (Exception e) { BeanHelper.error(sb.getMessage("error_collection_release")); BeanHelper.error(e.getMessage()); logger.error("Error releasing collection", e); } return "pretty:"; }
@Override public SearchResult search(SearchQuery searchQuery, SortCriterion sortCriterion) { ItemController controller = new ItemController(sb.getUser()); return controller.search(uri, searchQuery, sortCriterion, null); }
@Override public boolean isDeletable() { Security security = new Security(); return security.check(OperationsType.DELETE, sb.getUser(), collection); }
@Override public boolean isVisible() { Security security = new Security(); return security.check(OperationsType.READ, sb.getUser(), collection); }
/** * true if current {@link User} can UPDATE the {@link CollectionImeji} * * @return */ public boolean isEditable() { Security security = new Security(); return security.check(OperationsType.UPDATE, sessionBean.getUser(), collection); }
public User getUser() { return sessionBean.getUser(); }