List of usage examples for org.apache.commons.lang3 StringUtils leftPad
public static String leftPad(final String str, final int size, String padStr)
Left pad a String with a specified String.
Pad to a size of size .
StringUtils.leftPad(null, *, *) = null StringUtils.leftPad("", 3, "z") = "zzz" StringUtils.leftPad("bat", 3, "yz") = "bat" StringUtils.leftPad("bat", 5, "yz") = "yzbat" StringUtils.leftPad("bat", 8, "yz") = "yzyzybat" StringUtils.leftPad("bat", 1, "yz") = "bat" StringUtils.leftPad("bat", -1, "yz") = "bat" StringUtils.leftPad("bat", 5, null) = " bat" StringUtils.leftPad("bat", 5, "") = " bat"
From source file:org.ohdsi.webapi.service.CohortDefinitionService.java
private String formatBitMask(Long n, int size) { return StringUtils.reverse(StringUtils.leftPad(Long.toBinaryString(n), size, "0")); }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendContactInformationAssociation(List<Person> persons, Element rootElement) { for (int i = 0; i < persons.size(); i++) { Element contactInformationAssociation = XmlUtils.appendElement(rootElement, NS_NC_30, "ContactInformationAssociation"); Element contactEntity = XmlUtils.appendElement(contactInformationAssociation, NS_NC_30, "ContactEntity"); Element entityPerson = XmlUtils.appendElement(contactEntity, NS_NC_30, "EntityPerson"); String personId = "Person_" + StringUtils.leftPad(String.valueOf(i + 1), 2, '0'); XmlUtils.addAttribute(entityPerson, NS_STRUCTURES_30, "ref", personId); Element contactInformation = XmlUtils.appendElement(contactInformationAssociation, NS_NC_30, "ContactInformation"); Element contactMailingAddress = XmlUtils.appendElement(contactInformation, NS_NC_30, "ContactMailingAddress"); String addressId = "Address_" + StringUtils.leftPad(String.valueOf(i + 1), 2, '0'); XmlUtils.addAttribute(contactMailingAddress, NS_STRUCTURES_30, "ref", addressId); }// ww w . j a v a 2 s . co m }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendContactInformation(List<Person> persons, Element rootElement) { for (int i = 0; i < persons.size(); i++) { Person person = persons.get(i);/*from ww w. java 2 s . c om*/ Element contactInformation = XmlUtils.appendElement(rootElement, NS_NC_30, "ContactInformation"); Element contactMailingAddress = XmlUtils.appendElement(contactInformation, NS_NC_30, "ContactMailingAddress"); String addressId = "Address_" + StringUtils.leftPad(String.valueOf(i + 1), 2, '0'); XmlUtils.addAttribute(contactMailingAddress, NS_STRUCTURES_30, "id", addressId); Element locationStreet = XmlUtils.appendElement(contactMailingAddress, NS_NC_30, "LocationStreet"); appendTextElement(locationStreet, NS_NC_30, "StreetFullText", person.getAddressStreetFullText()); appendTextElement(locationStreet, NS_NC_30, "StreetNumberText", person.getAddressStreetNumber()); appendTextElement(locationStreet, NS_NC_30, "StreetName", person.getAddressStreetName()); appendTextElement(contactMailingAddress, NS_NC_30, "LocationCityName", person.getAddressCity()); appendTextElement(contactMailingAddress, NS_NC_30, "LocationCountyName", person.getAddressCounty()); appendTextElement(contactMailingAddress, NS_NC_30, "LocationStateName", person.getAddressState()); appendTextElement(contactMailingAddress, NS_NC_30, "LocationPostalCode", person.getAddressZip()); appendTextElement(contactMailingAddress, NS_WARRANT_MOD_REQ_EXT, "AddressCategoryText", "Mail"); } }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendConveyanceRegistrationAssociation(List<Person> persons, Element rootElement) { for (int personIndex = 0, vehicleIndex = 1; personIndex < persons.size(); personIndex++) { List<PersonVehicle> vehicles = persons.get(personIndex).getPersonVehicles(); for (int j = 0; j < vehicles.size(); j++) { Element conveyanceRegistrationAssociation = XmlUtils.appendElement(rootElement, NS_JXDM_51, "ConveyanceRegistrationAssociation"); String registrationId = "Reg_" + StringUtils.leftPad(String.valueOf(vehicleIndex), 2, '0'); Element itemRegistration = XmlUtils.appendElement(conveyanceRegistrationAssociation, NS_JXDM_51, "ItemRegistration"); XmlUtils.addAttribute(itemRegistration, NS_STRUCTURES_30, "ref", registrationId); String vehicleId = "Vehicle_" + StringUtils.leftPad(String.valueOf(vehicleIndex), 2, '0'); Element item = XmlUtils.appendElement(conveyanceRegistrationAssociation, NS_NC_30, "Item"); XmlUtils.addAttribute(item, NS_STRUCTURES_30, "ref", vehicleId); vehicleIndex++;/*from ww w .ja v a 2s . c o m*/ } } }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendConveyanceRegistrations(List<Person> persons, Element rootElement) { for (int personIndex = 0, vehicleIndex = 1; personIndex < persons.size(); personIndex++) { List<PersonVehicle> vehicles = persons.get(personIndex).getPersonVehicles(); for (PersonVehicle vehicle : vehicles) { Element conveyanceRegistration = XmlUtils.appendElement(rootElement, NS_JXDM_51, "ConveyanceRegistration"); String registrationId = "Reg_" + StringUtils.leftPad(String.valueOf(vehicleIndex++), 2, '0'); XmlUtils.addAttribute(conveyanceRegistration, NS_STRUCTURES_30, "id", registrationId); appendVehicleRegistrationExpirationDate(vehicle, conveyanceRegistration); appendTextElement(conveyanceRegistration, NS_JXDM_51, "JurisdictionNCICLISCode", vehicle.getVehicleLicenseStateCode()); appendIdentificationWrapper(conveyanceRegistration, NS_JXDM_51, "ConveyanceRegistrationPlateIdentification", vehicle.getVehicleLicensePlateNumber()); appendTextElement(conveyanceRegistration, NS_JXDM_51, "ConveyanceRegistrationPlateCategoryText", vehicle.getLicensePlateType()); }/*from w w w . j ava 2 s .com*/ } }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendPersonConveyanceAssociation(List<Person> persons, Element rootElement) { for (int personIndex = 0, vehicleIndex = 1; personIndex < persons.size(); personIndex++) { List<PersonVehicle> vehicles = persons.get(personIndex).getPersonVehicles(); for (int j = 0; j < vehicles.size(); j++) { Element personConveyanceAssociation = XmlUtils.appendElement(rootElement, NS_NC_30, "PersonConveyanceAssociation"); Element person = XmlUtils.appendElement(personConveyanceAssociation, NS_NC_30, "Person"); String personId = "Person_" + StringUtils.leftPad(String.valueOf(personIndex + 1), 2, '0'); XmlUtils.addAttribute(person, NS_STRUCTURES_30, "ref", personId); Element conveyance = XmlUtils.appendElement(personConveyanceAssociation, NS_NC_30, "Conveyance"); String vehicleId = "Vehicle_" + StringUtils.leftPad(String.valueOf(vehicleIndex++), 2, '0'); XmlUtils.addAttribute(conveyance, NS_STRUCTURES_30, "ref", vehicleId); }//from w ww . j av a 2 s . c om } }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendVehicleElements(List<Person> persons, Element rootElement) throws Exception { int vehicleIndex = 1; for (int personIndex = 0; personIndex < persons.size(); personIndex++) { List<PersonVehicle> vehicles = persons.get(personIndex).getPersonVehicles(); for (int i = 0; i < vehicles.size(); i++) { PersonVehicle vehicle = vehicles.get(i); Element vehicleElement = XmlUtils.appendElement(rootElement, NS_NC_30, "Vehicle"); String vehicleId = "Vehicle_" + StringUtils.leftPad(String.valueOf(vehicleIndex++), 2, '0'); XmlUtils.addAttribute(vehicleElement, NS_STRUCTURES_30, "id", vehicleId); appendTextElement(vehicleElement, NS_NC_30, "ConveyanceColorPrimaryText", vehicle.getVehiclePrimaryColor()); appendTextElement(vehicleElement, NS_NC_30, "ConveyanceColorSecondaryText", vehicle.getVehicleSecondaryColor()); appendTextElement(vehicleElement, NS_NC_30, "ItemMakeName", vehicle.getVehicleMake()); appendTextElement(vehicleElement, NS_NC_30, "ItemModelName", vehicle.getVehicleModel()); appendTextElement(vehicleElement, NS_NC_30, "ItemModelYearDate", vehicle.getVehicleYear()); appendTextElement(vehicleElement, NS_NC_30, "ItemStyleText", vehicle.getVehicleStyle()); appendIdentificationWrapper(vehicleElement, NS_NC_30, "VehicleIdentification", vehicle.getVehicleIdentificationNumber()); }// w ww . j ava 2 s . c om } }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendPersonElements(List<Person> persons, Element rootElement) { for (int i = 0; i < persons.size(); i++) { Person person = persons.get(i);/*w ww .ja v a 2 s. c o m*/ Element personElement = XmlUtils.appendElement(rootElement, NS_NC_30, "Person"); String personId = "Person_" + StringUtils.leftPad(String.valueOf(i + 1), 2, '0'); XmlUtils.addAttribute(personElement, NS_STRUCTURES_30, "id", personId); appendTextElement(personElement, NS_NC_30, "PersonAgeDescriptionText", person.getPersonAge()); appendPersonBirthLocation(person, personElement); appendTextElement(personElement, NS_NC_30, "PersonCitizenshipText", person.getPersonCitizenshipCountry()); appendTextElement(personElement, NS_NC_30, "PersonEthnicityText", person.getPersonEthnicityDescription()); appendTextElement(personElement, NS_NC_30, "PersonEyeColorText", person.getPersonEyeColorDescription()); appendTextElement(personElement, NS_NC_30, "PersonHairColorText", person.getPersonHairColorDescription()); appendPersonHeightMeasure(person, personElement); appendPersonName(person, personElement); appendPersonPhysicalFeature(person, personElement); appendTextElement(personElement, NS_NC_30, "PersonRaceText", person.getPersonRaceDescription()); appendTextElement(personElement, NS_NC_30, "PersonSexText", person.getPersonSexDescription()); appendTextElement(personElement, NS_NC_30, "PersonSkinToneText", person.getPersonSkinToneDescription()); appendIdentificationWrapper(personElement, NS_NC_30, "PersonSSNIdentification", person.getSocialSecurityNumberBase()); appendIdentificationWrapper(personElement, NS_NC_30, "PersonStateIdentification", person.getPersonStateIdentification()); appendTextElement(personElement, NS_NC_30, "PersonUSCitizenIndicator", BooleanUtils.toStringTrueFalse(person.getUsCitizenshipIndicator())); appendPersonWeightMeasure(person, personElement); appendPersonAugmentation(person, personElement); appendTextElement(personElement, NS_WARRANT_MOD_REQ_EXT, "PersonCautionCodeText", person.getPersonCautionDescription()); appendIdentificationWrapper(personElement, NS_WARRANT_MOD_REQ_EXT, "PersonMiscellaneousRecordIdentification", person.getMiscellaneousIDBase()); appendTextElement(personElement, NS_WARRANT_MOD_REQ_EXT, "PersonImmigrationAlienQueryIndicator", BooleanUtils.toStringTrueFalse(person.getPersonImmigrationAlienQueryIndicator())); } }
From source file:org.ojbc.connectors.warrantmod.InitiateWarrantModificationRequestProcessor.java
private void appendCourtOrderDesignatedSubjects(List<Person> persons, Element warrantElement) { for (int i = 0; i < persons.size(); i++) { Element courtCorderDesignatedSubject = XmlUtils.appendElement(warrantElement, NS_JXDM_51, "CourtOrderDesignatedSubject"); Element roleOfPerson = XmlUtils.appendElement(courtCorderDesignatedSubject, NS_NC_30, "RoleOfPerson"); XmlUtils.addAttribute(roleOfPerson, NS_STRUCTURES_30, "ref", "Person_" + StringUtils.leftPad(String.valueOf(i + 1), 2, '0')); Element subjectCorrectionsIdentification = XmlUtils.appendElement(courtCorderDesignatedSubject, NS_JXDM_51, "SubjectCorrectionsIdentification"); appendIdentificationIdElement(subjectCorrectionsIdentification, persons.get(i).getPrisonRecordNumber()); }/* w ww . j a v a2s. c o m*/ }
From source file:org.opendatakit.aggregate.odktables.Sequencer.java
/** * Generate the next sequence value./* ww w.j a v a 2s . c om*/ * * Use seq1.compareTo(seq2) as the natural ordering of these values. * * @return */ public String getNextSequenceValue() { ++counter; return sequenceBase + "." + StringUtils.leftPad(Integer.toString(counter), DECIMAL_PLACES, '0'); }