@Override public DSpaceObject resolve(Context context, String identifier, String... attributes) { // We can do nothing with this, return null try { return handleService.resolveToObject(context, identifier); } catch (Exception e) { log.error(LogManager.getHeader(context, "Error while resolving handle to item", "handle: " + identifier), e); } return null; }
@Override public DSpaceObject resolve(Context context, String identifier, String... attributes) { // We can do nothing with this, return null try { return handleService.resolveToObject(context, identifier); } catch (Exception e) { log.error(LogManager.getHeader(context, "Error while resolving handle to item", "handle: " + identifier), e); } return null; }
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { // A GET displays the edit profile form. We assume the authentication // filter means we have a user. log.info(LogManager.getHeader(context, "view_profile", "")); request.setAttribute("eperson", context.getCurrentUser()); JSPManager.showJSP(request, response, "/register/edit-profile.jsp"); }
@Override public void delete(Context context, MetadataValue metadataValue) throws SQLException { log.info(LogManager.getHeader(context, "delete_metadata_value", " metadata_value_id=" + metadataValue.getID())); metadataValueDAO.delete(context, metadataValue); }
@Override public void update(Context context, MetadataValue metadataValue) throws SQLException { metadataValueDAO.save(context, metadataValue); log.info(LogManager.getHeader(context, "update_metadatavalue", "metadata_value_id=" + metadataValue.getID())); }
protected void doDSGet(Context context, HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException, SQLException, AuthorizeException { log.info(LogManager.getHeader(context, "logout", "")); Authenticate.loggedOut(context, request); // Display logged out message JSPManager.showJSP(request, response, "/login/logged-out.jsp"); } }
private Authentication createAuthenticationToken(final String password, final Context context, final List<SimpleGrantedAuthority> grantedAuthorities) { EPerson ePerson = context.getCurrentUser(); if (ePerson != null && StringUtils.isNotBlank(ePerson.getEmail())) { return new UsernamePasswordAuthenticationToken(ePerson.getEmail(), password, grantedAuthorities); } else { log.info( LogManager.getHeader(context, "failed_login", "No eperson with an non-blank e-mail address found")); throw new BadCredentialsException("Login failed"); } }
@Override public void reserve(Context context, DSpaceObject dso, String identifier) { try { handleService.createHandle(context, dso, identifier); } catch (Exception e) { log.error( LogManager.getHeader(context, "Error while attempting to create handle", "Item id: " + dso.getID()), e); throw new RuntimeException("Error while attempting to create identifier for Item id: " + dso.getID()); } }
@Override public void reserve(Context context, DSpaceObject dso, String identifier) { try { handleService.createHandle(context, dso, identifier); } catch (Exception e) { log.error( LogManager.getHeader(context, "Error while attempting to create handle", "Item id: " + dso.getID()), e); throw new RuntimeException("Error while attempting to create identifier for Item id: " + dso.getID()); } }
@Override public void reserve(Context context, DSpaceObject dso, String identifier) { try { handleService.createHandle(context, dso, identifier); } catch (Exception e) { log.error( LogManager.getHeader(context, "Error while attempting to create handle", "Item id: " + dso.getID()), e); throw new RuntimeException("Error while attempting to create identifier for Item id: " + dso.getID()); } }
@Override public void inheritCollectionDefaultPolicies(Context context, Item item, Collection collection) throws SQLException, AuthorizeException { adjustItemPolicies(context, item, collection); adjustBundleBitstreamPolicies(context, item, collection); log.debug(LogManager.getHeader(context, "item_inheritCollectionDefaultPolicies", "item_id=" + item.getID())); }
@Override public Item create(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException { if (workspaceItem.getItem() != null) { throw new IllegalArgumentException( "Attempting to create an item for a workspace item that already contains an item"); } Item item = createItem(context); workspaceItem.setItem(item); log.info(LogManager.getHeader(context, "create_item", "item_id=" + item.getID())); return item; }
@Override public void update(Context context, XmlWorkflowItem workflowItem) throws SQLException, AuthorizeException { // FIXME check auth log.info(LogManager.getHeader(context, "update_workflow_item", "workflowitem_id=" + workflowItem.getID())); // Update the item itemService.update(context, workflowItem.getItem()); xmlWorkflowItemDAO.save(context, workflowItem); }
@Override public void delete(Context context, MetadataSchema metadataSchema) throws SQLException, AuthorizeException { // Check authorisation: Only admins may create DC types if (!authorizeService.isAdmin(context)) { throw new AuthorizeException( "Only administrators may modify the metadata registry"); } log.info(LogManager.getHeader(context, "delete_metadata_schema", "metadata_schema_id=" + metadataSchema.getID())); metadataSchemaDAO.delete(context, metadataSchema); }
@Override public void update(Context context, BasicWorkflowItem workflowItem) throws SQLException, AuthorizeException { // FIXME check auth log.info(LogManager.getHeader(context, "update_workflow_item", "workflow_item_id=" + workflowItem.getID())); // Update the item itemService.update(context, workflowItem.getItem()); // Update ourselves workflowItemDAO.save(context, workflowItem); }
@Override public void update(Context context, WorkspaceItem workspaceItem) throws SQLException, AuthorizeException { // Authorisation is checked by the item.update() method below log.info(LogManager.getHeader(context, "update_workspace_item", "workspace_item_id=" + workspaceItem.getID())); // Update the item itemService.update(context, workspaceItem.getItem()); // Update ourselves workspaceItemDAO.save(context, workspaceItem); }
@Override public void createTemplateItem(Context context, Collection collection) throws SQLException, AuthorizeException { // Check authorisation AuthorizeUtil.authorizeManageTemplateItem(context, collection); if (collection.getTemplateItem() == null) { Item template = itemService.createTemplateItem(context, collection); collection.setTemplateItem(template); log.info(LogManager.getHeader(context, "create_template_item", "collection_id=" + collection.getID() + ",template_item_id=" + template.getID())); } }
@Override public Bitstream create(Context context, InputStream is) throws IOException, SQLException { // Store the bits UUID bitstreamID = bitstreamStorageService.store(context, bitstreamDAO.create(context, new Bitstream()), is); log.info(LogManager.getHeader(context, "create_bitstream", "bitstream_id=" + bitstreamID)); // Set the format to "unknown" Bitstream bitstream = find(context, bitstreamID); setFormat(context, bitstream, null); context.addEvent( new Event(Event.CREATE, Constants.BITSTREAM, bitstreamID, null, getIdentifiers(context, bitstream))); return bitstream; }
protected void deleteBundle(Context context, Item item, Bundle b) throws AuthorizeException, SQLException, IOException { // Check authorisation authorizeService.authorizeAction(context, item, Constants.REMOVE); bundleService.delete(context, b); log.info(LogManager.getHeader(context, "remove_bundle", "item_id=" + item.getID() + ",bundle_id=" + b.getID())); context .addEvent(new Event(Event.REMOVE, Constants.ITEM, item.getID(), Constants.BUNDLE, b.getID(), b.getName())); }
@Override public void removeBundle(Context context, Item item, Bundle bundle) throws SQLException, AuthorizeException, IOException { // Check authorisation authorizeService.authorizeAction(context, item, Constants.REMOVE); log.info(LogManager.getHeader(context, "remove_bundle", "item_id=" + item.getID() + ",bundle_id=" + bundle.getID())); context.addEvent(new Event(Event.REMOVE, Constants.ITEM, item.getID(), Constants.BUNDLE, bundle.getID(), bundle.getName(), getIdentifiers(context, item))); bundleService.delete(context, bundle); }