public boolean processSyncModularBusinessRules(Document document) { if (!(document instanceof BudgetDocument)) { return false; } boolean valid = true; BudgetDocument budgetDocument = (BudgetDocument) document; GlobalVariables.getErrorMap().addToErrorPath("document"); List budgetPeriods = budgetDocument.getBudget().getBudgetPeriods(); if (ObjectUtils.isNotNull(budgetPeriods) || budgetPeriods.size() >= 1) { BudgetPeriod period1 = (BudgetPeriod) budgetPeriods.get(0); if (ObjectUtils.isNull(period1.getBudgetLineItems()) || period1.getBudgetLineItems().isEmpty()) { valid = false; } } else { valid = false; } if (!valid) { GlobalVariables.getErrorMap() .putError("modularBudget", KeyConstants.ERROR_NO_DETAILED_BUDGET); } GlobalVariables.getErrorMap().removeFromErrorPath("document"); return valid; }
public boolean isConsideredEntered() { // if all are not null then return true return !((ObjectUtils.isNull(this.getItemReceivedTotalQuantity()) || this.getItemReceivedTotalQuantity().isZero()) && (ObjectUtils.isNull(this.getItemDamagedTotalQuantity()) || this.getItemDamagedTotalQuantity().isZero()) && (ObjectUtils.isNull(this.getItemReturnedTotalQuantity()) || this.getItemReturnedTotalQuantity().isZero())); }
/** * Gets the fieldInfo attribute. * * @return Returns the fieldInfo. */ protected List<Map<String, String>> getFieldInfo(List<EffortCertificationDetail> detailLines) { LOG.info("getFieldInfo(List<EffortCertificationDetail>) start"); List<Map<String, String>> fieldInfo = new ArrayList<Map<String, String>>(); EffortCertificationDocument document = (EffortCertificationDocument) this.getDocument(); KualiDecimal totalOriginalPayrollAmount = document.getTotalOriginalPayrollAmount(); for (EffortCertificationDetail detailLine : detailLines) { detailLine.refreshNonUpdateableReferences(); Map<String, String> fieldInfoForAttribute = new HashMap<String, String>(); fieldInfoForAttribute.put( KFSPropertyConstants.CHART_OF_ACCOUNTS_CODE, detailLine.getChartOfAccounts().getFinChartOfAccountDescription()); String accountInfo = buildAccountInfo(detailLine.getAccount()); fieldInfoForAttribute.put(KFSPropertyConstants.ACCOUNT_NUMBER, accountInfo); SubAccount subAccount = detailLine.getSubAccount(); if (ObjectUtils.isNotNull(subAccount)) { fieldInfoForAttribute.put( KFSPropertyConstants.SUB_ACCOUNT_NUMBER, subAccount.getSubAccountName()); } ObjectCode objectCode = detailLine.getFinancialObject(); if (ObjectUtils.isNotNull(objectCode)) { fieldInfoForAttribute.put( KFSPropertyConstants.FINANCIAL_OBJECT_CODE, objectCode.getFinancialObjectCodeName()); } Account sourceAccount = detailLine.getSourceAccount(); if (ObjectUtils.isNotNull(sourceAccount)) { fieldInfoForAttribute.put( EffortPropertyConstants.SOURCE_ACCOUNT_NUMBER, sourceAccount.getAccountName()); } Chart sourceChart = detailLine.getSourceChartOfAccounts(); if (ObjectUtils.isNotNull(sourceChart)) { fieldInfoForAttribute.put( EffortPropertyConstants.SOURCE_CHART_OF_ACCOUNTS_CODE, sourceChart.getFinChartOfAccountDescription()); } KualiDecimal originalPayrollAmount = detailLine.getEffortCertificationOriginalPayrollAmount(); String actualOriginalPercent = PayrollAmountHolder.recalculateEffortPercentAsString( totalOriginalPayrollAmount, originalPayrollAmount); fieldInfoForAttribute.put( EffortPropertyConstants.EFFORT_CERTIFICATION_CALCULATED_OVERALL_PERCENT, actualOriginalPercent); fieldInfo.add(fieldInfoForAttribute); } return fieldInfo; }
/** * Gets the inquiryUrl attribute. * * @return Returns the inquiryUrl for the detail lines in the document. */ protected List<Map<String, HtmlData>> getDetailLineFieldInquiryUrl( List<EffortCertificationDetail> detailLines) { LOG.info("getDetailLineFieldInquiryUrl(List<EffortCertificationDetail>) start"); Map<String, String> noninquirableFieldValues = this.getNoninquirableFieldValues(); Inquirable inquirable = this.getInquirable(); List<Map<String, HtmlData>> inquiryURL = new ArrayList<Map<String, HtmlData>>(); for (EffortCertificationDetail detailLine : detailLines) { detailLine.refreshNonUpdateableReferences(); Map<String, HtmlData> inquiryURLForAttribute = new HashMap<String, HtmlData>(); for (String attributeName : this.getInquirableFieldNames()) { // exclude the non inquirable field values Object attributeValue = ObjectUtils.getPropertyValue(detailLine, attributeName); String noninquirableFieldValue = noninquirableFieldValues.get(attributeName); if (noninquirableFieldValue != null && noninquirableFieldValue.equals(attributeValue)) { continue; } HtmlData inquiryHref; if (this.getCustomizedInquirableFieldNames().contains(attributeName)) { inquiryHref = this.getCustomizedInquiryUrl(detailLine, attributeName); } else { inquiryHref = inquirable.getInquiryUrl(detailLine, attributeName, false); } inquiryURLForAttribute.put(attributeName, inquiryHref); } inquiryURL.add(inquiryURLForAttribute); } return inquiryURL; }
public UnitOfMeasure getItemUnitOfMeasure() { if (ObjectUtils.isNull(itemUnitOfMeasure) || (!itemUnitOfMeasure .getItemUnitOfMeasureCode() .equalsIgnoreCase(getItemUnitOfMeasureCode()))) { refreshReferenceObject(PurapPropertyConstants.ITEM_UNIT_OF_MEASURE); } return itemUnitOfMeasure; }
public void templateBuilding(Building building) { if (ObjectUtils.isNotNull(building)) { this.setOffCampusIndicator(false); this.setBuildingCode(building.getBuildingCode()); this.setCampusCode(building.getCampusCode()); this.setCapitalAssetLine1Address(building.getBuildingStreetAddress()); this.setCapitalAssetCityName(building.getBuildingAddressCityName()); this.setCapitalAssetStateCode(building.getBuildingAddressStateCode()); this.setCapitalAssetPostalCode(building.getBuildingAddressZipCode()); this.setCapitalAssetCountryCode(building.getBuildingAddressCountryCode()); } }
/** * @see * org.kuali.kfs.sys.document.service.impl.AccountingLineRuleHelperServiceImpl#isValidAccount(org.kuali.kfs.coa.businessobject.Account, * org.kuali.rice.kns.datadictionary.DataDictionary, java.lang.String) */ @Override public boolean isValidAccount( Account account, DataDictionary dataDictionary, String errorPropertyName) { String label = getAccountLabel(); // make sure it exists if (ObjectUtils.isNull(account)) { GlobalVariables.getMessageMap() .putError(errorPropertyName, KFSKeyConstants.ERROR_EXISTENCE, label); return false; } return true; }
/** * @see org.kuali.rice.kns.lookup.LookupResultsService#retrieveResultsTable(java.lang.String, * java.lang.String) */ @Override public List<ResultRow> retrieveResultsTable(String lookupResultsSequenceNumber, String personId) throws Exception { LookupResults lookupResults = retrieveLookupResults(lookupResultsSequenceNumber); if (!isAuthorizedToAccessLookupResults(lookupResults, personId)) { throw new AuthorizationException( personId, "retrieve lookup results", "lookup sequence number " + lookupResultsSequenceNumber); } List<ResultRow> resultTable = (List<ResultRow>) ObjectUtils.fromByteArray( Base64.decodeBase64(lookupResults.getSerializedLookupResults().getBytes())); return resultTable; }
@Override protected boolean processCustomSaveDocumentBusinessRules(Document document) { if (!(document instanceof BudgetDocument)) { return false; } boolean valid = true; BudgetDocument budgetDocument = (BudgetDocument) document; GlobalVariables.getErrorMap().addToErrorPath("document"); getDictionaryValidationService() .validateDocumentAndUpdatableReferencesRecursively( document, getMaxDictionaryValidationDepth(), VALIDATION_REQUIRED, CHOMP_LAST_LETTER_S_FROM_COLLECTION_NAME); GlobalVariables.getErrorMap().addToErrorPath("parentDocument"); if (ObjectUtils.isNull(budgetDocument.getParentDocument())) { budgetDocument.refreshReferenceObject("parentDocument"); } if (Boolean.valueOf(budgetDocument.getParentDocument().getProposalBudgetFlag())) { valid &= processBudgetVersionsBusinessRule(budgetDocument.getParentDocument(), true); } // else { // valid &= processBudgetTypeBusinessRules(budgetDocument); // } GlobalVariables.getErrorMap().removeFromErrorPath("parentDocument"); GlobalVariables.getErrorMap().addToErrorPath("budget"); valid &= processBudgetPersonnelBusinessRules(budgetDocument); valid &= processBudgetExpenseBusinessRules(budgetDocument); valid &= processBudgetPersonnelBudgetBusinessRules(budgetDocument); valid &= processBudgetRatesBusinessRule(budgetDocument); valid &= processBudgetProjectIncomeBusinessRule(budgetDocument); GlobalVariables.getErrorMap().removeFromErrorPath("budget"); GlobalVariables.getErrorMap().removeFromErrorPath("document"); return valid; }
/** * @see org.kuali.rice.kns.lookup.LookupResultsService#persistResultsTable(java.lang.String, * java.util.List, java.lang.String) */ @Override public void persistResultsTable( String lookupResultsSequenceNumber, List<ResultRow> resultTable, String personId) throws Exception { String resultTableString = new String(Base64.encodeBase64(ObjectUtils.toByteArray(resultTable))); Timestamp now = getDateTimeService().getCurrentTimestamp(); LookupResults lookupResults = retrieveLookupResults(lookupResultsSequenceNumber); if (lookupResults == null) { lookupResults = new LookupResults(); lookupResults.setLookupResultsSequenceNumber(lookupResultsSequenceNumber); } lookupResults.setLookupResultsSequenceNumber(lookupResultsSequenceNumber); lookupResults.setLookupPersonId(personId); lookupResults.setSerializedLookupResults(resultTableString); lookupResults.setLookupDate(now); getBusinessObjectService().save(lookupResults); LOG.debug("Wrote resultTable " + resultTable); }
public ActionForward personnel( ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) { BudgetForm budgetForm = (BudgetForm) form; populatePersonnelHierarchySummary(budgetForm); populatePersonnelCategoryTypeCodes(budgetForm); if (budgetForm.getBudgetDocument().getBudget().getBudgetPersons().isEmpty()) { KraServiceLocator.getService(BudgetPersonService.class) .synchBudgetPersonsToProposal(budgetForm.getBudgetDocument().getBudget()); } reconcilePersonnelRoles(budgetForm.getDocument()); BudgetDocument budgetDocument = budgetForm.getBudgetDocument(); Budget budget = budgetDocument.getBudget(); for (BudgetPeriod period : budget.getBudgetPeriods()) { for (BudgetLineItem lineItem : period.getBudgetLineItems()) { for (BudgetPersonnelDetails budgetPersonnelDetails : lineItem.getBudgetPersonnelDetailsList()) { budgetPersonnelDetails.refreshReferenceObject("budgetPerson"); ObjectUtils.materializeObjects( budgetPersonnelDetails.getBudgetPersonnelCalculatedAmounts()); for (BudgetPersonnelCalculatedAmount budgetPersonnelCalculatedAmount : budgetPersonnelDetails.getBudgetPersonnelCalculatedAmounts()) { if (budgetPersonnelCalculatedAmount.getRateClass() == null) { budgetPersonnelCalculatedAmount.refreshReferenceObject("rateClass"); } } } for (BudgetLineItemCalculatedAmount lineItemCalculatedAmount : lineItem.getBudgetLineItemCalculatedAmounts()) { if (lineItemCalculatedAmount.getRateClass() == null) { lineItemCalculatedAmount.refreshReferenceObject("rateClass"); } } } } return mapping.findForward(Constants.BUDGET_PERSONNEL_PAGE); }
/** @see org.kuali.ext.mm.b2b.cxml.invoice.B2bInvoice#validate() */ @Override public B2bInvoiceStatus validate() { B2bInvoiceStatus invoiceStatus = validateCommon(); if (!invoiceStatus.isValid()) { return invoiceStatus; } MMDecimal invoiceSum = MMDecimal.ZERO; for (B2bInvoiceDetail detail : getDetails()) { invoiceSum = invoiceSum.add(detail.getNetAmount()); if (detail.getAccounts().isEmpty()) { return new B2bInvoiceStatus( false, "406", "Not Acceptable", "Accounting distribution is missing for item : " + detail.getSupplierPartId()); } for (B2bInvoiceAccount acct : detail.getAccounts()) { if (ObjectUtils.isNull(acct.matchingAccount())) { return new B2bInvoiceStatus( false, "417", "Expectation failed.", "AccountingSegment Id: [" + acct.getId() + "] is not valid."); } } } if (!getDueAmount().equals(invoiceSum)) { return new B2bInvoiceStatus( false, "417", "Expectation failed.", "Sum of Invoice Detail Amount :" + invoiceSum + " didnt match total Due Amount:" + getDueAmount().toString()); } return invoiceStatus; }
/** * build the descriptive information of the given account. The information includes account name * and project director's name if any * * @param chartOfAccountsCode the given chart of accounts code * @param accountNumber the given account number * @return the descriptive information of the given account */ public static String buildAccountInfo(Account account) { if (ObjectUtils.isNull(account)) { return KFSConstants.EMPTY_STRING; } String projectDirectorName = KFSConstants.EMPTY_STRING; try { ContractsAndGrantsModuleService contractsAndGrantsModuleService = SpringContext.getBean(ContractsAndGrantsModuleService.class); Person projectDirector = contractsAndGrantsModuleService.getProjectDirectorForAccount(account); projectDirectorName = projectDirector != null ? MessageFormat.format(" ({0})", projectDirector.getName()) : KFSConstants.EMPTY_STRING; } catch (Exception e) { LOG.error("Cannot find a project director for the account:" + account); } return MessageFormat.format("{0}{1}", account.getAccountName(), projectDirectorName); }
/** * Validate budget rates. Applicable rates are mandatory * * @param budgetDocument * @return */ protected boolean processBudgetRatesBusinessRule(BudgetDocument budgetDocument) { boolean valid = true; final int APPLICABLE_RATE_LENGTH_EXCEEDED = 1; final int APPLICABLE_RATE_NEGATIVE = -1; ErrorMap errorMap = GlobalVariables.getErrorMap(); int i = 0; for (BudgetRate budgetRate : budgetDocument.getBudget().getBudgetRates()) { String rateClassType = budgetRate.getRateClass().getRateClassTypeT().getDescription(); String errorPath = "budgetProposalRate[" + rateClassType + "][" + i + "]"; errorMap.addToErrorPath(errorPath); /* look for applicable rate */ if (budgetRate.isApplicableRateNull()) { valid = false; errorMap.putError("applicableRate", KeyConstants.ERROR_REQUIRED_APPLICABLE_RATE); } else if (!BudgetDecimal.isNumeric(budgetRate.getApplicableRate().toString())) { valid = false; errorMap.putError("applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_NOT_NUMERIC); } else { switch (verifyApplicableRate(budgetRate.getApplicableRate())) { case APPLICABLE_RATE_LENGTH_EXCEEDED: valid = false; errorMap.putError( "applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_LIMIT, Constants.APPLICABLE_RATE_LIMIT); break; case APPLICABLE_RATE_NEGATIVE: valid = false; errorMap.putError("applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_NEGATIVE); break; } } errorMap.removeFromErrorPath(errorPath); i++; } i = 0; for (BudgetLaRate budgetLaRate : budgetDocument.getBudget().getBudgetLaRates()) { String rateClassType = ""; if (ObjectUtils.isNotNull(budgetLaRate.getRateClass()) && ObjectUtils.isNotNull(budgetLaRate.getRateClass().getRateClassTypeT())) { rateClassType = budgetLaRate.getRateClass().getRateClassTypeT().getDescription(); } String errorPath = "budgetRate[" + rateClassType + "][" + i + "]"; errorMap.addToErrorPath(errorPath); /* look for applicable rate */ if (budgetLaRate.isApplicableRateNull()) { valid = false; errorMap.putError("applicableRate", KeyConstants.ERROR_REQUIRED_APPLICABLE_RATE); } else if (!BudgetDecimal.isNumeric(budgetLaRate.getApplicableRate().toString())) { valid = false; errorMap.putError("applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_NOT_NUMERIC); } else { switch (verifyApplicableRate(budgetLaRate.getApplicableRate())) { case APPLICABLE_RATE_LENGTH_EXCEEDED: valid = false; errorMap.putError( "applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_LIMIT, Constants.APPLICABLE_RATE_LIMIT); break; case APPLICABLE_RATE_NEGATIVE: valid = false; errorMap.putError("applicableRate", KeyConstants.ERROR_APPLICABLE_RATE_NEGATIVE); break; } } errorMap.removeFromErrorPath(errorPath); i++; } return valid; }
/** * @see * org.kuali.kfs.sys.businessobject.inquiry.KfsInquirableImpl#getInquiryUrl(org.kuali.rice.kns.bo.BusinessObject, * java.lang.String, boolean) */ @Override public HtmlData getInquiryUrl( BusinessObject businessObject, String attributeName, boolean forceInquiry) { KEMIDHistoricalReportingGroup historicalReportingGroup = (KEMIDHistoricalReportingGroup) businessObject; if (EndowPropertyConstants.KEMID_CRNT_REP_GRP_UNITS.equals(attributeName) && ObjectUtils.isNotNull(historicalReportingGroup.getUnits())) { Properties params = new Properties(); params.put(KFSConstants.DISPATCH_REQUEST_PARAMETER, KFSConstants.SEARCH_METHOD); params.put( KFSConstants.BUSINESS_OBJECT_CLASS_ATTRIBUTE, KEMIDHistoricalTaxLot.class.getName()); params.put(KNSConstants.DOC_FORM_KEY, "88888888"); params.put(KFSConstants.HIDE_LOOKUP_RETURN_LINK, "true"); params.put( KFSConstants.BACK_LOCATION, SpringContext.getBean(KualiConfigurationService.class) .getPropertyString(KNSConstants.APPLICATION_URL_KEY) + "/" + KFSConstants.MAPPING_PORTAL + ".do"); params.put( KFSConstants.LOOKUP_READ_ONLY_FIELDS, EndowPropertyConstants.KEMID + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_PURPOSE_CD + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_REP_GRP + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_IP_IND + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_SECURITY_ID + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_CD + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_BALANCE_DATE + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_CLOSED_IND + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_DESC + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_SEC_DESC + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_SHORT_TTL + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_PURPOSE_DESC + "," + EndowPropertyConstants.KEMID_HIST_TAX_LOT_INC_PRIN_DESC + "," + EndowPropertyConstants.MONTH_END_DATE_ID); params.put( EndowPropertyConstants.KEMID, UrlFactory.encode(String.valueOf(historicalReportingGroup.getKemid()))); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_PURPOSE_CD, UrlFactory.encode(historicalReportingGroup.getKemidObj().getPurposeCode())); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_REP_GRP, UrlFactory.encode(historicalReportingGroup.getReportingGroupCode())); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_IP_IND, UrlFactory.encode(historicalReportingGroup.getIpIndicator())); params.put( EndowPropertyConstants.KEMID_HIST_REP_GRP_SEC_ID, UrlFactory.encode(historicalReportingGroup.getSecurityId())); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_CD, UrlFactory.encode(historicalReportingGroup.getRegistrationCode())); params.put( EndowPropertyConstants.MONTH_END_DATE_ID, UrlFactory.encode(String.valueOf(historicalReportingGroup.getHistoryBalanceDateId()))); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_CLOSED_IND, historicalReportingGroup.getKemidObj().isClose() ? "Yes" : "No"); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_DESC, historicalReportingGroup.getRegistration().getName()); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_SEC_DESC, historicalReportingGroup.getSecurity().getDescription()); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_SHORT_TTL, historicalReportingGroup.getKemidObj().getShortTitle()); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_PURPOSE_DESC, historicalReportingGroup.getKemidObj().getPurpose().getName()); params.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_INC_PRIN_DESC, historicalReportingGroup.getIncomePrincipalIndicator().getName()); String url = UrlFactory.parameterizeUrl(KNSConstants.LOOKUP_ACTION, params); Map<String, String> fieldList = new HashMap<String, String>(); fieldList.put(EndowPropertyConstants.KEMID, historicalReportingGroup.getKemid().toString()); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_PURPOSE_CD, historicalReportingGroup.getKemidObj().getPurposeCode()); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_REP_GRP, historicalReportingGroup.getReportingGroupCode()); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_IP_IND, historicalReportingGroup.getIpIndicator()); fieldList.put( EndowPropertyConstants.KEMID_HIST_REP_GRP_SEC_ID, historicalReportingGroup.getSecurityId()); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_CD, historicalReportingGroup.getRegistrationCode()); fieldList.put( EndowPropertyConstants.MONTH_END_DATE_ID, String.valueOf(historicalReportingGroup.getHistoryBalanceDateId())); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_CLOSED_IND, historicalReportingGroup.getKemidObj().isClose() ? "Yes" : "No"); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_REGIS_DESC, historicalReportingGroup.getRegistration().getName()); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_SEC_DESC, historicalReportingGroup.getSecurity().getDescription()); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_KEMID_SHORT_TTL, historicalReportingGroup.getKemidObj().getShortTitle()); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_PURPOSE_DESC, historicalReportingGroup.getKemidObj().getPurpose().getName()); fieldList.put( EndowPropertyConstants.KEMID_HIST_TAX_LOT_INC_PRIN_DESC, historicalReportingGroup.getIncomePrincipalIndicator().getName()); return getHyperLink(KEMIDHistoricalTaxLot.class, fieldList, url); } return super.getInquiryUrl(businessObject, attributeName, forceInquiry); }
/** * Validates a definition assignment to the principal * * @param principalDefinition SecurityPrincipalDefinition to validate * @param errorKeyPrefix String errorPrefix to use if any errors are found * @return boolean true if validation was successful, false if there are errors */ protected boolean validatePrincipalDefinition( SecurityPrincipalDefinition principalDefinition, String errorKeyPrefix) { boolean isValid = true; principalDefinition.refreshNonUpdateableReferences(); if (ObjectUtils.isNull(principalDefinition.getSecurityDefinition())) { return false; } String attributeName = principalDefinition.getSecurityDefinition().getSecurityAttribute().getName(); String attributeValue = principalDefinition.getAttributeValue(); // if value is blank (which is allowed) no need to validate if (StringUtils.isBlank(attributeValue)) { return true; } // descend attributes do not allow multiple values or wildcards, and operator must be equal if (SecConstants.SecurityAttributeNames.CHART_DESCEND_HIERARCHY.equals(attributeName) || SecConstants.SecurityAttributeNames.ORGANIZATION_DESCEND_HIERARCHY.equals( attributeName)) { if (StringUtils.contains( attributeValue, SecConstants.SecurityValueSpecialCharacters.MULTI_VALUE_SEPERATION_CHARACTER)) { GlobalVariables.getMessageMap() .putError( errorKeyPrefix + SecPropertyConstants.ATTRIBUTE_VALUE, SecKeyConstants.ERROR_MODEL_DEFINITION_MULTI_ATTR_VALUE, attributeName); isValid = false; } if (StringUtils.contains( attributeValue, SecConstants.SecurityValueSpecialCharacters.WILDCARD_CHARACTER)) { GlobalVariables.getMessageMap() .putError( errorKeyPrefix + SecPropertyConstants.ATTRIBUTE_VALUE, SecKeyConstants.ERROR_MODEL_DEFINITION_WILDCARD_ATTR_VALUE, attributeName); isValid = false; } if (!SecConstants.SecurityDefinitionOperatorCodes.EQUAL.equals( principalDefinition.getOperatorCode())) { GlobalVariables.getMessageMap() .putError( errorKeyPrefix + SecPropertyConstants.OPERATOR_CODE, SecKeyConstants.ERROR_MODEL_DEFINITION_OPERATOR_CODE_NOT_EQUAL, attributeName); isValid = false; } } // validate attribute value for existence isValid = isValid && SecurityValidationUtil.validateAttributeValue( attributeName, attributeValue, errorKeyPrefix); return isValid; }
/** * Gets the itemType attribute. * * @return Returns the itemType. */ public ItemType getItemType() { if (ObjectUtils.isNull(itemType)) { refreshReferenceObject(PurapPropertyConstants.ITEM_TYPE); } return itemType; }