Class PartyWorker

java.lang.Object
org.apache.ofbiz.party.party.PartyWorker

public final class PartyWorker extends Object
Worker methods for Party Information
  • Method Details

    • getPartyOtherValues

      public static Map<String,GenericValue> getPartyOtherValues(ServletRequest request, String partyId, String partyAttr, String personAttr, String partyGroupAttr)
    • createClubId

      public static String createClubId(Delegator delegator, String prefix, int length)
      Generate a sequenced club id using the prefix passed and a sequence value + check digit
      Parameters:
      delegator - used to obtain a sequenced value
      prefix - prefix inserted at the beginning of the ID
      length - total length of the ID including prefix and check digit
      Returns:
      Sequenced Club ID string with a length as defined starting with the prefix defined
    • findPartyLatestContactMech

      public static GenericValue findPartyLatestContactMech(String partyId, String contactMechTypeId, Delegator delegator)
    • findPartyLatestPostalAddress

      public static GenericValue findPartyLatestPostalAddress(String partyId, Delegator delegator)
    • findPartyLatestPostalAddressGeoPoint

      public static GenericValue findPartyLatestPostalAddressGeoPoint(String partyId, Delegator delegator)
    • findPartyLatestTelecomNumber

      public static GenericValue findPartyLatestTelecomNumber(String partyId, Delegator delegator)
    • findPartyLatestUserLogin

      public static GenericValue findPartyLatestUserLogin(String partyId, Delegator delegator)
    • findPartyLastLoginTime

      public static Timestamp findPartyLastLoginTime(String partyId, Delegator delegator)
    • findPartyLastLocale

      public static Locale findPartyLastLocale(String partyId, Delegator delegator)
    • findFirstMatchingPartyId

      public static String findFirstMatchingPartyId(Delegator delegator, String address1, String address2, String city, String stateProvinceGeoId, String postalCode, String postalCodeExt, String countryGeoId, String firstName, String middleName, String lastName) throws GeneralException
      Throws:
      GeneralException
    • findFirstMatchingPartyAndContactMechId

      public static String[] findFirstMatchingPartyAndContactMechId(Delegator delegator, String address1, String address2, String city, String stateProvinceGeoId, String postalCode, String postalCodeExt, String countryGeoId, String firstName, String middleName, String lastName) throws GeneralException
      Throws:
      GeneralException
    • findMatchingPersonPostalAddresses

      public static List<GenericValue> findMatchingPersonPostalAddresses(Delegator delegator, String address1, String address2, String city, String stateProvinceGeoId, String postalCode, String postalCodeExt, String countryGeoId, String firstName, String middleName, String lastName) throws GeneralException
      Finds all matching PartyAndPostalAddress records based on the values provided. Excludes party records with a statusId of PARTY_DISABLED. Results are ordered by descending PartyContactMech.fromDate. The matching process is as follows: 1. Calls findMatchingPartyPostalAddress(Delegator, String, String, String, String, String, String, String, String) to retrieve a list of address matched PartyAndPostalAddress records. Results are limited to Parties of type PERSON. 2. For each matching PartyAndPostalAddress record, the Person record for the Party is then retrieved and an upper case comparison is performed against the supplied firstName, lastName and if provided, middleName.
      Parameters:
      delegator - Delegator instance
      address1 - PostalAddress.address1 to match against (Required).
      address2 - Optional PostalAddress.address2 to match against.
      city - PostalAddress.city value to match against (Required).
      stateProvinceGeoId - Optional PostalAddress.stateProvinceGeoId value to match against. If null or "**" is passed then the value will be ignored during matching. "NA" can be passed in place of "_NA_".
      postalCode - PostalAddress.postalCode value to match against. Cannot be null but can be skipped by passing a value starting with an "*". If the length of the supplied string is 10 characters and the string contains a "-" then the postal code will be split at the "-" and the second half will be used as the postalCodeExt.
      postalCodeExt - Optional PostalAddress.postalCodeExt value to match against. Will be overridden if a postalCodeExt value is retrieved from postalCode as described above.
      countryGeoId - Optional PostalAddress.countryGeoId value to match against.
      firstName - Person.firstName to match against (Required).
      middleName - Optional Person.middleName to match against.
      lastName - Person.lastName to match against (Required).
      Returns:
      List of PartyAndPostalAddress GenericValue objects that match the supplied criteria.
      Throws:
      GeneralException
    • findMatchingPartyAndPostalAddress

      @Deprecated public static List<GenericValue> findMatchingPartyAndPostalAddress(Delegator delegator, String address1, String address2, String city, String stateProvinceGeoId, String postalCode, String postalCodeExt, String countryGeoId, String firstName, String middleName, String lastName) throws GeneralException
      Throws:
      GeneralException
    • findMatchingPartyPostalAddress

      public static List<GenericValue> findMatchingPartyPostalAddress(Delegator delegator, String address1, String address2, String city, String stateProvinceGeoId, String postalCode, String postalCodeExt, String countryGeoId, String partyTypeId) throws GenericEntityException
      Finds all matching parties based on the values provided. Excludes party records with a statusId of PARTY_DISABLED. Results are ordered by descending PartyContactMech.fromDate. 1. Candidate addresses are found by querying PartyAndPostalAddress using the supplied city and if provided, stateProvinceGeoId, postalCode, postalCodeExt and countryGeoId 2. In-memory address line comparisons are then performed against the supplied address1 and if provided, address2. Address lines are compared after the strings have been converted using makeMatchingString(Delegator, String).
      Parameters:
      delegator - Delegator instance
      address1 - PostalAddress.address1 to match against (Required).
      address2 - Optional PostalAddress.address2 to match against.
      city - PostalAddress.city value to match against (Required).
      stateProvinceGeoId - Optional PostalAddress.stateProvinceGeoId value to match against. If null or "**" is passed then the value will be ignored during matching. "NA" can be passed in place of "_NA_".
      postalCode - PostalAddress.postalCode value to match against. Cannot be null but can be skipped by passing a value starting with an "*". If the length of the supplied string is 10 characters and the string contains a "-" then the postal code will be split at the "-" and the second half will be used as the postalCodeExt.
      postalCodeExt - Optional PostalAddress.postalCodeExt value to match against. Will be overridden if a postalCodeExt value is retrieved from postalCode as described above.
      countryGeoId - Optional PostalAddress.countryGeoId value to match against.
      partyTypeId - Optional Party.partyTypeId to match against.
      Returns:
      List of PartyAndPostalAddress GenericValue objects that match the supplied criteria.
      Throws:
      GenericEntityException
    • makeMatchingString

      public static String makeMatchingString(Delegator delegator, String address)
      Converts the supplied String into a String suitable for address line matching. Performs the following transformations on the supplied String: - Converts to upper case - Retrieves all records from the AddressMatchMap table and replaces all occurrences of addressMatchMap.mapKey with addressMatchMap.mapValue using upper case matching. - Removes all non-word characters from the String i.e. everything except A-Z, 0-9 and _
      Parameters:
      delegator - A Delegator instance
      address - The address String to convert
      Returns:
      The converted Address
    • getAssociatedPartyIdsByRelationshipType

      public static List<String> getAssociatedPartyIdsByRelationshipType(Delegator delegator, String partyIdFrom, String partyRelationshipTypeId)
    • findPartiesById

      public static List<GenericValue> findPartiesById(Delegator delegator, String idToFind, String partyIdentificationTypeId, boolean searchPartyFirst, boolean searchAllId) throws GenericEntityException
      Generic service to find party by id. By default return the party find by partyId but you can pass searchPartyFirst at false if you want search in partyIdentification before or pass searchAllId at true to find apartyuct with this id (party.partyId and partyIdentification.idValue)
      Parameters:
      delegator - the delegator
      idToFind - the party id to find
      partyIdentificationTypeId - the party identification type id to use
      searchPartyFirst - search first with party id
      searchAllId - search all the party ids
      Returns:
      returns the parties founds
      Throws:
      GenericEntityException
    • findPartiesById

      public static List<GenericValue> findPartiesById(Delegator delegator, String idToFind, String partyIdentificationTypeId) throws GenericEntityException
      Throws:
      GenericEntityException
    • findPartyId

      public static String findPartyId(Delegator delegator, String idToFind, String partyIdentificationTypeId) throws GenericEntityException
      Throws:
      GenericEntityException
    • findPartyId

      public static String findPartyId(Delegator delegator, String idToFind) throws GenericEntityException
      Throws:
      GenericEntityException
    • findParty

      public static GenericValue findParty(Delegator delegator, String idToFind, String partyIdentificationTypeId) throws GenericEntityException
      Throws:
      GenericEntityException
    • findParties

      public static List<GenericValue> findParties(Delegator delegator, String idToFind, String partyIdentificationTypeId) throws GenericEntityException
      Throws:
      GenericEntityException
    • findParties

      public static List<GenericValue> findParties(Delegator delegator, String idToFind) throws GenericEntityException
      Throws:
      GenericEntityException
    • findParty

      public static GenericValue findParty(Delegator delegator, String idToFind) throws GenericEntityException
      Throws:
      GenericEntityException