List of usage examples for org.apache.commons.lang3 StringUtils substringBetween
public static String substringBetween(final String str, final String open, final String close)
Gets the String that is nested in between two Strings.
From source file:org.kuali.kra.iacuc.onlinereview.IacucProtocolOnlineReviewAction.java
protected String getOnlineReviewActionDocumentNumber(String parameterName, String actionMethodToCall) { String idxStr = null;/*from w w w.j ava2s .com*/ if (StringUtils.isBlank(parameterName) || parameterName.indexOf("." + actionMethodToCall + ".") == -1) { throw new IllegalArgumentException(String .format("getOnlineReviewActionIndex expects a non-empty value for parameterName parameter, " + "and it must contain as a substring the parameter actionMethodToCall. " + "The passed values were (%s,%s).", parameterName, actionMethodToCall)); } idxStr = StringUtils.substringBetween(parameterName, "." + actionMethodToCall + ".", "."); if (idxStr == null || StringUtils.isBlank(idxStr)) { throw new IllegalArgumentException( String.format("parameterName must be of the form '.(actionMethodToCall).(index).anchor, " + "the passed values were (%s,%s)", parameterName, actionMethodToCall)); } return idxStr; }
From source file:org.kuali.kra.iacuc.onlinereview.IacucProtocolOnlineReviewAction.java
protected int getOnlineReviewActionIndexNumber(String parameterName, String actionMethodToCall) { int result = -1; if (StringUtils.isBlank(parameterName) || parameterName.indexOf("." + actionMethodToCall + ".") == -1) { throw new IllegalArgumentException(String .format("getOnlineReviewActionIndex expects a non-empty value for parameterName parameter, " + "and it must contain as a substring the parameter actionMethodToCall. " + "The passed values were (%s,%s).", parameterName, actionMethodToCall)); }/* w ww.jav a2 s . c o m*/ String idxNmbr = StringUtils.substringBetween(parameterName, ".line.", ".anchor"); result = Integer.parseInt(idxNmbr); return result; }
From source file:org.kuali.kra.iacuc.personnel.IacucProtocolPersonnelAction.java
/** * This method is to get selected person index. * Each person data is displayed in individual panel. * Person index is required to identify the person to perform an action. * @param request/*from www . j av a 2 s. c o m*/ * @param document * @return */ protected int getSelectedPersonIndex(HttpServletRequest request, ProtocolDocumentBase document) { int selectedPersonIndex = -1; String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); if (StringUtils.isNotBlank(parameterName)) { selectedPersonIndex = Integer .parseInt(StringUtils.substringBetween(parameterName, "protocolPersons[", "].")); } return selectedPersonIndex; }
From source file:org.kuali.kra.iacuc.procedures.IacucProtocolProceduresAction.java
protected int getSelectedBeanIndex(HttpServletRequest request, String beanNameOpen, String beanNameClose) { int selectedBeanIndex = -1; String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); if (StringUtils.isNotBlank(parameterName)) { selectedBeanIndex = Integer .parseInt(StringUtils.substringBetween(parameterName, beanNameOpen, beanNameClose)); }//from w ww .java2 s . c o m return selectedBeanIndex; }
From source file:org.kuali.kra.iacuc.questionnaire.IacucProtocolQuestionnaireAction.java
/** * This is specifically for 'lookup' return a value. *///from w w w . j ava 2 s . c o m @Override public ActionForward refresh(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { ActionForward forward = super.refresh(mapping, form, request, response); if (request.getParameter("refreshCaller") != null && request.getParameter("refreshCaller").toString().equals("kualiLookupable")) { // Lookup field 'onchange' is not working if it is return a value from 'lookup', so do it on server side for (Object obj : request.getParameterMap().keySet()) { if (StringUtils.indexOf((String) obj, "questionnaireHelper.answerHeaders[") == 0) { ((IacucProtocolForm) form).getQuestionnaireHelper() .updateChildIndicator(Integer.parseInt(StringUtils.substringBetween((String) obj, "questionnaireHelper.answerHeaders[", "].answers["))); } } } if (StringUtils.isBlank(((IacucProtocolForm) form).getDocId())) { // lookup return to submission questionnaire popup forward = mapping.findForward(SUBMISSION_QUESTIONNAIRE); ((IacucProtocolForm) form).getQuestionnaireHelper().resetHeaderLabels(); } return forward; }
From source file:org.kuali.kra.iacuc.threers.IacucProtocolThreeRsAction.java
private int getAlternateSearchIndexNumber(String parameterName, String actionMethodToCall) { int result = -1; if (StringUtils.isBlank(parameterName) || parameterName.indexOf("." + actionMethodToCall + ".") == -1) { throw new IllegalArgumentException( String.format("getAlternateSearchIndex expects a non-empty value for parameterName parameter, " + "and it must contain as a substring the parameter actionMethodToCall. " + "The passed values were (%s,%s).", parameterName, actionMethodToCall)); }//from w ww . j a v a 2 s . c o m String idxNmbr = StringUtils.substringBetween(parameterName, ".line.", ".anchor"); result = Integer.parseInt(idxNmbr); return result; }
From source file:org.kuali.kra.irb.actions.notification.ProtocolNotificationTemplateAction.java
private int getSelectedNotificationTemplate(HttpServletRequest request) { int index = -1; String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); if (StringUtils.isNotBlank(parameterName)) { index = Integer.parseInt(StringUtils.substringBetween(parameterName, "notificationTemplates[", "]")); }/*from ww w . java2 s . c om*/ return index; }
From source file:org.kuali.kra.irb.correspondence.BatchCorrespondenceDetailAction.java
/** * This method returns the index of the selected correspondence type. * @param request//from ww w .ja v a2 s.co m * @return index */ protected int getSelectedBatchCorrespondenceDetail(HttpServletRequest request) { int index = -1; String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); if (StringUtils.isNotBlank(parameterName)) { index = Integer .parseInt(StringUtils.substringBetween(parameterName, "batchCorrespondenceDetail[", "]")); } return index; }
From source file:org.kuali.kra.irb.onlinereview.ProtocolOnlineReviewAction.java
/** * The online review actions are encoded into the methodToCall parameters * using: (actionMethodToCall).(onlineReviewDocumentNumber).anchor in the name attributes of * the online review form buttons. Where * /*from ww w . j a v a 2 s . c o m*/ * actionMethodToCall is for example 'routeOnlineReview' * onlineReviewDocumentNumber: is the document number of the online review * * @param parameterName The parameter being decoded, usually retrieved from the request parameters as KNSConstants.METHOD_TO_CALL_ATTRIBUTE. * @param actionMethodToCall The methodToCall ( function name in the action being executed. ). * * @return */ protected String getOnlineReviewActionDocumentNumber(String parameterName, String actionMethodToCall) { String idxStr = null; if (StringUtils.isBlank(parameterName) || parameterName.indexOf("." + actionMethodToCall + ".") == -1) { throw new IllegalArgumentException(String .format("getOnlineReviewActionIndex expects a non-empty value for parameterName parameter, " + "and it must contain as a substring the parameter actionMethodToCall. " + "The passed values were (%s,%s).", parameterName, actionMethodToCall)); } idxStr = StringUtils.substringBetween(parameterName, "." + actionMethodToCall + ".", "."); if (idxStr == null || StringUtils.isBlank(idxStr)) { throw new IllegalArgumentException( String.format("parameterName must be of the form '.(actionMethodToCall).(index).anchor, " + "the passed values were (%s,%s)", parameterName, actionMethodToCall)); } return idxStr; }
From source file:org.kuali.kra.irb.personnel.ProtocolPersonnelAction.java
/** * This method is to get selected person index. * Each person data is displayed in individual panel. * Person index is required to identify the person to perform an action. * @param request//from www . j av a 2 s .c o m * @param document * @return */ protected int getSelectedPersonIndex(HttpServletRequest request, ProtocolDocument document) { int selectedPersonIndex = -1; String parameterName = (String) request.getAttribute(KRADConstants.METHOD_TO_CALL_ATTRIBUTE); if (StringUtils.isNotBlank(parameterName)) { selectedPersonIndex = Integer .parseInt(StringUtils.substringBetween(parameterName, "protocolPersons[", "].")); } return selectedPersonIndex; }