本文整理了Java中org.dspace.app.util.Util
类的一些代码示例,展示了Util
类的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util
类的具体详情如下:
包路径:org.dspace.app.util.Util
类名称:Util
[英]Miscellaneous utility methods
[中]其他实用方法
代码示例来源:origin: DSpace/DSpace
/**
* Version of encodeBitstreamName with one parameter, uses default encoding
* <P>
*
* @param stringIn input string to encode
* @return the encoded string
* @throws java.io.UnsupportedEncodingException if encoding error
*/
public static String encodeBitstreamName(String stringIn) throws java.io.UnsupportedEncodingException {
return encodeBitstreamName(stringIn, Constants.DEFAULT_ENCODING);
}
代码示例来源:origin: org.dspace/dspace-xmlui-api
private XmlWorkflowItem retrieveWorkflowItem(Request request, Context context) throws SQLException, AuthorizeException, IOException {
int workflowItemId = Util.getIntParameter(request, "wfiId");
return XmlWorkflowItem.find(context, workflowItemId);
}
}
代码示例来源:origin: DSpace/DSpace
public Status() {
setOkay(true);
setSourceVersion(Util.getSourceVersion());
String[] version = Util.getSourceVersion().split("\\.");
setApiVersion(version[0]); // major version
setAuthenticated(false);
}
代码示例来源:origin: DSpace/DSpace
@Override
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
throws SQLException, AuthorizeException, IOException, WorkflowException {
String submitButton = Util.getSubmitButton(request, "submit_cancel");
int page = Util.getIntParameter(request, "result-page");
if (page == -1) {
page = 0;
代码示例来源:origin: de.the-library-code.dspace/addon-duplication-detection-service-api
String buttonPressed = Util.getSubmitButton(request, CANCEL_BUTTON);
代码示例来源:origin: org.dspace/dspace-xmlui-api
@Override
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
Request request = ObjectModelHelper.getRequest(objectModel);
Context context = ContextUtil.obtainContext(request);
if(!AuthorizeManager.isAdmin(context)){
throw new AuthorizeException();
}
int[] workflowIdentifiers = Util.getIntParameters(request, "workflow_id");
if(workflowIdentifiers != null){
for (int workflowIdentifier : workflowIdentifiers) {
XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowIdentifier);
if (workflowItem != null) {
XmlWorkflowManager.sendWorkflowItemBackSubmission(context, workflowItem, context.getCurrentUser(), "Item sent back to the submisson process by admin", null);
}
}
}
return null;
}
}
代码示例来源:origin: DSpace/DSpace
@Override
public void move(Context context, WorkspaceItem source, Collection fromCollection, Collection toCollection)
throws DCInputsReaderException {
source.setCollection(toCollection);
List<MetadataValue> remove = new ArrayList<>();
List<String> diff = Util.differenceInSubmissionFields(fromCollection, toCollection);
for (String toRemove : diff) {
for (MetadataValue value : source.getItem().getMetadata()) {
if (value.getMetadataField().toString('.').equals(toRemove)) {
remove.add(value);
}
}
}
source.getItem().removeMetadata(remove);
}
代码示例来源:origin: org.dspace/dspace-xmlui-api
public static FlowResult processReorderBitstream(Context context, int itemID, Request request) throws SQLException, AuthorizeException {
String submitButton = Util.getSubmitButton(request, "submit_update_order");
FlowResult result = new FlowResult();
result.setContinue(false);
int order = Util.getIntParameter(request, "order_" + bitstream.getID());
代码示例来源:origin: org.dspace/dspace-jspui-api
AuthorizeException
String buttonPressed = Util.getSubmitButton(request, LicenseStep.CANCEL_BUTTON);
代码示例来源:origin: org.dspace/dspace-xmlui-api
@Override
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
Request request = ObjectModelHelper.getRequest(objectModel);
Context context = ContextUtil.obtainContext(request);
if(!AuthorizeManager.isAdmin(context)){
throw new AuthorizeException();
}
int[] workflowIdentifiers = Util.getIntParameters(request, "workflow_id");
if(workflowIdentifiers != null){
for (int workflowIdentifier : workflowIdentifiers) {
XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowIdentifier);
if (workflowItem != null) {
WorkspaceItem workspaceItem = XmlWorkflowManager.sendWorkflowItemBackSubmission(context, workflowItem, context.getCurrentUser(), "Item sent back to the submisson process by admin", null);
//Delete the workspaceItem
workspaceItem.deleteAll();
}
}
}
return null;
}
}
代码示例来源:origin: DSpace/DSpace
public static String encode(String value) {
try {
return Util.encodeBitstreamName(value, Constants.DEFAULT_ENCODING);
} catch (UnsupportedEncodingException e) {
log.warn(e.getMessage(), e);
return value;
}
}
}
代码示例来源:origin: org.dspace/dspace-discovery-xmlui-api
private String getNextPageURL(SearchFilterParam browseParams, Request request) {
int offSet = Util.getIntParameter(request, SearchFilterParam.OFFSET);
if (offSet == -1)
{
offSet = 0;
}
Map<String, String> parameters = new HashMap<String, String>();
parameters.putAll(browseParams.getCommonBrowseParams());
parameters.putAll(browseParams.getControlParameters());
parameters.put(SearchFilterParam.OFFSET, String.valueOf(offSet + DEFAULT_PAGE_SIZE));
//TODO: correct comm/collection url
// Add the filter queries
String url = generateURL("search-filter", parameters);
url = addFilterQueriesToUrl(url);
return url;
}
代码示例来源:origin: DSpace/DSpace
Util.getSourceVersion());
代码示例来源:origin: org.dspace/dspace-jspui-api
AuthorizeException
String buttonPressed = Util.getSubmitButton(request, LicenseStep.CANCEL_BUTTON);
代码示例来源:origin: org.dspace/dspace-xmlui-api
@Override
public Map act(Redirector redirector, SourceResolver resolver, Map objectModel, String source, Parameters parameters) throws Exception {
Request request = ObjectModelHelper.getRequest(objectModel);
Context context = ContextUtil.obtainContext(objectModel);
// Or the user selected a checkbox full of workflow IDs
int[] workflowIDs = Util.getIntParameters(request, "workflowID");
if (workflowIDs != null)
{
for (int workflowID : workflowIDs)
{
PoolTask poolTask = PoolTask.findByWorkflowIdAndEPerson(context, workflowID, context.getCurrentUser().getID());
XmlWorkflowItem workflowItem = XmlWorkflowItem.find(context, workflowID);
Workflow workflow = WorkflowFactory.getWorkflow(workflowItem.getCollection());
WorkflowActionConfig currentAction = workflow.getStep(poolTask.getStepID()).getActionConfig(poolTask.getActionID());
XmlWorkflowManager.doState(context, context.getCurrentUser(), request, workflowID, workflow, currentAction);
}
context.commit();
}
return null;
}
}
代码示例来源:origin: org.dspace/dspace-xmlui-api
result.append("/").append(Util.encodeBitstreamName(name, "UTF-8"));
代码示例来源:origin: org.dspace/dspace-discovery-xmlui-api
private String getPreviousPageURL(SearchFilterParam browseParams, Request request) {
//If our offset should be 0 then we shouldn't be able to view a previous page url
if (0 == queryArgs.getFacetOffset() && Util.getIntParameter(request, "offset") == -1)
{
return null;
}
int offset = Util.getIntParameter(request, SearchFilterParam.OFFSET);
if(offset == -1 || offset == 0)
{
return null;
}
Map<String, String> parameters = new HashMap<String, String>();
parameters.putAll(browseParams.getCommonBrowseParams());
parameters.putAll(browseParams.getControlParameters());
parameters.put(SearchFilterParam.OFFSET, String.valueOf(offset - DEFAULT_PAGE_SIZE));
//TODO: correct comm/collection url
// Add the filter queries
String url = generateURL("search-filter", parameters);
url = addFilterQueriesToUrl(url);
return url;
}
代码示例来源:origin: DSpace/DSpace
zip.setComment("METS archive created by DSpace " + Util.getSourceVersion());
Mets manifest = makeManifest(context, dso, params, extraStreams);
代码示例来源:origin: DSpace/DSpace
path.append(Util.encodeBitstreamName(bitstream.getName(), Constants.DEFAULT_ENCODING));
return path.toString();
代码示例来源:origin: DSpace/DSpace
@Override
public ActionResult execute(Context c, XmlWorkflowItem wfi, Step step, HttpServletRequest request)
throws SQLException, AuthorizeException, IOException {
int page = Util.getIntParameter(request, "page");
switch (page) {
case MAIN_PAGE:
return processMainPage(c, wfi, step, request);
case REJECT_PAGE:
return processRejectPage(c, wfi, step, request);
default:
return new ActionResult(ActionResult.TYPE.TYPE_CANCEL);
}
}
内容来源于网络,如有侵权,请联系作者删除!