List of usage examples for org.apache.commons.lang3 StringUtils upperCase
public static String upperCase(final String str)
Converts a String to upper case as per String#toUpperCase() .
A null input String returns null .
StringUtils.upperCase(null) = null StringUtils.upperCase("") = "" StringUtils.upperCase("aBc") = "ABC"
Note: As described in the documentation for String#toUpperCase() , the result of this method is affected by the current locale.
From source file:org.blocks4j.reconf.client.setup.DatabaseManager.java
public boolean isNew(String fullProperty, Method method, String value) { Connection conn = null;// w ww. j av a 2 s. c o m PreparedStatement stmt = null; ResultSet rs = null; try { conn = getConnection(); if (needToInsert(fullProperty, method)) { return true; } stmt = conn.prepareStatement(CHECK_IS_NEW); stmt.setString(1, StringUtils.upperCase(fullProperty)); stmt.setString(2, method.getDeclaringClass().getName()); stmt.setString(3, method.getName()); stmt.setString(4, value); rs = stmt.executeQuery(); return rs.next(); } catch (Exception e) { LoggerHolder.getLog().warn(msg.format("error.db", ("isNew")), e); throw new RuntimeException(e); } finally { close(rs); close(stmt); close(conn); } }
From source file:org.blocks4j.reconf.client.setup.DatabaseManager.java
private boolean needToInsert(String fullProperty, Method method) { Connection conn = null;//from www . jav a2 s .c o m PreparedStatement stmt = null; ResultSet rs = null; try { conn = getConnection(); stmt = conn.prepareStatement("SELECT 1 " + "FROM PUBLIC.CLS_METHOD_PROP_VALUE " + "WHERE FULL_PROP = ? " + "AND NAM_CLASS = ? " + "AND NAM_METHOD = ? "); stmt.setString(1, StringUtils.upperCase(fullProperty)); stmt.setString(2, method.getDeclaringClass().getName()); stmt.setString(3, method.getName()); rs = stmt.executeQuery(); return rs.next() ? false : true; } catch (Exception e) { LoggerHolder.getLog().warn(msg.format("error.db", "needToInsert"), e); throw new RuntimeException(e); } finally { close(rs); close(stmt); close(conn); } }
From source file:org.blocks4j.reconf.client.setup.DatabaseManager.java
private Collection<String> toUpper(Collection<String> arg) { Set<String> result = new LinkedHashSet<String>(); for (String str : arg) { result.add("'" + StringUtils.upperCase(str) + "'"); }/*from w ww . j av a 2s . c om*/ return result; }
From source file:org.cleverbus.core.common.asynch.msg.MessageTransformer.java
/** * Creates message entity.//from w ww . j a v a 2 s.c om * * @param exchange the exchange * @param traceHeader the trace header * @param payload the message payload * @param service the source service * @param operationName the source operation name * @param objectId the object ID * @param entityType the entity type * @param funnelValue the funnel value * @return new message */ @Handler public Message createMessage(Exchange exchange, @Header(value = TraceHeaderProcessor.TRACE_HEADER) TraceHeader traceHeader, @Body String payload, @Header(value = AsynchConstants.SERVICE_HEADER) ServiceExtEnum service, @Header(value = AsynchConstants.OPERATION_HEADER) String operationName, @Header(value = AsynchConstants.OBJECT_ID_HEADER) @Nullable String objectId, @Header(value = AsynchConstants.ENTITY_TYPE_HEADER) @Nullable EntityTypeExtEnum entityType, @Header(value = AsynchConstants.FUNNEL_VALUE_HEADER) @Nullable String funnelValue, @Header(value = AsynchConstants.FUNNEL_VALUES_HEADER) @Nullable List<String> funnelValues, @Header(value = AsynchConstants.GUARANTEED_ORDER_HEADER) @Nullable Boolean guaranteedOrder, @Header(value = AsynchConstants.EXCLUDE_FAILED_HEADER) @Nullable Boolean excludeFailedState) { // validate input params (trace header is validated in TraceHeaderProcessor) Assert.notNull(exchange, "the exchange must not be null"); Assert.notNull(traceHeader, "the traceHeader must not be null"); Assert.notNull(payload, "the payload must not be null"); Assert.notNull(service, "the service must not be null"); Assert.notNull(operationName, "the operationName must not be null"); Date currDate = new Date(); Message msg = new Message(); msg.setState(MsgStateEnum.PROCESSING); msg.setStartProcessTimestamp(currDate); // params from trace header final TraceIdentifier traceId = traceHeader.getTraceIdentifier(); msg.setMsgTimestamp(traceId.getTimestamp().toDate()); msg.setReceiveTimestamp(currDate); msg.setSourceSystem(new ExternalSystemExtEnum() { @Override public String getSystemName() { return StringUtils.upperCase(traceId.getApplicationID()); } }); msg.setCorrelationId(traceId.getCorrelationID()); msg.setProcessId(traceId.getProcessID()); msg.setService(service); msg.setOperationName(operationName); msg.setObjectId(objectId); msg.setEntityType(entityType); //setting funnel value information List<String> funnels = new ArrayList<String>(); if (!StringUtils.isBlank(funnelValue)) { funnels.add(funnelValue); } //settings funnel values if (!CollectionUtils.isEmpty(funnelValues)) { for (String fnlValue : funnelValues) { if (!StringUtils.isBlank(fnlValue)) { funnels.add(fnlValue); } } } if (!funnels.isEmpty()) { msg.setFunnelValues(funnels); } msg.setGuaranteedOrder(BooleanUtils.isTrue(guaranteedOrder)); msg.setExcludeFailedState(BooleanUtils.isTrue(excludeFailedState)); msg.setPayload(payload); msg.setEnvelope(getSOAPEnvelope(exchange)); msg.setLastUpdateTimestamp(currDate); return msg; }
From source file:org.eclipse.ebr.maven.eclipseip.KnownLicenses.java
/** * Determines if the specified license is a known dual license. * * @param license// w ww . j ava 2 s . c o m * @return <code>true</code> if it's a dual license, <code>false</code> * otherwise */ public boolean isDualLicense(final License license) { final String upperCaseLicenseName = StringUtils.upperCase(license.getName()); return StringUtils.containsAny(upperCaseLicenseName, "GPL") && StringUtils.containsAny(upperCaseLicenseName, "CDDL"); }
From source file:org.egov.tl.service.LicenseProcessWorkflowService.java
public List<Assignment> getAssignments(WorkFlowMatrix workFlowMatrix, Boundary boundary) { Department nextAssigneeDept = departmentService.getDepartmentByName(workFlowMatrix.getDepartment()); List<Designation> nextDesignation = designationService.getDesignationsByNames( Arrays.asList(StringUtils.upperCase(workFlowMatrix.getNextDesignation()).split(","))); List<Long> designationIds = new ArrayList<>(); nextDesignation.forEach(designation -> designationIds.add(designation.getId())); List<Assignment> assignmentList = new ArrayList<>(); if (licenseConfigurationService.jurisdictionBasedRoutingEnabled() && boundary != null) assignmentList = assignmentService.getAssignmentsByDepartmentAndDesignationsAndBoundary( nextAssigneeDept.getId(), designationIds, boundary.getId()); if (assignmentList.isEmpty()) assignmentList = getAssignmentsForDeptAndDesignation(nextAssigneeDept, designationIds); return assignmentList; }
From source file:org.egov.tl.service.TradeLicenseService.java
@ReadOnly public List<DemandNoticeForm> getLicenseDemandNotices(final DemandNoticeForm demandNoticeForm) { final Criteria searchCriteria = entityManager.unwrap(Session.class).createCriteria(TradeLicense.class); searchCriteria.createAlias("licensee", "licc").createAlias("category", "cat") .createAlias("tradeName", "subcat").createAlias("status", "licstatus") .createAlias("natureOfBusiness", "nob").createAlias("licenseDemand", "licDemand") .createAlias("licenseAppType", "appType") .add(Restrictions.ne("appType.code", CLOSURE_APPTYPE_CODE)); if (isNotBlank(demandNoticeForm.getLicenseNumber())) searchCriteria.add(Restrictions.eq("licenseNumber", demandNoticeForm.getLicenseNumber()).ignoreCase()); if (isNotBlank(demandNoticeForm.getOldLicenseNumber())) searchCriteria/*from ww w. j av a2s .c om*/ .add(Restrictions.eq("oldLicenseNumber", demandNoticeForm.getOldLicenseNumber()).ignoreCase()); if (demandNoticeForm.getCategoryId() != null) searchCriteria.add(Restrictions.eq("cat.id", demandNoticeForm.getCategoryId())); if (demandNoticeForm.getSubCategoryId() != null) searchCriteria.add(Restrictions.eq("subcat.id", demandNoticeForm.getSubCategoryId())); if (demandNoticeForm.getWardId() != null) searchCriteria.createAlias("parentBoundary", "wards") .add(Restrictions.eq("wards.id", demandNoticeForm.getWardId())); if (demandNoticeForm.getElectionWard() != null) searchCriteria.createAlias("adminWard", "electionWard") .add(Restrictions.eq("electionWard.id", demandNoticeForm.getElectionWard())); if (demandNoticeForm.getLocalityId() != null) searchCriteria.createAlias("boundary", "locality") .add(Restrictions.eq("locality.id", demandNoticeForm.getLocalityId())); if (demandNoticeForm.getStatusId() == null) searchCriteria.add(Restrictions.ne("licstatus.statusCode", StringUtils.upperCase("CAN"))); else searchCriteria.add(Restrictions.eq("status.id", demandNoticeForm.getStatusId())); searchCriteria.add(Restrictions.eq("isActive", true)) .add(Restrictions.eq("nob.name", PERMANENT_NATUREOFBUSINESS)) .add(Restrictions.gtProperty("licDemand.baseDemand", "licDemand.amtCollected")) .addOrder(Order.asc("id")); final List<DemandNoticeForm> finalList = new LinkedList<>(); for (final TradeLicense license : (List<TradeLicense>) searchCriteria.list()) { LicenseDemand licenseDemand = license.getCurrentDemand(); if (licenseDemand != null) { Installment currentInstallment = licenseDemand.getEgInstallmentMaster(); List<Installment> previousInstallment = installmentDao .fetchPreviousInstallmentsInDescendingOrderByModuleAndDate( licenseUtils.getModule(TRADE_LICENSE), currentInstallment.getToDate(), 1); Map<String, Map<String, BigDecimal>> outstandingFees = getOutstandingFeeForDemandNotice(license, currentInstallment, previousInstallment.get(0)); Map<String, BigDecimal> licenseFees = outstandingFees.get(LICENSE_FEE_TYPE); finalList.add(new DemandNoticeForm(license, licenseFees, getOwnerName(license))); } } return finalList; }
From source file:org.finra.herd.dao.helper.EmrHelperTest.java
@Test public void testGetActiveEmrClusterIdAssertParametersCaseIgnored() { EmrDao originalEmrDao = emrHelper.getEmrDao(); EmrDao mockEmrDao = mock(EmrDao.class); emrHelper.setEmrDao(mockEmrDao);/*w ww . j a va2 s.c om*/ try { String emrClusterId = "emrClusterId"; String emrClusterName = "emrClusterName"; String expectedEmrClusterId = "expectedEmrClusterId"; when(mockEmrDao.getEmrClusterById(any(), any())).thenReturn(new Cluster().withId(expectedEmrClusterId) .withName(emrClusterName).withStatus(new ClusterStatus().withState(ClusterState.RUNNING))); assertEquals(expectedEmrClusterId, emrHelper.getActiveEmrClusterId(StringUtils.upperCase(emrClusterId), StringUtils.upperCase(emrClusterName), null)); verify(mockEmrDao).getEmrClusterById(eq(StringUtils.upperCase(emrClusterId)), any()); verifyNoMoreInteractions(mockEmrDao); } finally { emrHelper.setEmrDao(originalEmrDao); } }
From source file:org.gbif.ipt.model.Resource.java
/** * Construct author name for citation. Name must have a last name and at least one first name to be included. If * both the first and last name are left blank on purpose, the organisation name can be used as an alternative. * * @param creator creator/*www. ja v a2s .c o m*/ * * @return author name */ @VisibleForTesting protected String getAuthorName(Agent creator) { StringBuilder sb = new StringBuilder(); String lastName = StringUtils.trimToNull(creator.getLastName()); String firstNames = StringUtils.trimToNull(creator.getFirstName()); String organisation = StringUtils.trimToNull(creator.getOrganisation()); if (lastName != null && firstNames != null) { sb.append(lastName); sb.append(" "); // add first initial of each first name, capitalized String[] names = firstNames.split("\\s+"); for (int i = 0; i < names.length; i++) { sb.append(StringUtils.upperCase(String.valueOf(names[i].charAt(0)))); if (i < names.length - 1) { sb.append(" "); } } } else if (lastName == null && firstNames == null && organisation != null) { sb.append(organisation); } return sb.toString(); }
From source file:org.goko.common.bindings.AbstractController.java
/** * Make sure the getter for the given property exists * @param source the source object/*ww w .j a v a2 s . co m*/ * @param property the property to search for * @return the {@link Method} * @throws GkException GkException */ private Method verifyGetter(Object source, String property) throws GkException { String firstLetter = StringUtils.substring(property, 0, 1); String otherLetters = StringUtils.substring(property, 1); String getGetterName = "^get" + StringUtils.upperCase(firstLetter) + otherLetters + "$"; String isGetterName = "^is" + StringUtils.upperCase(firstLetter) + otherLetters + "$"; Method[] methodArray = source.getClass().getMethods(); for (Method method : methodArray) { //if(StringUtils.equals(getterName, method.getName())){ if (method.getName().matches(getGetterName) || method.getName().matches(isGetterName)) { return method; } } String getterNameDisplay = "get" + StringUtils.upperCase(firstLetter) + otherLetters + "/is" + StringUtils.upperCase(firstLetter) + otherLetters; throw new GkTechnicalException("Cannot find getter (looking for '" + getterNameDisplay + "') for property '" + property + "' on object " + source.getClass() + ". Make sure it's public and correctly spelled"); }