List of usage examples for org.apache.commons.lang BooleanUtils toBoolean
public static boolean toBoolean(String str)
Converts a String to a boolean (optimised for performance).
'true'
, 'on'
or 'yes'
(case insensitive) will return true
.
From source file:org.kuali.kra.proposaldevelopment.service.impl.ProposalDevelopmentServiceImpl.java
private boolean isAuthorizedToAccess(String proposalNumber) { boolean isAuthorized = true; if (proposalNumber.contains(Constants.COLON)) { if (GlobalVariables.getUserSession() != null) { // TODO : this is a quick hack for KC 3.1.1 to provide authorization check for dwr/ajax call. dwr/ajax will be replaced by // jquery/ajax in rice 2.0 String[] invalues = StringUtils.split(proposalNumber, Constants.COLON); String docFormKey = invalues[1]; if (StringUtils.isBlank(docFormKey)) { isAuthorized = false;// w w w .j a va2 s .co m } else { Object formObj = GlobalVariables.getUserSession().retrieveObject(docFormKey); if (formObj == null || !(formObj instanceof ProposalDevelopmentForm)) { isAuthorized = false; } else { Map<String, String> editModes = ((ProposalDevelopmentForm) formObj).getEditingMode(); isAuthorized = BooleanUtils .toBoolean(editModes.get(AuthorizationConstants.EditMode.FULL_ENTRY)) || BooleanUtils.toBoolean(editModes.get(AuthorizationConstants.EditMode.VIEW_ONLY)) || BooleanUtils.toBoolean(editModes.get("modifyProposal")); } } } else { // TODO : it seemed that tomcat has this issue intermittently ? LOG.info("dwr/ajax does not have session "); } } return isAuthorized; }
From source file:org.kuali.kra.proposaldevelopment.specialreview.SpecialReviewHelper.java
@Override protected boolean hasModifySpecialReviewPermission(String principalId) { return BooleanUtils.toBoolean((String) form.getEditingMode().get("modifyProposal")); }
From source file:org.kuali.kra.s2s.service.impl.KRAS2SServiceImpl.java
private boolean isAuthorizedToAccess(String proposalNumber) { boolean isAuthorized = true; if (proposalNumber.contains(Constants.COLON)) { if (GlobalVariables.getUserSession() != null) { // TODO : this is a quick hack for KC 3.1.1 to provide authorization check for dwr/ajax call. dwr/ajax will be replaced by // jquery/ajax in rice 2.0 String[] invalues = StringUtils.split(proposalNumber, Constants.COLON); String docFormKey = invalues[1]; if (StringUtils.isBlank(docFormKey)) { isAuthorized = false;/*w w w. ja v a 2 s .c o m*/ } else { Object formObj = GlobalVariables.getUserSession().retrieveObject(docFormKey); if (formObj == null || !(formObj instanceof ProposalDevelopmentForm)) { isAuthorized = false; } else { Map<String, String> editModes = ((ProposalDevelopmentForm) formObj).getEditingMode(); isAuthorized = (BooleanUtils .toBoolean(editModes.get(AuthorizationConstants.EditMode.FULL_ENTRY)) || BooleanUtils.toBoolean(editModes.get(AuthorizationConstants.EditMode.VIEW_ONLY)) || BooleanUtils.toBoolean(editModes.get("modifyProposal"))) && BooleanUtils.toBoolean(editModes.get("submitToSponsor")); } } } else { // TODO : it seemed that tomcat has this issue intermittently ? LOG.info("dwr/ajax does not have session "); } } return isAuthorized; }
From source file:org.kuali.kra.test.infrastructure.KcSeleniumHelper.java
/** * Sets the value of a checkbox./*from www . ja v a 2s . c om*/ * * @param element the located parent element * @param value the new value of the element */ private final void setCheckbox(final WebElement element, final String value) { boolean booleanValue = BooleanUtils.toBoolean(value); if ((booleanValue && !element.isSelected()) || (!booleanValue && element.isSelected())) { element.click(); } }
From source file:org.kuali.student.cm.course.service.impl.CourseMaintainableImpl.java
protected void populatePassFailOnWrapper() { CourseInfoWrapper courseInfoWrapper = (CourseInfoWrapper) getDataObject(); for (AttributeInfo attr : courseInfoWrapper.getCourseInfo().getAttributes()) { if (StringUtils.equals(attr.getKey(), CurriculumManagementConstants.COURSE_RESULT_COMP_ATTR_PASSFAIL)) { courseInfoWrapper.setPassFail(BooleanUtils.toBoolean(attr.getValue())); break; }/* w w w . j ava 2 s. c om*/ } }
From source file:org.kuali.student.cm.course.service.impl.CourseMaintainableImpl.java
protected void populateAuditOnWrapper() { CourseInfoWrapper courseInfoWrapper = (CourseInfoWrapper) getDataObject(); for (AttributeInfo attr : courseInfoWrapper.getCourseInfo().getAttributes()) { if (StringUtils.equals(attr.getKey(), CurriculumManagementConstants.COURSE_RESULT_COMP_ATTR_AUDIT)) { courseInfoWrapper.setAudit(BooleanUtils.toBoolean(attr.getValue())); break; }//w ww .j av a 2 s . co m } }
From source file:org.kuali.student.cm.proposal.service.impl.ProposalLookupableImpl.java
/** * Determines if given data object has associated maintenance document that allows edit maintenance * actions// www. j a va 2s .co m * * @return boolean true if the maintenance edit action is allowed for the data object instance, false otherwise */ public boolean allowsProposalEditAction(Object dataObject) { ProposalInfo proposalInfo = (ProposalInfo) dataObject; return BooleanUtils.toBoolean(proposalInfo.getAttributeValue(CAN_EDIT_PROPOSAL_KEY)); }
From source file:org.kuali.student.cm.proposal.service.impl.ProposalLookupableImpl.java
/** * Determines if given data object has associated maintenance document that allows edit maintenance * actions//from w w w. j a v a 2 s . c om * * @return boolean true if the maintenance edit action is allowed for the data object instance, false otherwise */ public boolean allowsProposalOpenAction(Object dataObject) { ProposalInfo proposalInfo = (ProposalInfo) dataObject; return BooleanUtils.toBoolean(proposalInfo.getAttributeValue(CAN_OPEN_PROPOSAL_KEY)); }
From source file:org.kuali.student.cm.proposal.service.impl.ProposalMaintainableImpl.java
@Override public void processAfterNew(MaintenanceDocument document, Map<String, String[]> requestParameters) { ProposalElementsWrapper proposalElementsWrapper = (ProposalElementsWrapper) getDataObject(); // Initialize Author & Collaborator if (proposalElementsWrapper.getCollaboratorWrappers().isEmpty()) { proposalElementsWrapper.getCollaboratorWrappers().add(new CollaboratorWrapper()); }/*from www . j a v a 2 s . com*/ // Initialize Supporting Documents if (proposalElementsWrapper.getSupportingDocs().isEmpty()) { proposalElementsWrapper.getSupportingDocs().add(new SupportingDocumentInfoWrapper()); } if (requestParameters.get(CurriculumManagementConstants.UrlParams.USE_CURRICULUM_REVIEW) != null && requestParameters .get(CurriculumManagementConstants.UrlParams.USE_CURRICULUM_REVIEW).length != 0) { Boolean isUseReviewProcess = BooleanUtils.toBoolean( requestParameters.get(CurriculumManagementConstants.UrlParams.USE_CURRICULUM_REVIEW)[0]); proposalElementsWrapper.getUiHelper().setUseReviewProcess(isUseReviewProcess); } }
From source file:org.kuali.student.enrollment.class2.acal.controller.AcademicCalendarController.java
/** * This method loads an academic calendar based on the parameters passed into the request. * * These are the supported request parameters (specific to Acal) * 1. id - Academic Calendar Id to load in to UI * 2. readOnlyView - If true, sets the view as read only * 3. selectTab - can be 'info' or 'term' * *//*from ww w .jav a 2 s . c o m*/ @Override @RequestMapping(method = RequestMethod.GET, params = "methodToCall=start") public ModelAndView start(@ModelAttribute("KualiForm") UifFormBase form, HttpServletRequest request, HttpServletResponse response) { AcademicCalendarForm acalForm = (AcademicCalendarForm) form; String acalId = request.getParameter(CalendarConstants.CALENDAR_ID); if (StringUtils.isNotBlank(acalId)) { getAcalViewHelperService(acalForm).populateAcademicCalendar(acalId, acalForm); } String readOnlyView = request.getParameter(CalendarConstants.READ_ONLY_VIEW); acalForm.getView().setReadOnly(BooleanUtils.toBoolean(readOnlyView)); if (StringUtils.isNotBlank(request.getParameter(CalendarConstants.SELECT_TAB))) { acalForm.setDefaultTabToShow(request.getParameter(CalendarConstants.SELECT_TAB)); } return getUIFModelAndView(form); }