org.dspace.app.util.Util类的使用及代码示例

x33g5p2x  于2022-02-01 转载在 其他  
字(8.0k)|赞(0)|评价(0)|浏览(193)

本文整理了Java中org.dspace.app.util.Util类的一些代码示例,展示了Util类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util类的具体详情如下:
包路径:org.dspace.app.util.Util
类名称:Util

Util介绍

[英]Miscellaneous utility methods
[中]其他实用方法

代码示例

代码示例来源:origin: DSpace/DSpace

  1. /**
  2. * Version of encodeBitstreamName with one parameter, uses default encoding
  3. * <P>
  4. *
  5. * @param stringIn input string to encode
  6. * @return the encoded string
  7. * @throws java.io.UnsupportedEncodingException if encoding error
  8. */
  9. public static String encodeBitstreamName(String stringIn) throws java.io.UnsupportedEncodingException {
  10. return encodeBitstreamName(stringIn, Constants.DEFAULT_ENCODING);
  11. }

代码示例来源:origin: org.dspace/dspace-xmlui-api

  1. private XmlWorkflowItem retrieveWorkflowItem(Request request, Context context) throws SQLException, AuthorizeException, IOException {
  2. int workflowItemId = Util.getIntParameter(request, "wfiId");
  3. return XmlWorkflowItem.find(context, workflowItemId);
  4. }
  5. }

代码示例来源:origin: DSpace/DSpace

  1. public Status() {
  2. setOkay(true);
  3. setSourceVersion(Util.getSourceVersion());
  4. String[] version = Util.getSourceVersion().split("\\.");
  5. setApiVersion(version[0]); // major version
  6. setAuthenticated(false);
  7. }

代码示例来源:origin: DSpace/DSpace

  1. @Override
  2. public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
  3. throws SQLException, AuthorizeException, IOException, WorkflowException {
  4. String submitButton = Util.getSubmitButton(request, "submit_cancel");
  5. int page = Util.getIntParameter(request, "result-page");
  6. if (page == -1) {
  7. page = 0;

代码示例来源:origin: de.the-library-code.dspace/addon-duplication-detection-service-api

  1. String buttonPressed = Util.getSubmitButton(request, CANCEL_BUTTON);

代码示例来源:origin: org.dspace/dspace-xmlui-api

  1. @Override
  2. public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
  3. Request request = ObjectModelHelper.getRequest(objectModel);
  4. Context context = ContextUtil.obtainContext(request);
  5. if(!AuthorizeManager.isAdmin(context)){
  6. throw new AuthorizeException();
  7. }
  8. int[] workflowIdentifiers = Util.getIntParameters(request, "workflow_id");
  9. if(workflowIdentifiers != null){
  10. for (int workflowIdentifier : workflowIdentifiers) {
  11. XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowIdentifier);
  12. if (workflowItem != null) {
  13. XmlWorkflowManager.sendWorkflowItemBackSubmission(context, workflowItem, context.getCurrentUser(), "Item sent back to the submisson process by admin", null);
  14. }
  15. }
  16. }
  17. return null;
  18. }
  19. }

代码示例来源:origin: DSpace/DSpace

  1. @Override
  2. public void move(Context context, WorkspaceItem source, Collection fromCollection, Collection toCollection)
  3. throws DCInputsReaderException {
  4. source.setCollection(toCollection);
  5. List<MetadataValue> remove = new ArrayList<>();
  6. List<String> diff = Util.differenceInSubmissionFields(fromCollection, toCollection);
  7. for (String toRemove : diff) {
  8. for (MetadataValue value : source.getItem().getMetadata()) {
  9. if (value.getMetadataField().toString('.').equals(toRemove)) {
  10. remove.add(value);
  11. }
  12. }
  13. }
  14. source.getItem().removeMetadata(remove);
  15. }

代码示例来源:origin: org.dspace/dspace-xmlui-api

  1. public static FlowResult processReorderBitstream(Context context, int itemID, Request request) throws SQLException, AuthorizeException {
  2. String submitButton = Util.getSubmitButton(request, "submit_update_order");
  3. FlowResult result = new FlowResult();
  4. result.setContinue(false);
  5. int order = Util.getIntParameter(request, "order_" + bitstream.getID());

代码示例来源:origin: org.dspace/dspace-jspui-api

  1. AuthorizeException
  2. String buttonPressed = Util.getSubmitButton(request, LicenseStep.CANCEL_BUTTON);

代码示例来源:origin: org.dspace/dspace-xmlui-api

  1. @Override
  2. public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
  3. Request request = ObjectModelHelper.getRequest(objectModel);
  4. Context context = ContextUtil.obtainContext(request);
  5. if(!AuthorizeManager.isAdmin(context)){
  6. throw new AuthorizeException();
  7. }
  8. int[] workflowIdentifiers = Util.getIntParameters(request, "workflow_id");
  9. if(workflowIdentifiers != null){
  10. for (int workflowIdentifier : workflowIdentifiers) {
  11. XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowIdentifier);
  12. if (workflowItem != null) {
  13. WorkspaceItem workspaceItem = XmlWorkflowManager.sendWorkflowItemBackSubmission(context, workflowItem, context.getCurrentUser(), "Item sent back to the submisson process by admin", null);
  14. //Delete the workspaceItem
  15. workspaceItem.deleteAll();
  16. }
  17. }
  18. }
  19. return null;
  20. }
  21. }

