List of usage examples for org.apache.commons.lang StringUtils lowerCase
public static String lowerCase(String str)
Converts a String to lower case as per String#toLowerCase() .
From source file:org.kuali.kfs.sys.businessobject.AccountingLineParserBase.java
/** * Parses the csv line// ww w . j a va2s . c om * * @param accountingLineClass * @param lineToParse * @return Map containing accounting line attribute,value pairs */ protected Map<String, String> parseAccountingLine(Class<? extends AccountingLine> accountingLineClass, String lineToParse) { if (StringUtils.isNotBlank(fileName) && !StringUtils.lowerCase(fileName).endsWith(".csv")) { throw new AccountingLineParserException("unsupported file format: " + fileName, ERROR_INVALID_FILE_FORMAT, fileName); } String[] attributes = chooseFormat(accountingLineClass); String[] attributeValues = StringUtils.splitPreserveAllTokens(lineToParse, ","); Map<String, String> attributeValueMap = new HashMap<String, String>(); for (int i = 0; i < Math.min(attributeValues.length, attributes.length); i++) { attributeValueMap.put(attributes[i], attributeValues[i]); } return attributeValueMap; }
From source file:org.kuali.kpme.tklm.leave.approval.web.LeaveApprovalAction.java
private void setApprovalTables(LeaveApprovalActionForm leaveApprovalActionForm, HttpServletRequest request, List<String> principalIds, String docIdSearchTerm) { if (principalIds.isEmpty()) { leaveApprovalActionForm.setLeaveApprovalRows(new ArrayList<ApprovalLeaveSummaryRowContract>()); leaveApprovalActionForm.setResultSize(0); } else {//from ww w .j a v a 2 s . co m List<ApprovalLeaveSummaryRowContract> approvalRows = getApprovalLeaveRows(leaveApprovalActionForm, principalIds, docIdSearchTerm); String sortField = getSortField(request); if (StringUtils.isEmpty(sortField) || StringUtils.equals(sortField, "name")) { final boolean sortNameAscending = getAscending(request); Collections.sort(approvalRows, new Comparator<ApprovalLeaveSummaryRowContract>() { @Override public int compare(ApprovalLeaveSummaryRowContract row1, ApprovalLeaveSummaryRowContract row2) { if (sortNameAscending) { return ObjectUtils.compare(StringUtils.lowerCase(row1.getName()), StringUtils.lowerCase(row2.getName())); } else { return ObjectUtils.compare(StringUtils.lowerCase(row2.getName()), StringUtils.lowerCase(row1.getName())); } } }); } else if (StringUtils.equals(sortField, "documentID")) { final boolean sortDocumentIdAscending = getAscending(request); Collections.sort(approvalRows, new Comparator<ApprovalLeaveSummaryRowContract>() { @Override public int compare(ApprovalLeaveSummaryRowContract row1, ApprovalLeaveSummaryRowContract row2) { if (sortDocumentIdAscending) { return ObjectUtils.compare(NumberUtils.toInt(row1.getDocumentId()), NumberUtils.toInt(row2.getDocumentId())); } else { return ObjectUtils.compare(NumberUtils.toInt(row2.getDocumentId()), NumberUtils.toInt(row1.getDocumentId())); } } }); } else if (StringUtils.equals(sortField, "status")) { final boolean sortStatusIdAscending = getAscending(request); Collections.sort(approvalRows, new Comparator<ApprovalLeaveSummaryRowContract>() { @Override public int compare(ApprovalLeaveSummaryRowContract row1, ApprovalLeaveSummaryRowContract row2) { if (sortStatusIdAscending) { return ObjectUtils.compare(StringUtils.lowerCase(row1.getApprovalStatus()), StringUtils.lowerCase(row2.getApprovalStatus())); } else { return ObjectUtils.compare(StringUtils.lowerCase(row2.getApprovalStatus()), StringUtils.lowerCase(row1.getApprovalStatus())); } } }); } String page = request.getParameter((new ParamEncoder(HrConstants.APPROVAL_TABLE_ID) .encodeParameterName(TableTagParameters.PARAMETER_PAGE))); Integer beginIndex = StringUtils.isBlank(page) || StringUtils.equals(page, "1") ? 0 : (Integer.parseInt(page) - 1) * leaveApprovalActionForm.getPageSize(); Integer endIndex = beginIndex + leaveApprovalActionForm.getPageSize() > approvalRows.size() ? approvalRows.size() : beginIndex + leaveApprovalActionForm.getPageSize(); List<ApprovalLeaveSummaryRowContract> sublist = new ArrayList<ApprovalLeaveSummaryRowContract>(); sublist.addAll(approvalRows.subList(beginIndex, endIndex)); leaveApprovalActionForm.setLeaveApprovalRows(sublist); leaveApprovalActionForm.setResultSize(approvalRows.size()); Map<String, String> userColorMap = new HashMap<String, String>(); Set<String> randomColors = new HashSet<String>(); List<Map<String, String>> approvalRowsMap = new ArrayList<Map<String, String>>(); DateTimeFormatter fmt = DateTimeFormat.forPattern("yyyy-MM-dd"); if (CollectionUtils.isNotEmpty(approvalRows)) { for (ApprovalLeaveSummaryRowContract row : approvalRows) { for (LocalDateTime date : leaveApprovalActionForm.getLeaveCalendarDates()) { //SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); //String dateString = formatter.format(date); String dateString = fmt.print(date); Map<String, BigDecimal> earnCodeMap = row.getEarnCodeLeaveHours().get(date); if (earnCodeMap != null && !earnCodeMap.isEmpty()) { for (String key : earnCodeMap.keySet()) { String color = null; Map<String, String> event = new HashMap<String, String>(); event.put("title", (key.split("[|]"))[0] + "-" + earnCodeMap.get(key).toString()); event.put("start", dateString); if (!userColorMap.containsKey(row.getPrincipalId())) { color = TKUtils.getRandomColor(randomColors); randomColors.add(color); userColorMap.put(row.getPrincipalId(), color); } row.setColor(userColorMap.get(row.getPrincipalId())); event.put("color", userColorMap.get(row.getPrincipalId())); event.put("className", "event-approval"); approvalRowsMap.add(event); } } } } } leaveApprovalActionForm.setOutputString(JSONValue.toJSONString(approvalRowsMap)); } }
From source file:org.kuali.kpme.tklm.time.approval.web.TimeApprovalAction.java
protected void setApprovalTables(TimeApprovalActionForm timeApprovalActionForm, HttpServletRequest request, List<String> principalIds, String docIdSearchTerm) { if (principalIds.isEmpty()) { timeApprovalActionForm.setApprovalRows(new ArrayList<ApprovalTimeSummaryRow>()); timeApprovalActionForm.setResultSize(0); timeApprovalActionForm.setOutputString(null); } else {//from w w w .ja v a 2 s . c o m List<ApprovalTimeSummaryRow> approvalRows = getApprovalRows(timeApprovalActionForm, principalIds, docIdSearchTerm); timeApprovalActionForm.setOutputString( !CollectionUtils.isEmpty(approvalRows) ? approvalRows.get(0).getOutputString() : null); final String sortField = getSortField(request); if (StringUtils.isEmpty(sortField) || StringUtils.equals(sortField, "name")) { final boolean sortNameAscending = getAscending(request); Collections.sort(approvalRows, new Comparator<ApprovalTimeSummaryRow>() { @Override public int compare(ApprovalTimeSummaryRow row1, ApprovalTimeSummaryRow row2) { if (sortNameAscending) { return ObjectUtils.compare(StringUtils.lowerCase(row1.getName()), StringUtils.lowerCase(row2.getName())); } else { return ObjectUtils.compare(StringUtils.lowerCase(row2.getName()), StringUtils.lowerCase(row1.getName())); } } }); } else if (StringUtils.equals(sortField, "documentID")) { final boolean sortDocumentIdAscending = getAscending(request); Collections.sort(approvalRows, new Comparator<ApprovalTimeSummaryRow>() { @Override public int compare(ApprovalTimeSummaryRow row1, ApprovalTimeSummaryRow row2) { if (sortDocumentIdAscending) { return ObjectUtils.compare(NumberUtils.toInt(row1.getDocumentId()), NumberUtils.toInt(row2.getDocumentId())); } else { return ObjectUtils.compare(NumberUtils.toInt(row2.getDocumentId()), NumberUtils.toInt(row1.getDocumentId())); } } }); } else if (StringUtils.equals(sortField, "status")) { final boolean sortStatusIdAscending = getAscending(request); ; Collections.sort(approvalRows, new Comparator<ApprovalTimeSummaryRow>() { @Override public int compare(ApprovalTimeSummaryRow row1, ApprovalTimeSummaryRow row2) { if (sortStatusIdAscending) { return ObjectUtils.compare(StringUtils.lowerCase(row1.getApprovalStatus()), StringUtils.lowerCase(row2.getApprovalStatus())); } else { return ObjectUtils.compare(StringUtils.lowerCase(row2.getApprovalStatus()), StringUtils.lowerCase(row1.getApprovalStatus())); } } }); } String page = request.getParameter((new ParamEncoder(HrConstants.APPROVAL_TABLE_ID) .encodeParameterName(TableTagParameters.PARAMETER_PAGE))); Integer beginIndex = StringUtils.isBlank(page) || StringUtils.equals(page, "1") ? 0 : (Integer.parseInt(page) - 1) * timeApprovalActionForm.getPageSize(); Integer endIndex = beginIndex + timeApprovalActionForm.getPageSize() > approvalRows.size() ? approvalRows.size() : beginIndex + timeApprovalActionForm.getPageSize(); for (ApprovalTimeSummaryRow approvalTimeSummaryRow : approvalRows) { approvalTimeSummaryRow.setMissedPunchList(getMissedPunches(approvalTimeSummaryRow.getDocumentId())); } MissedPunchDocumentService mpds; mpds = TkServiceLocator.getMissedPunchDocumentService(); Map<String, Boolean> missedPunchPermissions = new HashMap<String, Boolean>(); for (ApprovalTimeSummaryRow approvalTimeSummaryRow : approvalRows) { for (MissedPunch mp : approvalTimeSummaryRow.getMissedPunchList()) { MissedPunchDocument mpd = (MissedPunchDocument) mpds .getMissedPunchDocumentByMissedPunchId(mp.getTkMissedPunchId()); String groupKey = mpd.getGroupKeyCode(); Long workArea = mpd.getWorkArea(); String department = mpd.getDepartment(); String location = mpd.getGroupKey() != null ? mpd.getGroupKey().getLocationId() : HrServiceLocator.getHrGroupKeyService() .getHrGroupKey(mpd.getGroupKeyCode(), mpd.getMissedPunch().getActionLocalDate()) .getLocationId(); String principalId = HrContext.getPrincipalId(); Map<String, String> roleQualification = new HashMap<String, String>(); roleQualification.put(KimConstants.AttributeConstants.PRINCIPAL_ID, principalId); roleQualification.put(KPMERoleMemberAttribute.DEPARTMENT.getRoleMemberAttributeName(), department); roleQualification.put(KPMERoleMemberAttribute.WORK_AREA.getRoleMemberAttributeName(), workArea.toString()); roleQualification.put(KPMERoleMemberAttribute.GROUP_KEY_CODE.getRoleMemberAttributeName(), groupKey); roleQualification.put(KPMERoleMemberAttribute.LOCATION.getRoleMemberAttributeName(), location); Map<String, String> permissionDetails = new HashMap<String, String>(); permissionDetails.put(KimConstants.AttributeConstants.DOCUMENT_TYPE_NAME, KRADServiceLocatorWeb .getDocumentDictionaryService().getDocumentTypeByClass(MissedPunchDocument.class)); boolean canView = (KimApiServiceLocator.getPermissionService().isAuthorizedByTemplate( principalId, KPMENamespace.KPME_WKFLW.getNamespaceCode(), KPMEPermissionTemplate.VIEW_KPME_RECORD.getPermissionTemplateName(), permissionDetails, roleQualification)); missedPunchPermissions.put(mp.getMissedPunchDocId(), canView); } } timeApprovalActionForm.setMissedPunchPermissions(missedPunchPermissions); List<ApprovalTimeSummaryRow> sublist = new ArrayList<ApprovalTimeSummaryRow>(); sublist.addAll(approvalRows.subList(beginIndex, endIndex)); timeApprovalActionForm.setApprovalRows(sublist); timeApprovalActionForm.setResultSize(approvalRows.size()); } }
From source file:org.kuali.ole.module.purap.util.ItemParserBase.java
/** * Checks whether the specified item import file is not null and of a valid format; * throws exceptions if conditions not satisfied. * * @param itemClass the specified item import file *//*from w ww. j av a 2 s . c o m*/ protected void checkItemFile(FormFile itemFile) { if (itemFile == null) { throw new ItemParserException("invalid (null) item import file", OLEKeyConstants.ERROR_UPLOADFILE_NULL); } String fileName = itemFile.getFileName(); if (StringUtils.isNotBlank(fileName) && !StringUtils.lowerCase(fileName).endsWith(".csv") && !StringUtils.lowerCase(fileName).endsWith(".xls")) { throw new ItemParserException("unsupported item import file format: " + fileName, ERROR_ITEMPARSER_INVALID_FILE_FORMAT, fileName); } }
From source file:org.kuali.rice.core.impl.config.property.JAXBConfigImpl.java
protected boolean isPropertiesFile(String filename) { String lower = StringUtils.lowerCase(filename); return StringUtils.endsWith(lower, ".properties"); }
From source file:org.kuali.student.cm.course.service.impl.CourseMaintainableImpl.java
/** * Updates the ReviewProposalDisplay object for the Course Proposal and refreshes remote data elements based on passed in @shouldRepopulateRemoteData param * * @param shouldRepopulateRemoteData identifies whether remote data elements like Collaborators should be refreshed *//*from w ww. j a v a2 s . c om*/ @Override protected void updateReview(ProposalElementsWrapper proposalElementsWrapper, boolean shouldRepopulateRemoteData) { CourseInfoWrapper courseInfoWrapper = (CourseInfoWrapper) proposalElementsWrapper; CourseInfo savedCourseInfo = courseInfoWrapper.getCourseInfo(); // Update course section ReviewProposalDisplay reviewData = courseInfoWrapper.getReviewProposalDisplay(); if (reviewData == null) { reviewData = new ReviewProposalDisplay(); courseInfoWrapper.setReviewProposalDisplay(reviewData); } if (StringUtils.isBlank(courseInfoWrapper.getPreviousSubjectCode()) && StringUtils.isNotBlank(savedCourseInfo.getSubjectArea())) { courseInfoWrapper.setPreviousSubjectCode(savedCourseInfo.getSubjectArea()); } reviewData.getCourseSection().setCourseTitle(savedCourseInfo.getCourseTitle()); reviewData.getCourseSection().setTranscriptTitle(savedCourseInfo.getTranscriptTitle()); reviewData.getCourseSection().setSubjectArea(savedCourseInfo.getSubjectArea()); reviewData.getCourseSection().setCourseNumberSuffix(savedCourseInfo.getCourseNumberSuffix()); if (StringUtils.isNotBlank(courseInfoWrapper.getProposalInfo().getId())) { Date updateTime = courseInfoWrapper.getProposalInfo().getMeta().getUpdateTime(); if (updateTime != null) { courseInfoWrapper .setLastUpdated(CurriculumManagementConstants.CM_DATE_FORMATTER.format(updateTime)); } } if (savedCourseInfo.getDescr() != null) { reviewData.getCourseSection().setDescription(savedCourseInfo.getDescr().getPlain()); } reviewData.getCourseSection().getInstructors().clear(); for (CluInstructorInfoWrapper insturctorWrappers : courseInfoWrapper.getInstructorWrappers()) { reviewData.getCourseSection().getInstructors().add(insturctorWrappers.getDisplayName()); } reviewData.getCourseSection().getCrossListings().clear(); if (!savedCourseInfo.getCrossListings().isEmpty()) { for (CourseCrossListingInfo crossListingInfo : savedCourseInfo.getCrossListings()) { reviewData.getCourseSection().getCrossListings().add(crossListingInfo.getCode()); } } reviewData.getCourseSection().getJointlyOfferedCourses().clear(); if (!savedCourseInfo.getJoints().isEmpty()) { for (CourseJointInfo jointInfo : savedCourseInfo.getJoints()) { reviewData.getCourseSection().getJointlyOfferedCourses() .add(jointInfo.getSubjectArea() + jointInfo.getCourseNumberSuffix()); } } reviewData.getCourseSection().getVariations().clear(); if (!savedCourseInfo.getVariations().isEmpty()) { for (CourseVariationInfo variationInfo : savedCourseInfo.getVariations()) { if (variationInfo.getVariationCode() == null && variationInfo.getVariationTitle() == null) { reviewData.getCourseSection().getVariations().add(""); } else if (variationInfo.getVariationCode() == null) { reviewData.getCourseSection().getVariations() .add("" + ": " + variationInfo.getVariationTitle()); } else { reviewData.getCourseSection().getVariations() .add(variationInfo.getVariationCode() + ": " + variationInfo.getVariationTitle()); } } } // Update governance section reviewData.getGovernanceSection().getCampusLocations().clear(); reviewData.getGovernanceSection().getCampusLocations() .addAll(updateCampusLocations(savedCourseInfo.getCampusLocations())); reviewData.getGovernanceSection().setCurriculumOversight(buildCurriculumOversightList( savedCourseInfo.getSubjectArea(), savedCourseInfo.getUnitsContentOwner())); reviewData.getGovernanceSection().getAdministeringOrganization().clear(); for (OrganizationInfoWrapper organizationInfoWrapper : courseInfoWrapper.getAdministeringOrganizations()) { if (organizationInfoWrapper.isUserEntered()) { reviewData.getGovernanceSection().getAdministeringOrganization() .add(organizationInfoWrapper.getOrganizationName()); } } // update course logistics section reviewData.getCourseLogisticsSection().getTerms().clear(); try { for (String termType : savedCourseInfo.getTermsOffered()) { TypeInfo term = getTypeService().getType(termType, ContextUtils.createDefaultContextInfo()); reviewData.getCourseLogisticsSection().getTerms().add(term.getName()); } } catch (Exception e) { throw new RiceIllegalStateException(e); } if (savedCourseInfo.getDuration() != null && StringUtils.isNotBlank(savedCourseInfo.getDuration().getAtpDurationTypeKey())) { try { TypeInfo type = getTypeService().getType(savedCourseInfo.getDuration().getAtpDurationTypeKey(), ContextUtils.createDefaultContextInfo()); reviewData.getCourseLogisticsSection().setAtpDurationType(type.getName()); } catch (Exception e) { throw new RiceIllegalStateException(e); } } if (savedCourseInfo.getDuration() != null) { reviewData.getCourseLogisticsSection().setTimeQuantity(savedCourseInfo.getDuration().getTimeQuantity()); } reviewData.getCourseLogisticsSection().setAudit(BooleanUtils.toStringYesNo(courseInfoWrapper.isAudit())); reviewData.getCourseLogisticsSection() .setPassFail(BooleanUtils.toStringYesNo(courseInfoWrapper.isPassFail())); reviewData.getCourseLogisticsSection().setGradingOptions(buildGradingOptionsList()); reviewData.getCourseLogisticsSection().setFinalExamStatus(getFinalExamString()); reviewData.getCourseLogisticsSection() .setFinalExamStatusRationale(courseInfoWrapper.getFinalExamRationale()); reviewData.getCourseLogisticsSection().getOutcomes().clear(); for (ResultValuesGroupInfoWrapper rvg : courseInfoWrapper.getCreditOptionWrappers()) { if (StringUtils.isNotBlank(rvg.getTypeKey())) { String creditOptionType = ""; String creditOptionValue = rvg.getUiHelper().getResultValue(); if (StringUtils.equals(rvg.getTypeKey(), LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_FIXED)) { creditOptionType = "Fixed"; if (StringUtils.contains(rvg.getResultValueRange().getMinValue(), "degree.")) { creditOptionValue = StringUtils.substringAfterLast(rvg.getUiHelper().getResultValue(), "degree."); } else { creditOptionValue = rvg.getUiHelper().getResultValue(); } } else if (StringUtils.equals(rvg.getTypeKey(), LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_MULTIPLE)) { creditOptionType = "Multiple"; } else if (StringUtils.equals(rvg.getTypeKey(), LrcServiceConstants.RESULT_VALUES_GROUP_TYPE_KEY_RANGE)) { creditOptionType = "Range"; } reviewData.getCourseLogisticsSection().getOutcomes() .add(new OutcomeReviewSection(creditOptionType, creditOptionValue)); } } List<FormatInfoWrapper> formatInfoWrappers = new ArrayList<FormatInfoWrapper>(); for (FormatInfo formatInfo : savedCourseInfo.getFormats()) { List<ActivityInfoWrapper> activityInfoWrapperList = new ArrayList<ActivityInfoWrapper>(); for (ActivityInfo activityInfo : formatInfo.getActivities()) { Integer anticipatedClassSize = activityInfo.getDefaultEnrollmentEstimate(); String activityType = activityInfo.getTypeKey(); String contactHours = ""; String durationCount = ""; if (activityInfo.getDuration() != null) { String durationType = null; if (StringUtils.isNotBlank(activityInfo.getDuration().getAtpDurationTypeKey())) { try { TypeInfo duration = getTypeService().getType( activityInfo.getDuration().getAtpDurationTypeKey(), createContextInfo()); durationType = duration.getName(); } catch (Exception e) { throw new RuntimeException(e); } } if (activityInfo.getDuration().getTimeQuantity() != null) { durationCount = activityInfo.getDuration().getTimeQuantity().toString(); } if (StringUtils.isNotBlank(durationType)) { durationCount = durationCount + " " + durationType + CurriculumManagementConstants.COLLECTION_ITEM_PLURAL_END; } } if (activityInfo.getContactHours() != null) { String contactType = activityInfo.getContactHours().getUnitTypeKey(); contactType = StringUtils.substringAfterLast(contactType, "."); if (activityInfo.getContactHours().getUnitQuantity() != null) { contactHours = activityInfo.getContactHours().getUnitQuantity(); } if (StringUtils.isNotBlank(contactType)) { contactHours = contactHours + " per " + StringUtils.lowerCase(contactType); } } ActivityInfoWrapper activityInfoWrapper = new ActivityInfoWrapper(anticipatedClassSize, activityType, durationCount, contactHours); activityInfoWrapperList.add(activityInfoWrapper); } FormatInfoWrapper formatInfoWrapper = new FormatInfoWrapper(activityInfoWrapperList); formatInfoWrappers.add(formatInfoWrapper); } if (!formatInfoWrappers.isEmpty()) { reviewData.getCourseLogisticsSection().setFormatInfoWrappers(formatInfoWrappers); } /** * Active Dates section */ reviewData.getActiveDatesSection() .setStartTerm(getTermDesc(courseInfoWrapper.getCourseInfo().getStartTerm())); reviewData.getActiveDatesSection().setEndTerm(getTermDesc(courseInfoWrapper.getCourseInfo().getEndTerm())); reviewData.getActiveDatesSection() .setPilotCourse(BooleanUtils.toStringYesNo(courseInfoWrapper.getCourseInfo().isPilotCourse())); /** * Financials section */ // reviewData.getFinancialsSection().setFee(); // reviewData.getFinancialsSection().setExpendingOrganization(); // reviewData.getFinancialsSection().setRevenueSource(); if (savedCourseInfo.getFeeJustification() != null) { reviewData.getFinancialsSection() .setJustificationOfFees(savedCourseInfo.getFeeJustification().getPlain()); } /** * Populate 'Proposal' specific model */ if (courseInfoWrapper.isProposalDataUsed()) { updateSupportingDocumentsForReviewPages(courseInfoWrapper); updateProposalDataForReviewPages(reviewData, shouldRepopulateRemoteData); } }
From source file:org.kuali.student.enrollment.class1.krms.view.KSKRMSViewAuthorizer.java
public boolean canPerformAction(View view, ViewModel model, Action action, String actionEvent, String actionId, Person user) {/*w w w . ja v a 2 s .c o m*/ // check action authz flag is set if ((action.getActionSecurity() == null) || !action.getActionSecurity().isPerformActionAuthz()) { return true; } MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) model; CORuleManagementWrapper wrapper = (CORuleManagementWrapper) maintenanceDocumentForm.getDocument() .getNewMaintainableObject().getDataObject(); String ruleType = null; if (wrapper.getRuleEditor() != null) { ruleType = wrapper.getRuleEditor().getRuleTypeInfo().getType(); } else { ruleType = action.getActionParameters().get("ruleType"); } Map<String, String> permissionDetails = new HashMap<String, String>(); Map<String, String> roleQualifications = new HashMap<String, String>(); String socState = StringUtils.lowerCase(wrapper.getContextBar().getTermSocState()); if (!actionEvent.equals(KRMS_COMPARE_ACTION_EVENT)) { roleQualifications.put("offeringAdminOrgId", wrapper.getAdminOrg()); } permissionDetails.put("socState", socState); if (ruleType != null) { permissionDetails.put("ruleType", ruleType); } if (StringUtils.isNotBlank(actionEvent)) { permissionDetails.put(KimConstants.AttributeConstants.ACTION_EVENT, actionEvent); } if (KRMS_SUBMIT_ACTION_EVENT.equals(actionEvent)) { return isAuthorizedToUpdate(wrapper, view, action, model, user, permissionDetails, roleQualifications); } else { return isAuthorizedByTemplate(view, action, model, KimConstants.PermissionTemplateNames.PERFORM_ACTION, user, permissionDetails, roleQualifications, false); } }
From source file:org.kuali.student.enrollment.class1.krms.view.KSKRMSViewAuthorizer.java
public boolean canEditGroup(View view, ViewModel model, Group group, String groupId, Person user) { ComponentSecurity componentSecurity = group.getComponentSecurity(); // check component security exists if (componentSecurity == null) { return true; }/*www . ja v a 2s .co m*/ // check edit group authz flag is set if (componentSecurity.isEditAuthz() == null || !componentSecurity.isEditAuthz().booleanValue()) { return true; } MaintenanceDocumentForm maintenanceDocumentForm = (MaintenanceDocumentForm) model; CORuleManagementWrapper wrapper = (CORuleManagementWrapper) maintenanceDocumentForm.getDocument() .getNewMaintainableObject().getDataObject(); String ruleType = null; if (wrapper.getRuleEditor() != null) { ruleType = wrapper.getRuleEditor().getRuleTypeInfo().getType(); } Map<String, String> additionalPermissionDetails = new HashMap<String, String>(); Map<String, String> roleQualifications = new HashMap<String, String>(); String socState = StringUtils.lowerCase(wrapper.getContextBar().getTermSocState()); roleQualifications.put("offeringAdminOrgId", wrapper.getAdminOrg()); additionalPermissionDetails.put(KimConstants.AttributeConstants.NAMESPACE_CODE, "KS-ENR"); additionalPermissionDetails.put(KimConstants.AttributeConstants.VIEW_ID, model.getViewId()); additionalPermissionDetails.put(KimConstants.AttributeConstants.GROUP_ID, groupId); additionalPermissionDetails.put("socState", socState); if (ruleType != null) { additionalPermissionDetails.put("ruleType", ruleType); } return isAuthorizedByTemplate(view, group, model, KimConstants.PermissionTemplateNames.EDIT_GROUP, user, additionalPermissionDetails, roleQualifications, false); }
From source file:org.kuali.student.r2.core.class1.search.CourseOfferingManagementSearchImpl.java
/** * Builds the Result Row and add it to the resultset. * * @param result data array from a search result row * @param searchSubjectArea/*from www .j a v a2s . c o m*/ * @param searchCourseCode * @param enableCrossListSearch * @param includePassFailAndAuditRecords * @param luiIds2ResultRow * @param luiIds2OrgCells * @param luiIds2AlternateCodes * @param resultInfo */ private void buildSearchResultRow(Object[] result, String searchSubjectArea, String searchCourseCode, boolean enableCrossListSearch, boolean includePassFailAndAuditRecords, Map<String, SearchResultRowInfo> luiIds2ResultRow, Map<String, SearchResultCellInfo> luiIds2OrgCells, Map<String, String> luiIds2AlternateCodes, SearchResultInfo resultInfo) { SearchResultRowInfo row = new SearchResultRowInfo(); int i = 0; String coCode = (String) result[i++]; row.addCell(SearchResultColumns.CODE, coCode); row.addCell(SearchResultColumns.DESC, (String) result[i++]); row.addCell(SearchResultColumns.STATE, (String) result[i++]); row.addCell(SearchResultColumns.CREDIT_OPTION, (String) result[i++]); String graditOption = (String) result[i++]; row.addCell(SearchResultColumns.GRADING_OPTION, graditOption); String courseOfferingId = (String) result[i++]; String division = (String) result[i++]; String luiIdentifierType = (String) result[i++]; boolean isCrossListed = false; if (StringUtils.equals(luiIdentifierType, LuiServiceConstants.LUI_IDENTIFIER_CROSSLISTED_TYPE_KEY)) { isCrossListed = true; } row.addCell(SearchResultColumns.CO_ID, courseOfferingId); row.addCell(SearchResultColumns.SUBJECT_AREA, division); boolean includeCurrentRow = isConsiderSearchResult(searchSubjectArea, searchCourseCode, division); row.addCell(SearchResultColumns.IS_CROSS_LISTED, "" + isCrossListed); //Roll up the org ids (if the org cell exists already then String deploymentOrg = (String) result[i++]; String creditNameForDisplay = StringUtils.stripEnd(StringUtils.lowerCase((String) result[i++]), " credits"); creditNameForDisplay = StringUtils.stripEnd(creditNameForDisplay, " credit"); row.addCell(SearchResultColumns.CREDIT_OPTION_NAME, creditNameForDisplay); String gradingName = (String) result[i++]; row.addCell(SearchResultColumns.GRADING_OPTION_NAME, gradingName); String courseDesc = (String) result[i++]; SearchResultCellInfo defaultPassFailFlag = row.addCell(SearchResultColumns.HAS_STUDENT_SELECTABLE_PASSFAIL, Boolean.FALSE.toString()); SearchResultCellInfo defaultAuditFlag = row.addCell(SearchResultColumns.CAN_AUDIT_COURSE, Boolean.FALSE.toString()); SearchResultCellInfo defaultHonorsFlag = row.addCell(SearchResultColumns.IS_HONORS_COURSE, Boolean.FALSE.toString()); if (includeCurrentRow && includePassFailAndAuditRecords) { String luCodeType = (String) result[i++]; String luCodeValue = (String) result[i++]; boolean continueWithNextRow = processPassFailAndAuditDetails(graditOption, courseOfferingId, isCrossListed, deploymentOrg, defaultPassFailFlag, defaultAuditFlag, luiIds2ResultRow, luiIds2OrgCells, defaultHonorsFlag, luCodeType, luCodeValue); if (continueWithNextRow) { return; } } row.addCell(SearchResultColumns.DESC_FORMATTED, courseDesc); //Rollup all the units deployment as a comma separated string. if (includeCurrentRow && luiIds2OrgCells.containsKey(courseOfferingId)) { //Only do this for the root lui to avoid duplication SearchResultCellInfo orgCell = luiIds2OrgCells.get(courseOfferingId); orgCell.setValue(orgCell.getValue() + "," + deploymentOrg); //Skip processing the rest of this record because multiple orgIDs are rolled up in the query return; } if (includeCurrentRow) { resultInfo.getRows().add(row); //Put the value into the search result row, and save it in the mapping luiIds2OrgCells.put(courseOfferingId, row.addCell(SearchResultColumns.DEPLOYMENT_ORG_ID, deploymentOrg)); if (includePassFailAndAuditRecords) { luiIds2ResultRow.put(courseOfferingId, row); } } if (enableCrossListSearch) { String alternateCodes = luiIds2AlternateCodes.get(courseOfferingId); String currentCode = getAlternateCodeUI(coCode, luiIdentifierType); if (!StringUtils.contains(alternateCodes, currentCode)) { String buildAlternateCodes = StringUtils.defaultString(alternateCodes) + currentCode; luiIds2AlternateCodes.put(courseOfferingId, buildAlternateCodes + ","); } } }
From source file:org.lockss.plugin.royalsocietyofchemistry.RSC2014UrlNormalizer.java
public String normalizeUrl(String url, ArchivalUnit au) throws PluginException { if (content_url.isEmpty()) { content_url = au.getConfiguration().get("base_url") + "en/content/"; resolver_url = au.getConfiguration().get("resolver_url"); }/*from w w w . j av a 2s. c o m*/ if (StringUtil.startsWithIgnoreCase(url, content_url) || StringUtil.startsWithIgnoreCase(url, resolver_url)) { url = StringUtils.lowerCase(url); } return url; }