Java Code Examples for org.apache.commons.lang.StringUtils#equals()
The following examples show how to use
org.apache.commons.lang.StringUtils#equals() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: UsersDao.java From XBDD with Apache License 2.0 | 6 votes |
public User saveUser(final User user) { final MongoCollection<User> users = getUsersColletions(); final Bson query = Filters.eq("user_id", user.getUserId()); final User savedUser = users.find(query).first(); if (savedUser == null) { users.insertOne(user); return user; } if (!StringUtils.equals(savedUser.getDisplay(), user.getDisplay())) { savedUser.setDisplay(user.getDisplay()); users.replaceOne(query, savedUser); } return savedUser; }
Example 2
Source File: RequisitionAction.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
@Override public ActionForward route(ActionMapping mapping, ActionForm form, HttpServletRequest request, HttpServletResponse response) throws Exception { if (shouldWarnIfNoAccountingLines(form)) { String question = request.getParameter(KRADConstants.QUESTION_INST_ATTRIBUTE_NAME); if (StringUtils.equals(question, PurapConstants.REQUISITION_ACCOUNTING_LINES_QUESTION)) { // We're getting an answer from our question String answer = request.getParameter(KRADConstants.QUESTION_CLICKED_BUTTON); // if the answer is "yes"- continue routing, but if it isn't... if (!StringUtils.equals(answer, ConfirmationQuestion.YES)) { // answer is "no, don't continue." so we'll just add a warning and refresh the page LOG.info("add a warning and refresh the page "); GlobalVariables.getMessageMap().putWarning(PurapConstants.ITEM_TAB_ERROR_PROPERTY, PurapConstants.REQ_NO_ACCOUNTING_LINES); return refresh(mapping, form, request, response); } } else { /*We have an empty item and we have a content reviewer. We will now ask the user * if he wants to ignore the empty item (and let the content reviewer take care of it later). */ return this.performQuestionWithoutInput(mapping, form, request, response, PurapConstants.REQUISITION_ACCOUNTING_LINES_QUESTION, PurapConstants.QUESTION_REQUISITON_ROUTE_WITHOUT_ACCOUNTING_LINES, KRADConstants.CONFIRMATION_QUESTION, KFSConstants.ROUTE_METHOD, "1"); } } return super.route(mapping, form, request, response); }
Example 3
Source File: JsonTreeModel.java From nosql4idea with Apache License 2.0 | 6 votes |
public static NoSqlTreeNode findObjectIdNode(NoSqlTreeNode treeNode) { NodeDescriptor descriptor = treeNode.getDescriptor(); if (descriptor instanceof MongoResultDescriptor) { //defensive prog? return null; } if (descriptor instanceof MongoKeyValueDescriptor) { MongoKeyValueDescriptor keyValueDescriptor = (MongoKeyValueDescriptor) descriptor; if (StringUtils.equals(keyValueDescriptor.getKey(), "_id")) { return treeNode; } } NoSqlTreeNode parentTreeNode = (NoSqlTreeNode) treeNode.getParent(); if (parentTreeNode.getDescriptor() instanceof MongoValueDescriptor) { if (((NoSqlTreeNode) parentTreeNode.getParent()).getDescriptor() instanceof MongoResultDescriptor) { //find } } return null; }
Example 4
Source File: Account.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
/** * Gets the postalZipCode attribute. * * @return Returns the postalZipCode. */ @Override public PostalCodeEbo getPostalZipCode() { if ( StringUtils.isBlank(accountZipCode) || StringUtils.isBlank( accountCountryCode ) ) { postalZipCode = null; } else { if ( postalZipCode == null || !StringUtils.equals( postalZipCode.getCode(),accountZipCode) || !StringUtils.equals(postalZipCode.getCountryCode(), accountCountryCode ) ) { ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(PostalCodeEbo.class); if ( moduleService != null ) { Map<String,Object> keys = new HashMap<String, Object>(2); keys.put(LocationConstants.PrimaryKeyConstants.COUNTRY_CODE, accountCountryCode); keys.put(LocationConstants.PrimaryKeyConstants.CODE, accountZipCode); postalZipCode = moduleService.getExternalizableBusinessObject(PostalCodeEbo.class, keys); } else { throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class. Unable to proceed." ); } } } return postalZipCode; }
Example 5
Source File: IBatisNamespaceShardingRule.java From cobarclient with Apache License 2.0 | 6 votes |
public boolean isDefinedAt(IBatisRoutingFact routingFact) { Validate.notNull(routingFact); String namespace = StringUtils.substringBeforeLast(routingFact.getAction(), "."); boolean matches = StringUtils.equals(namespace, getTypePattern()); if (matches) { try { Map<String, Object> vrs = new HashMap<String, Object>(); vrs.putAll(getFunctionMap()); vrs.put("$ROOT", routingFact.getArgument()); // add top object reference for expression VariableResolverFactory vrfactory = new MapVariableResolverFactory(vrs); if (MVEL.evalToBoolean(getAttributePattern(), routingFact.getArgument(), vrfactory)) { return true; } } catch (Throwable t) { logger .info( "failed to evaluate attribute expression:'{}' with context object:'{}'\n{}", new Object[] { getAttributePattern(), routingFact.getArgument(), t }); } } return false; }
Example 6
Source File: EquipmentLoanOrReturnDocument.java From kfs with GNU Affero General Public License v3.0 | 6 votes |
/** * Gets the borrowerCountry attribute. * * @return Returns the borrowerCountry */ public CountryEbo getBorrowerCountry() { if ( StringUtils.isBlank(borrowerCountryCode) ) { borrowerCountry = null; } else { if ( borrowerCountry == null || !StringUtils.equals( borrowerCountry.getCode(),borrowerCountryCode) ) { ModuleService moduleService = SpringContext.getBean(KualiModuleService.class).getResponsibleModuleService(CountryEbo.class); if ( moduleService != null ) { Map<String,Object> keys = new HashMap<String, Object>(1); keys.put(LocationConstants.PrimaryKeyConstants.CODE, borrowerCountryCode); borrowerCountry = moduleService.getExternalizableBusinessObject(CountryEbo.class, keys); } else { throw new RuntimeException( "CONFIGURATION ERROR: No responsible module found for EBO class. Unable to proceed." ); } } } return borrowerCountry; }
Example 7
Source File: VmwareMachineProcess.java From primecloud-controller with GNU General Public License v2.0 | 5 votes |
/** * TODO: メソッドコメントを記述 * * @param vmwareProcessClient * @param instanceNo */ public void changeResource(VmwareProcessClient vmwareProcessClient, Long instanceNo) { Instance instance = instanceDao.read(instanceNo); VmwareInstance vmwareInstance = vmwareInstanceDao.read(instanceNo); // InstanceTypeの取得 PlatformVmwareInstanceType instanceType = null; Platform platform = platformDao.read(instance.getPlatformNo()); if (platform != null && (PCCConstant.PLATFORM_TYPE_VMWARE.equals(platform.getPlatformType()))) { PlatformVmware platformVmware = platformVmwareDao.read(instance.getPlatformNo()); List<PlatformVmwareInstanceType> instanceTypes = platformVmwareInstanceTypeDao .readByPlatformNo(instance.getPlatformNo()); if (platformVmware != null && instanceTypes.isEmpty() == false) { for (PlatformVmwareInstanceType instanceType2 : instanceTypes) { if (StringUtils.equals(vmwareInstance.getInstanceType(), instanceType2.getInstanceTypeName())) { instanceType = instanceType2; break; } } } } if (instanceType == null) { // InstanceTypeが見つからない場合 throw new AutoException("EPROCESS-000512", vmwareInstance.getInstanceType()); } // 仮想マシンのリソースを変更 vmwareProcessClient.changeResourceVM(vmwareInstance.getMachineName(), instanceType.getCpu(), instanceType.getMemory()); }
Example 8
Source File: AuthenticationService.java From api-layer with Eclipse Public License 2.0 | 5 votes |
/** * Method will invalidate jwtToken. It could be called from two reasons: * - on logout phase (distribute = true) * - from another gateway instance to notify about change (distribute = false) * * @param jwtToken token to invalidated * @param distribute distribute invalidation to another instances? * @return state of invalidate (true - token was invalidated) */ @CacheEvict(value = CACHE_VALIDATION_JWT_TOKEN, key = "#jwtToken") @Cacheable(value = CACHE_INVALIDATED_JWT_TOKENS, key = "#jwtToken", condition = "#jwtToken != null") public Boolean invalidateJwtToken(String jwtToken, boolean distribute) { /* * until ehCache is not distributed, send to other instances invalidation request */ if (distribute) { final Application application = discoveryClient.getApplication(CoreService.GATEWAY.getServiceId()); // wrong state, gateway have to exists (at least this current instance), return false like unsuccessful if (application == null) return Boolean.FALSE; final String myInstanceId = discoveryClient.getApplicationInfoManager().getInfo().getInstanceId(); for (final InstanceInfo instanceInfo : application.getInstances()) { if (StringUtils.equals(myInstanceId, instanceInfo.getInstanceId())) continue; final String url = EurekaUtils.getUrl(instanceInfo) + AuthController.CONTROLLER_PATH + "/invalidate/{}"; restTemplate.delete(url, jwtToken); } } // invalidate token in z/OSMF final QueryResponse queryResponse = parseJwtToken(jwtToken); switch (queryResponse.getSource()) { case ZOWE: final String ltpaToken = getLtpaToken(jwtToken); if (ltpaToken != null) zosmfService.invalidate(LTPA, ltpaToken); break; case ZOSMF: zosmfService.invalidate(JWT, jwtToken); break; default: throw new TokenNotValidException("Unknown token type."); } return Boolean.TRUE; }
Example 9
Source File: UserController.java From kylin-on-parquet-v2 with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/{userName:.+}", method = { RequestMethod.PUT }, produces = { "application/json" }) @ResponseBody @PreAuthorize(Constant.ACCESS_HAS_ROLE_ADMIN) //do not use aclEvaluate, if there's no users and will come into init() and will call save. public ManagedUser save(@PathVariable("userName") String userName, @RequestBody ManagedUser user) { checkProfileEditAllowed(); if (StringUtils.equals(getPrincipal(), user.getUsername()) && user.isDisabled()) { throw new ForbiddenException("Action not allowed!"); } checkUserName(userName); user.setUsername(userName); // merge with existing user try { ManagedUser existing = get(userName); if (existing != null) { if (user.getPassword() == null) user.setPassword(existing.getPassword()); if (user.getAuthorities() == null || user.getAuthorities().isEmpty()) user.setGrantedAuthorities(existing.getAuthorities()); } } catch (UsernameNotFoundException ex) { // that is OK, we create new } logger.info("Saving {}", user); completeAuthorities(user); userService.updateUser(user); return get(userName); }
Example 10
Source File: RangerAccessRequestImpl.java From ranger with Apache License 2.0 | 5 votes |
public void extractAndSetClientIPAddress(boolean useForwardedIPAddress, String[]trustedProxyAddresses) { String ip = getRemoteIPAddress(); if (ip == null) { ip = getClientIPAddress(); } String newIp = ip; if (useForwardedIPAddress) { if (LOG.isDebugEnabled()) { LOG.debug("Using X-Forward-For..."); } if (CollectionUtils.isNotEmpty(getForwardedAddresses())) { if (trustedProxyAddresses != null && trustedProxyAddresses.length > 0) { if (StringUtils.isNotEmpty(ip)) { for (String trustedProxyAddress : trustedProxyAddresses) { if (StringUtils.equals(ip, trustedProxyAddress)) { newIp = getForwardedAddresses().get(0); break; } } } } else { newIp = getForwardedAddresses().get(0); } } else { if (LOG.isDebugEnabled()) { LOG.debug("No X-Forwarded-For addresses in the access-request"); } } } if (LOG.isDebugEnabled()) { LOG.debug("Old Remote/Client IP Address=" + ip + ", new IP Address=" + newIp); } setClientIPAddress(newIp); }
Example 11
Source File: TimeBasedBillingPeriod.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
@Override protected boolean canThisBeBilledByBillingFrequency() { if (StringUtils.equals(billingFrequency, ArConstants.ANNUALLY_BILLING_SCHEDULE_CODE) && accountingPeriodService.getByDate(lastBilledDate).getUniversityFiscalYear() >= accountingPeriodService.getByDate(currentDate).getUniversityFiscalYear()) { return false; } else if (StringUtils.equals(findPreviousAccountingPeriod(currentDate).getUniversityFiscalPeriodCode(), findPreviousAccountingPeriod(lastBilledDate).getUniversityFiscalPeriodCode()) && accountingPeriodService.getByDate(lastBilledDate).getUniversityFiscalYear().equals(accountingPeriodService.getByDate(currentDate).getUniversityFiscalYear())) { return false; } return true; }
Example 12
Source File: TravelDocumentPerDiemPrimaryDestinationMatchValidation.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * Loops through any per diem expenses, making sure at that least one matches the primary destination of the document * @see org.kuali.kfs.sys.document.validation.Validation#validate(org.kuali.kfs.sys.document.validation.event.AttributedDocumentEvent) */ @Override public boolean validate(AttributedDocumentEvent event) { final TravelDocument travelDoc = (TravelDocument)event.getDocument(); final Integer primaryDestId = travelDoc.getPrimaryDestinationId(); if (primaryDestId != null) { if (travelDoc.getPerDiemExpenses() != null && !travelDoc.getPerDiemExpenses().isEmpty()) { for (PerDiemExpense perDiemExpense : travelDoc.getPerDiemExpenses()) { if (primaryDestId == TemConstants.CUSTOM_PRIMARY_DESTINATION_ID) { // if the primary destination for the trip is custom, we need to make sure at least one per diem matches all of the name information if (perDiemExpense.getPrimaryDestinationId() == TemConstants.CUSTOM_PRIMARY_DESTINATION_ID && StringUtils.equals(perDiemExpense.getCountryStateText(), travelDoc.getPrimaryDestinationCountryState()) && StringUtils.equals(perDiemExpense.getPrimaryDestination(), travelDoc.getPrimaryDestinationName()) && StringUtils.equals(perDiemExpense.getCounty(), travelDoc.getPrimaryDestinationCounty())) { return true; } } else { // if not custom, then we can just check the primary destination id if (primaryDestId.equals(perDiemExpense.getPrimaryDestinationId())) { return true; // skip out loop - we're fine } } } // still here? then we didn't find a match... GlobalVariables.getMessageMap().putError(KFSPropertyConstants.DOCUMENT+"."+TemPropertyConstants.PER_DIEM_EXPENSES+"[0]."+TemPropertyConstants.PRIMARY_DESTINATION_ID, TemKeyConstants.ERROR_TRAVEL_DOC_PRI_DEST_PER_DIEM_NO_MATCH, travelDoc.getPrimaryDestinationName()); return false; } } return true; }
Example 13
Source File: LedgerEntry.java From kfs with GNU Affero General Public License v3.0 | 5 votes |
/** * Gets the referenceFinancialSystemDocumentTypeCode attribute. * @return Returns the referenceFinancialSystemDocumentTypeCode. */ @Override public DocumentTypeEBO getReferenceFinancialSystemDocumentTypeCode() { if ( referenceFinancialSystemDocumentTypeCode == null || !StringUtils.equals(referenceFinancialSystemDocumentTypeCode.getName(), referenceFinancialDocumentTypeCode) ) { referenceFinancialSystemDocumentTypeCode = null; if ( StringUtils.isNotBlank(referenceFinancialDocumentTypeCode) ) { DocumentType docType = KewApiServiceLocator.getDocumentTypeService().getDocumentTypeByName(referenceFinancialDocumentTypeCode); if ( docType != null ) { referenceFinancialSystemDocumentTypeCode = org.kuali.rice.kew.doctype.bo.DocumentType.from(docType); } } } return referenceFinancialSystemDocumentTypeCode; }
Example 14
Source File: AbstractValidateCodeProcessor.java From paascloud-master with Apache License 2.0 | 5 votes |
/** * Check. * * @param request the request */ @SuppressWarnings("unchecked") @Override public void check(ServletWebRequest request) { ValidateCodeType codeType = getValidateCodeType(); C codeInSession = (C) validateCodeRepository.get(request, codeType); String codeInRequest; try { codeInRequest = ServletRequestUtils.getStringParameter(request.getRequest(), codeType.getParamNameOnValidate()); } catch (ServletRequestBindingException e) { throw new ValidateCodeException("获取验证码的值失败"); } if (StringUtils.isBlank(codeInRequest)) { throw new ValidateCodeException(codeType + "验证码的值不能为空"); } if (codeInSession == null || codeInSession.isExpired()) { validateCodeRepository.remove(request, codeType); throw new ValidateCodeException(codeType + "验证码已过期"); } if (!StringUtils.equals(codeInSession.getCode(), codeInRequest)) { throw new ValidateCodeException(codeType + "验证码不匹配"); } }
Example 15
Source File: UserController.java From kylin with Apache License 2.0 | 5 votes |
@RequestMapping(value = "/{userName:.+}", method = { RequestMethod.GET }, produces = { "application/json" }) @ResponseBody public EnvelopeResponse getUser(@PathVariable("userName") String userName) { if (!this.isAdmin() && !StringUtils.equals(getPrincipal(), userName)) { throw new ForbiddenException("..."); } return new EnvelopeResponse(ResponseCode.CODE_SUCCESS, get(userName), ""); }
Example 16
Source File: EffortCertificationDocumentRules.java From kfs with GNU Affero General Public License v3.0 | 4 votes |
/** * @see org.kuali.kfs.module.ec.document.validation.LoadDetailLineRule#processLoadDetailLineRules(org.kuali.kfs.module.ec.document.EffortCertificationDocument) */ @Override public boolean processLoadDetailLineRules(EffortCertificationDocument effortCertificationDocument) { LOG.debug("processLoadDetailLineRules() start"); boolean isValid = true; String emplid = effortCertificationDocument.getEmplid(); effortCertificationDocument.refreshReferenceObject(EffortPropertyConstants.EFFORT_CERTIFICATION_REPORT_DEFINITION); EffortCertificationReportDefinition reportDefinition = effortCertificationDocument.getEffortCertificationReportDefinition(); if (ObjectUtils.isNull(reportDefinition)) { reportError(EffortConstants.EFFORT_DETAIL_IMPORT_ERRORS, EffortKeyConstants.ERROR_REPORT_DEFINITION_NOT_EXIST); return false; } if (!reportDefinition.isActive()) { reportError(EffortConstants.EFFORT_DETAIL_IMPORT_ERRORS, EffortKeyConstants.ERROR_REPORT_DEFINITION_INACTIVE); return false; } isValid = StringUtils.equals(KFSConstants.PeriodStatusCodes.OPEN, reportDefinition.getEffortCertificationReportPeriodStatusCode()); if (!isValid) { reportError(EffortConstants.EFFORT_DETAIL_IMPORT_ERRORS, EffortKeyConstants.ERROR_REPORT_DEFINITION_PERIOD_NOT_OPENED); return false; } isValid = !effortCertificationReportDefinitionService.hasPendingEffortCertification(emplid, reportDefinition); if (!isValid) { reportError(EffortConstants.EFFORT_DETAIL_IMPORT_ERRORS, EffortKeyConstants.ERROR_PENDING_EFFORT_CERTIFICATION_EXIST); return false; } isValid = effortCertificationReportDefinitionService.hasBeenUsedForEffortCertificationGeneration(reportDefinition); if (!isValid) { reportError(EffortConstants.EFFORT_DETAIL_IMPORT_ERRORS, EffortKeyConstants.ERROR_CREATE_PROCESS_HAS_NOT_BEEN_COMPLETED); return false; } isValid = effortCertificationExtractService.isEmployeeEligibleForEffortCertification(emplid, reportDefinition); if (!isValid) { reportError(EffortConstants.EFFORT_DETAIL_IMPORT_ERRORS, EffortKeyConstants.ERROR_EMPLOYEE_NOT_ELIGIBLE, emplid); return false; } int countOfPendingSalaryExpenseTransfer = laborModuleService.countPendingSalaryExpenseTransfer(emplid); if (countOfPendingSalaryExpenseTransfer > 0) { reportError(EffortConstants.EFFORT_DETAIL_IMPORT_ERRORS, EffortKeyConstants.ERROR_PENDING_SALARAY_EXPENSE_TRANSFER_EXIST, emplid, Integer.toString(countOfPendingSalaryExpenseTransfer)); return false; } return this.populateEffortCertificationDocument(effortCertificationDocument); }
Example 17
Source File: UiDocumentServiceImpl.java From rice with Educational Community License v2.0 | 4 votes |
protected List<PersonDocumentAffiliation> loadAffiliations(List <EntityAffiliation> affiliations, List<EntityEmployment> empInfos) { List<PersonDocumentAffiliation> docAffiliations = new ArrayList<PersonDocumentAffiliation>(); if(ObjectUtils.isNotNull(affiliations)){ for (EntityAffiliation affiliation: affiliations) { if(affiliation.isActive()){ PersonDocumentAffiliation docAffiliation = new PersonDocumentAffiliation(); docAffiliation.setAffiliationTypeCode(affiliation.getAffiliationType().getCode()); docAffiliation.setCampusCode(affiliation.getCampusCode()); docAffiliation.setActive(affiliation.isActive()); docAffiliation.setDflt(affiliation.isDefaultValue()); docAffiliation.setEntityAffiliationId(affiliation.getId()); KradDataServiceLocator.getDataObjectService().wrap(docAffiliation).fetchRelationship("affiliationType"); // EntityAffiliationImpl does not define empinfos as collection docAffiliations.add(docAffiliation); docAffiliation.setEdit(true); // employment informations List<PersonDocumentEmploymentInfo> docEmploymentInformations = new ArrayList<PersonDocumentEmploymentInfo>(); if(ObjectUtils.isNotNull(empInfos)){ for (EntityEmployment empInfo: empInfos) { if (empInfo.isActive() && StringUtils.equals(docAffiliation.getEntityAffiliationId(), (empInfo.getEntityAffiliation() != null ? empInfo.getEntityAffiliation().getId() : null))) { PersonDocumentEmploymentInfo docEmpInfo = new PersonDocumentEmploymentInfo(); docEmpInfo.setEntityEmploymentId(empInfo.getId()); docEmpInfo.setEmployeeId(empInfo.getEmployeeId()); docEmpInfo.setEmploymentRecordId(empInfo.getEmploymentRecordId()); docEmpInfo.setBaseSalaryAmount(empInfo.getBaseSalaryAmount()); docEmpInfo.setPrimaryDepartmentCode(empInfo.getPrimaryDepartmentCode()); docEmpInfo.setEmploymentStatusCode(empInfo.getEmployeeStatus() != null ? empInfo.getEmployeeStatus().getCode() : null); docEmpInfo.setEmploymentTypeCode(empInfo.getEmployeeType() != null ? empInfo.getEmployeeType().getCode() : null); docEmpInfo.setActive(empInfo.isActive()); docEmpInfo.setPrimary(empInfo.isPrimary()); docEmpInfo.setEntityAffiliationId(empInfo.getEntityAffiliation() != null ? empInfo.getEntityAffiliation().getId() : null); // there is no version number on KimEntityEmploymentInformationInfo //docEmpInfo.setVersionNumber(empInfo.getVersionNumber()); docEmpInfo.setEdit(true); KradDataServiceLocator.getDataObjectService().wrap(docEmpInfo).fetchRelationship("employmentType"); docEmploymentInformations.add(docEmpInfo); } } } docAffiliation.setEmpInfos(docEmploymentInformations); } } } return docAffiliations; }
Example 18
Source File: ExpenseImportByTripServiceImpl.java From kfs with GNU Affero General Public License v3.0 | 4 votes |
/** * This method checks whether the accounting lines on the agency staging data record have a match with the source accounting lines on the travel document * * @param agencyDataAccountingLines * @param travelDocumentAccountingLines * @return */ protected boolean isAccountingLinesMatch(AgencyStagingData agencyStagingData) { List<TripAccountingInformation> agencyDataAccountingLines = agencyStagingData.getTripAccountingInformation(); //check that the accounting lines on the agency record have a matching source accounting line on the trip List<TemSourceAccountingLine> tripSourceAccountingLines = getSourceAccountingLinesByTrip(agencyStagingData.getTripId()); // Get ACCOUNTING_LINE_VALIDATION parameter to determine which fields to validate Collection<String> validationParams = getParameterService().getParameterValuesAsString(AgencyDataImportStep.class, TravelParameters.ACCOUNTING_LINE_VALIDATION); if (ObjectUtils.isNull(validationParams)) { LOG.info("Did not find the parameter, "+ TravelParameters.ACCOUNTING_LINE_VALIDATION +". Will not validate matching accounting lines."); return true; } for(TripAccountingInformation agencyAccount : agencyDataAccountingLines) { boolean foundAMatch = false; String documentNumbers = ""; for(TemSourceAccountingLine sourceAccountingLine : tripSourceAccountingLines) { boolean account = true, subaccount = true, objectcode = true, subobjectcode = true; if (validationParams.contains(TemConstants.AgencyStagingDataValidation.VALIDATE_ACCOUNT)) { //need to clean the empty vs null data for comparison in StringUtils.equals String agencyAccountNumber = StringUtils.trimToEmpty(agencyAccount.getTripAccountNumber()); String sourceAccountNumber = StringUtils.trimToEmpty(sourceAccountingLine.getAccountNumber()); if ( !StringUtils.equals(agencyAccountNumber, sourceAccountNumber)) { account = false; } } if (validationParams.contains(TemConstants.AgencyStagingDataValidation.VALIDATE_SUBACCOUNT)) { String agencySubAccountNumber = StringUtils.trimToEmpty(agencyAccount.getTripSubAccountNumber()); String sourceSubAccountNumber = StringUtils.trimToEmpty(sourceAccountingLine.getSubAccountNumber()); if ( !StringUtils.equals(agencySubAccountNumber, sourceSubAccountNumber) ) { subaccount = false; } } if (account && subaccount && objectcode && subobjectcode) { LOG.debug("Found accounting line match on DocumentId: "+ sourceAccountingLine.getDocumentNumber() +", "+ sourceAccountingLine); foundAMatch = true; break; } else { documentNumbers += sourceAccountingLine.getDocumentNumber() +","; } } //the agency data accounting line does not have a matching source account on the trip- return false if (!foundAMatch) { LOG.info("Agency accounting line did not match any document accounting lines: AgencyStgDataId: "+ agencyAccount.getAgencyStagingDataId() +",trpAcctInfoId: "+ agencyAccount.getId() +", documentNumbers:["+ documentNumbers +"]"); return false; } } //all agency data accounting lines have matching source accounts on the trip- return true return true; }
Example 19
Source File: ApplicationManagementServiceImpl.java From carbon-identity-framework with Apache License 2.0 | 2 votes |
private boolean isAppRenamed(String currentAppName, String updatedAppName) { return !StringUtils.equals(currentAppName, updatedAppName); }
Example 20
Source File: CashDrawer.java From kfs with GNU Affero General Public License v3.0 | 2 votes |
/** * This method returns true if the cash drawer is locked. * * @return boolean */ public boolean isLocked() { return StringUtils.equals(KFSConstants.CashDrawerConstants.STATUS_LOCKED, statusCode); }