代码示例来源:origin: DSpace/DSpace

  1. public static String encode(String value) {
  2. try {
  3. return Util.encodeBitstreamName(value, Constants.DEFAULT_ENCODING);
  4. } catch (UnsupportedEncodingException e) {
  5. log.warn(e.getMessage(), e);
  6. return value;
  7. }
  8. }
  9. }

代码示例来源:origin: org.dspace/dspace-discovery-xmlui-api

  1. private String getNextPageURL(SearchFilterParam browseParams, Request request) {
  2. int offSet = Util.getIntParameter(request, SearchFilterParam.OFFSET);
  3. if (offSet == -1)
  4. {
  5. offSet = 0;
  6. }
  7. Map<String, String> parameters = new HashMap<String, String>();
  8. parameters.putAll(browseParams.getCommonBrowseParams());
  9. parameters.putAll(browseParams.getControlParameters());
  10. parameters.put(SearchFilterParam.OFFSET, String.valueOf(offSet + DEFAULT_PAGE_SIZE));
  11. //TODO: correct comm/collection url
  12. // Add the filter queries
  13. String url = generateURL("search-filter", parameters);
  14. url = addFilterQueriesToUrl(url);
  15. return url;
  16. }

代码示例来源:origin: DSpace/DSpace

  1. Util.getSourceVersion());

代码示例来源:origin: org.dspace/dspace-jspui-api

  1. AuthorizeException
  2. String buttonPressed = Util.getSubmitButton(request, LicenseStep.CANCEL_BUTTON);

代码示例来源:origin: org.dspace/dspace-xmlui-api

  1. @Override
  2. public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
  3. Request request = ObjectModelHelper.getRequest(objectModel);
  4. Context context = ContextUtil.obtainContext(objectModel);
  5. // Or the user selected a checkbox full of workflow IDs
  6. int[] workflowIDs = Util.getIntParameters(request, "workflowID");
  7. if (workflowIDs != null)
  8. {
  9. for (int workflowID : workflowIDs)
  10. {
  11. PoolTask poolTask = PoolTask.findByWorkflowIdAndEPerson(context, workflowID, context.getCurrentUser().getID());
  12. XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowID);
  13. Workflow workflow = WorkflowFactory.getWorkflow(workflowItem.getCollection());
  14. WorkflowActionConfig currentAction = workflow.getStep(poolTask.getStepID()).getActionConfig(poolTask.getActionID());
  15. XmlWorkflowManager.doState(context, context.getCurrentUser(), request, workflowID, workflow, currentAction);
  16. }
  17. context.commit();
  18. }
  19. return null;
  20. }
  21. }

代码示例来源:origin: org.dspace/dspace-xmlui-api

  1. result.append("/").append(Util.encodeBitstreamName(name, "UTF-8"));

代码示例来源:origin: org.dspace/dspace-discovery-xmlui-api

  1. private String getPreviousPageURL(SearchFilterParam browseParams, Request request) {
  2. //If our offset should be 0 then we shouldn't be able to view a previous page url
  3. if (0 == queryArgs.getFacetOffset() && Util.getIntParameter(request, "offset") == -1)
  4. {
  5. return null;
  6. }
  7. int offset = Util.getIntParameter(request, SearchFilterParam.OFFSET);
  8. if(offset == -1 || offset == 0)
  9. {
  10. return null;
  11. }
  12. Map<String, String> parameters = new HashMap<String, String>();
  13. parameters.putAll(browseParams.getCommonBrowseParams());
  14. parameters.putAll(browseParams.getControlParameters());
  15. parameters.put(SearchFilterParam.OFFSET, String.valueOf(offset - DEFAULT_PAGE_SIZE));
  16. //TODO: correct comm/collection url
  17. // Add the filter queries
  18. String url = generateURL("search-filter", parameters);
  19. url = addFilterQueriesToUrl(url);
  20. return url;
  21. }

代码示例来源:origin: DSpace/DSpace

  1. zip.setComment("METS archive created by DSpace " + Util.getSourceVersion());
  2. Mets manifest = makeManifest(context, dso, params, extraStreams);

代码示例来源:origin: DSpace/DSpace

  1. path.append(Util.encodeBitstreamName(bitstream.getName(), Constants.DEFAULT_ENCODING));
  2. return path.toString();

代码示例来源:origin: DSpace/DSpace

  1. @Override
  2. public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
  3. throws SQLException, AuthorizeException, IOException {
  4. int page = Util.getIntParameter(request, "page");
  5. switch (page) {
  6. case MAIN_PAGE:
  7. return processMainPage(c, wfi, step, request);
  8. case REJECT_PAGE:
  9. return processRejectPage(c, wfi, step, request);
  10. default:
  11. return new ActionResult(ActionResult.TYPE.TYPE_CANCEL);
  12. }
  13. }

相关文章