Class MLocation

All Implemented Interfaces:
Serializable, Cloneable, Comparator<Object>, I_C_Location, I_Persistent, Evaluatee, ImmutablePOSupport

public class MLocation extends X_C_Location implements Comparator<Object>, ImmutablePOSupport
Location (Address)
Version:
$Id: MLocation.java,v 1.3 2006/07/30 00:54:54 jjanke Exp $
Author:
Jorg Janke, Michael Judd (Akuna Ltd)
  • BF [ 2695078 ] Country is not translated on invoice
  • FR [2794312 ] Location AutoComplete - check if allow cities out of list, Teo Sarca, teo.sarca@gmail.com
  • BF [ 3002736 ] MLocation.get cache all MLocations https://sourceforge.net/p/adempiere/bugs/2404/
  • See Also:
    • Field Details

      • LOCATION_MAPS_URL_PREFIX

        public static String LOCATION_MAPS_URL_PREFIX
      • LOCATION_MAPS_ROUTE_PREFIX

        public static String LOCATION_MAPS_ROUTE_PREFIX
      • LOCATION_MAPS_SOURCE_ADDRESS

        public static String LOCATION_MAPS_SOURCE_ADDRESS
      • LOCATION_MAPS_DESTINATION_ADDRESS

        public static String LOCATION_MAPS_DESTINATION_ADDRESS
      • updateBPLocName

        public static final String updateBPLocName
        See Also:
    • Constructor Details

      • MLocation

        public MLocation(Properties ctx, String C_Location_UU, String trxName)
        UUID based Constructor
        Parameters:
        ctx - Context
        C_Location_UU - UUID key
        trxName - Transaction
      • MLocation

        public MLocation(Properties ctx, int C_Location_ID, String trxName)
        Standard Constructor
        Parameters:
        ctx - context
        C_Location_ID - id
        trxName - transaction
      • MLocation

        public MLocation(MCountry country, MRegion region)
        Parent Constructor
        Parameters:
        country - mandatory country
        region - optional region
      • MLocation

        public MLocation(Properties ctx, int C_Country_ID, int C_Region_ID, String city, String trxName)
        Parameters:
        ctx - context
        C_Country_ID - country
        C_Region_ID - region
        city - city
        trxName - transaction
      • MLocation

        public MLocation(Properties ctx, ResultSet rs, String trxName)
        Load Constructor
        Parameters:
        ctx - context
        rs - result set
        trxName - transaction
      • MLocation

        public MLocation(MLocation copy)
        Copy constructor
        Parameters:
        copy -
      • MLocation

        public MLocation(Properties ctx, MLocation copy)
        Copy constructor
        Parameters:
        ctx -
        copy -
      • MLocation

        public MLocation(Properties ctx, MLocation copy, String trxName)
        Copy constructor
        Parameters:
        ctx -
        copy -
        trxName -
    • Method Details

      • get

        public static MLocation get(int C_Location_ID, String trxName)
        Get Location from Cache (Immutable)
        Parameters:
        C_Location_ID - id
        trxName - transaction
        Returns:
        MLocation
      • get

        public static MLocation get(int C_Location_ID)
        Get Location from Cache (immutable)
        Parameters:
        C_Location_ID - id
        Returns:
        MLocation
      • get

        public static MLocation get(Properties ctx, int C_Location_ID, String trxName)
        Get Location from Cache (immutable)
        Parameters:
        ctx - context
        C_Location_ID - id
        trxName - transaction
        Returns:
        MLocation
      • getCopy

        public static MLocation getCopy(Properties ctx, int C_Location_ID, String trxName)
        Get updateable copy of MLocation from cache
        Parameters:
        ctx - context
        C_Location_ID -
        trxName -
        Returns:
        MLocation
      • getBPLocation

        public static MLocation getBPLocation(Properties ctx, int C_BPartner_Location_ID, String trxName)
        Load Location via Business Partner Location id
        Parameters:
        ctx - context
        C_BPartner_Location_ID - Business Partner Location
        trxName - transaction
        Returns:
        location or null
      • setCountry

        public void setCountry(MCountry country)
        Set Country
        Parameters:
        country -
      • setC_Country_ID

        public void setC_Country_ID(int C_Country_ID)
        Set C_Country_ID
        Specified by:
        setC_Country_ID in interface I_C_Location
        Overrides:
        setC_Country_ID in class X_C_Location
        Parameters:
        C_Country_ID - id
      • getCountry

        public MCountry getCountry()
        Get Country (immutable)
        Returns:
        country
      • getCountryName

        public String getCountryName()
        Get Country Name
        Returns:
        Country Name
      • getCountry

        public String getCountry(boolean local)
        Get Country Name
        Parameters:
        local - if true return null for default country
        Returns:
        country name or null
      • getCountry

        public String getCountry(boolean local, String language)
        Get Translated Country Name
        Parameters:
        local - if true return null for default country
        Returns:
        country name or null
      • setRegion

        public void setRegion(MRegion region)
        Set Region
        Parameters:
        region -
      • setC_Region_ID

        public void setC_Region_ID(int C_Region_ID)
        Set C_Region_ID
        Specified by:
        setC_Region_ID in interface I_C_Location
        Overrides:
        setC_Region_ID in class X_C_Location
        Parameters:
        C_Region_ID - region
      • getRegion

        public MRegion getRegion()
        Get Region
        Returns:
        region
      • getRegionName

        public String getRegionName()
        Get Region Name
        Specified by:
        getRegionName in interface I_C_Location
        Overrides:
        getRegionName in class X_C_Location
        Returns:
        region Name or ""
      • getRegionName

        public String getRegionName(boolean getFromRegion)
        Get Region Name
        Parameters:
        getFromRegion - true to get from region (C_Region)
        Returns:
        region Name or ""
      • equals

        public boolean equals(int C_Country_ID, int C_Region_ID, String Postal, String Postal_Add, String City, String Address1, String Address2)
        Compares to current record
        Parameters:
        C_Country_ID - if 0 ignored
        C_Region_ID - if 0 ignored
        Postal - match postal
        Postal_Add - match postal add
        City - match city
        Address1 - match address 1
        Address2 - match address 2
        Returns:
        true if equals
      • equals

        public boolean equals(Object cmp)
        Equals
        Specified by:
        equals in interface Comparator<Object>
        Overrides:
        equals in class PO
        Parameters:
        cmp - object to compare
        Returns:
        true if ID the same
      • hashCode

        public int hashCode()
        Overrides:
        hashCode in class PO
      • isAddressLinesReverse

        public boolean isAddressLinesReverse()
        Is Print Address in Reverse Order
        Returns:
        true if reverse depending on country
      • getCityRegionPostal

        public String getCityRegionPostal()
        Get formatted City Region Postal line
        Returns:
        City, Region Postal
      • toString

        public String toString()
        Return printable String representation
        Overrides:
        toString in class X_C_Location
        Returns:
        String
      • toStringCR

        public String toStringCR()
        Return String representation with CR at line end
        Returns:
        String
      • toStringX

        public String toStringX()
        Return detailed String representation
        Returns:
        String
      • beforeSave

        protected boolean beforeSave(boolean newRecord)
        Description copied from class: PO
        Called before Save for Pre-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        beforeSave in class PO
        Parameters:
        newRecord - true if it is a new record
        Returns:
        true if record can be saved
      • afterSave

        protected boolean afterSave(boolean newRecord, boolean success)
        Description copied from class: PO
        Called after Save for Post-Save Operation.
        Default implementation is nop, to be implemented in sub-classes that needed it.
        Overrides:
        afterSave in class PO
        Parameters:
        newRecord - true if it is a new record
        success - true if save operation was success
        Returns:
        if save was a success
      • getMapsLocation

        public String getMapsLocation()
        Get formatted address for GoogleMap / IDEMPIERE-147
        Returns:
        formatted address for GoogleMap
      • getFieldLength

        public static int getFieldLength(String columnName)
        Parameters:
        columnName -
        Returns:
        field length for column
      • setErrorMessage

        public void setErrorMessage(String errorMessage)
        Set error message
        Parameters:
        errorMessage -
      • getErrorMessage

        public String getErrorMessage()
        Get error message
        Returns:
        error message
      • processOnline

        public boolean processOnline(int C_AddressValidation_ID)
        Perform online address validation
        Parameters:
        C_AddressValidation_ID -
        Returns:
        true if valid
      • markImmutable

        public MLocation markImmutable()
        Description copied from interface: ImmutablePOSupport
        mark PO as immutable
        Specified by:
        markImmutable in interface ImmutablePOSupport
        Returns:
        PO