Package org.compiere.model
Class MLocation
java.lang.Object
org.compiere.model.PO
org.compiere.model.X_C_Location
org.compiere.model.MLocation
- All Implemented Interfaces:
Serializable
,Cloneable
,Comparator<Object>
,I_C_Location
,I_Persistent
,Evaluatee
,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 Summary
Modifier and TypeFieldDescriptionstatic String
static String
static String
static String
static final String
Fields inherited from class org.compiere.model.PO
ACCESSLEVEL_ALL, ACCESSLEVEL_CLIENT, ACCESSLEVEL_CLIENTORG, ACCESSLEVEL_ORG, ACCESSLEVEL_SYSTEM, ACCESSLEVEL_SYSTEMCLIENT, ENTITYTYPE_Dictionary, ENTITYTYPE_UserMaintained, I_ZERO, LOCAL_TRX_PREFIX, log, p_ctx, p_info, UUID_NEW_RECORD, XML_ATTRIBUTE_AD_Table_ID, XML_ATTRIBUTE_Record_ID
Fields inherited from interface org.compiere.model.I_C_Location
accessLevel, COLUMNNAME_AD_Client_ID, COLUMNNAME_AD_Org_ID, COLUMNNAME_Address1, COLUMNNAME_Address2, COLUMNNAME_Address3, COLUMNNAME_Address4, COLUMNNAME_Address5, COLUMNNAME_C_AddressValidation_ID, COLUMNNAME_C_City_ID, COLUMNNAME_C_Country_ID, COLUMNNAME_C_Location_ID, COLUMNNAME_C_Location_UU, COLUMNNAME_C_Region_ID, COLUMNNAME_City, COLUMNNAME_Comments, COLUMNNAME_Created, COLUMNNAME_CreatedBy, COLUMNNAME_IsActive, COLUMNNAME_IsValid, COLUMNNAME_Postal, COLUMNNAME_Postal_Add, COLUMNNAME_RegionName, COLUMNNAME_Result, COLUMNNAME_Updated, COLUMNNAME_UpdatedBy, COLUMNNAME_ValidateAddress, Model, Table_ID, Table_Name
-
Constructor Summary
ConstructorDescriptionMLocation
(Properties ctx, int C_Country_ID, int C_Region_ID, String city, String trxName) MLocation
(Properties ctx, int C_Location_ID, String trxName) Standard ConstructorMLocation
(Properties ctx, String C_Location_UU, String trxName) UUID based ConstructorMLocation
(Properties ctx, ResultSet rs, String trxName) Load ConstructorMLocation
(Properties ctx, MLocation copy) Copy constructorMLocation
(Properties ctx, MLocation copy, String trxName) Copy constructorParent ConstructorCopy constructor -
Method Summary
Modifier and TypeMethodDescriptionprotected boolean
afterSave
(boolean newRecord, boolean success) Called after Save for Post-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.protected boolean
beforeSave
(boolean newRecord) Called before Save for Pre-Save Operation.
Default implementation is nop, to be implemented in sub-classes that needed it.boolean
equals
(int C_Country_ID, int C_Region_ID, String Postal, String Postal_Add, String City, String Address1, String Address2) Compares to current recordboolean
Equalsstatic MLocation
get
(int C_Location_ID) Get Location from Cache (immutable)static MLocation
Get Location from Cache (Immutable)static MLocation
get
(Properties ctx, int C_Location_ID, String trxName) Get Location from Cache (immutable)static MLocation
getBPLocation
(Properties ctx, int C_BPartner_Location_ID, String trxName) Load Location via Business Partner Location idGet formatted City Region Postal linestatic MLocation
getCopy
(Properties ctx, int C_Location_ID, String trxName) Get updateable copy of MLocation from cacheGet Country (immutable)getCountry
(boolean local) Get Country NamegetCountry
(boolean local, String language) Get Translated Country NameGet Country NameGet error messagestatic int
getFieldLength
(String columnName) Get formatted address for GoogleMap / IDEMPIERE-147Get RegionGet Region NamegetRegionName
(boolean getFromRegion) Get Region Nameint
hashCode()
boolean
Is Print Address in Reverse Ordermark PO as immutableboolean
processOnline
(int C_AddressValidation_ID) Perform online address validationvoid
setC_Country_ID
(int C_Country_ID) Set C_Country_IDvoid
setC_Region_ID
(int C_Region_ID) Set C_Region_IDvoid
setCountry
(MCountry country) Set Countryvoid
setErrorMessage
(String errorMessage) Set error messagevoid
Set RegiontoString()
Return printable String representationReturn String representation with CR at line endReturn detailed String representationMethods inherited from class org.compiere.model.X_C_Location
get_AccessLevel, getAddress1, getAddress2, getAddress3, getAddress4, getAddress5, getC_AddressValidation, getC_AddressValidation_ID, getC_City, getC_City_ID, getC_Country, getC_Country_ID, getC_Location_ID, getC_Location_UU, getC_Region, getC_Region_ID, getCity, getComments, getKeyNamePair, getPostal, getPostal_Add, getResult, getValidateAddress, initPO, isValid, setAddress1, setAddress2, setAddress3, setAddress4, setAddress5, setC_AddressValidation_ID, setC_City_ID, setC_Location_ID, setC_Location_UU, setCity, setComments, setIsValid, setPostal, setPostal_Add, setRegionName, setResult, setValidateAddress
Methods inherited from class org.compiere.model.PO
afterDelete, beforeDelete, buildInsertSQL, checkImmutable, clearCrossTenantSafe, clone, columnExists, columnExists, compare, copyPO, copyValues, copyValues, createAttachment, delete, delete, delete_Accounting, delete_Tree, deleteEx, deleteEx, dump, dump, get_Attribute, get_Attributes, get_ColumnCount, get_ColumnDescription, get_ColumnDisplayType, get_ColumnIndex, get_ColumnLabel, get_ColumnLookup, get_ColumnName, get_DisplayValue, get_HashMap, get_ID, get_IDOld, get_KeyColumns, get_Logger, get_OptimisticLockingColumns, get_Table_ID, get_TableName, get_Translation, get_Translation, get_Translation, get_Translation, get_Translation, get_TrxName, get_UUID, get_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, get_ValueAsString, get_ValueAsString, get_ValueDifference, get_ValueDifference, get_ValueE, get_ValueOfColumn, get_ValueOld, get_ValueOld, get_ValueOldAsInt, get_WhereClause, get_WhereClause, get_xmlDocument, get_xmlString, getAD_Client_ID, getAD_Org_ID, getAllIDs, getAttachment, getAttachment, getAttachmentData, getCreated, getCreatedBy, getCtx, getDoc, getFindParameter, getPdfAttachment, getUpdated, getUpdatedBy, getUUIDColumnName, getUUIDColumnName, insert_Accounting, insert_Tree, insert_Tree, is_Changed, is_Immutable, is_new, is_UseOptimisticLocking, is_ValueChanged, is_ValueChanged, isActive, isAttachment, isColumnMandatory, isColumnUpdateable, isMandatoryOK, isPdfAttachment, isReplication, load, load, load, load, loadByUU, loadComplete, loadDefaults, loadPO, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, saveCrossTenantSafe, saveCrossTenantSafeEx, saveCrossTenantSafeEx, saveEx, saveEx, saveNew_afterSetID, saveNew_getID, saveNewSpecial, saveReplica, saveUpdate, set_Attribute, set_ColumnUpdateable, set_CustomColumn, set_CustomColumnReturningBoolean, set_OptimisticLockingColumns, set_TrxName, set_TrxName, set_UseOptimisticLocking, set_Value, set_Value, set_Value, set_Value, set_ValueE, set_ValueNoCheck, set_ValueNoCheckE, set_ValueOfColumn, set_ValueOfColumn, set_ValueOfColumnReturningBoolean, set_ValueOfColumnReturningBoolean, setAD_Client_ID, setAD_Org_ID, setClientOrg, setClientOrg, setCrossTenantSafe, setDoc, setDocWorkflowMgr, setIsActive, setProcessedOn, setReplication, setStandardDefaults, setUpdateable, setUpdatedBy, toInsertSQL, unlock, update_Tree, validForeignKeys
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.util.Comparator
compare, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
Methods inherited from interface org.compiere.model.I_C_Location
getAD_Client_ID, getAD_Org_ID, getCreated, getCreatedBy, getUpdated, getUpdatedBy, isActive, setAD_Org_ID, setIsActive
Methods inherited from interface org.compiere.model.I_Persistent
save
-
Field Details
-
LOCATION_MAPS_URL_PREFIX
-
LOCATION_MAPS_ROUTE_PREFIX
-
LOCATION_MAPS_SOURCE_ADDRESS
-
LOCATION_MAPS_DESTINATION_ADDRESS
-
updateBPLocName
- See Also:
-
-
Constructor Details
-
MLocation
UUID based Constructor- Parameters:
ctx
- ContextC_Location_UU
- UUID keytrxName
- Transaction
-
MLocation
Standard Constructor- Parameters:
ctx
- contextC_Location_ID
- idtrxName
- transaction
-
MLocation
Parent Constructor- Parameters:
country
- mandatory countryregion
- optional region
-
MLocation
- Parameters:
ctx
- contextC_Country_ID
- countryC_Region_ID
- regioncity
- citytrxName
- transaction
-
MLocation
Load Constructor- Parameters:
ctx
- contextrs
- result settrxName
- transaction
-
MLocation
Copy constructor- Parameters:
copy
-
-
MLocation
Copy constructor- Parameters:
ctx
-copy
-
-
MLocation
Copy constructor- Parameters:
ctx
-copy
-trxName
-
-
-
Method Details
-
get
Get Location from Cache (Immutable)- Parameters:
C_Location_ID
- idtrxName
- transaction- Returns:
- MLocation
-
get
Get Location from Cache (immutable)- Parameters:
C_Location_ID
- id- Returns:
- MLocation
-
get
Get Location from Cache (immutable)- Parameters:
ctx
- contextC_Location_ID
- idtrxName
- transaction- Returns:
- MLocation
-
getCopy
Get updateable copy of MLocation from cache- Parameters:
ctx
- contextC_Location_ID
-trxName
-- Returns:
- MLocation
-
getBPLocation
Load Location via Business Partner Location id- Parameters:
ctx
- contextC_BPartner_Location_ID
- Business Partner LocationtrxName
- transaction- Returns:
- location or null
-
setCountry
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 interfaceI_C_Location
- Overrides:
setC_Country_ID
in classX_C_Location
- Parameters:
C_Country_ID
- id
-
getCountry
Get Country (immutable)- Returns:
- country
-
getCountryName
Get Country Name- Returns:
- Country Name
-
getCountry
Get Country Name- Parameters:
local
- if true return null for default country- Returns:
- country name or null
-
getCountry
Get Translated Country Name- Parameters:
local
- if true return null for default country- Returns:
- country name or null
-
setRegion
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 interfaceI_C_Location
- Overrides:
setC_Region_ID
in classX_C_Location
- Parameters:
C_Region_ID
- region
-
getRegion
Get Region- Returns:
- region
-
getRegionName
Get Region Name- Specified by:
getRegionName
in interfaceI_C_Location
- Overrides:
getRegionName
in classX_C_Location
- Returns:
- region Name or ""
-
getRegionName
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 ignoredC_Region_ID
- if 0 ignoredPostal
- match postalPostal_Add
- match postal addCity
- match cityAddress1
- match address 1Address2
- match address 2- Returns:
- true if equals
-
equals
Equals- Specified by:
equals
in interfaceComparator<Object>
- Overrides:
equals
in classPO
- Parameters:
cmp
- object to compare- Returns:
- true if ID the same
-
hashCode
public int hashCode() -
isAddressLinesReverse
public boolean isAddressLinesReverse()Is Print Address in Reverse Order- Returns:
- true if reverse depending on country
-
getCityRegionPostal
Get formatted City Region Postal line- Returns:
- City, Region Postal
-
toString
Return printable String representation- Overrides:
toString
in classX_C_Location
- Returns:
- String
-
toStringCR
Return String representation with CR at line end- Returns:
- 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 classPO
- 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. -
getMapsLocation
Get formatted address for GoogleMap / IDEMPIERE-147- Returns:
- formatted address for GoogleMap
-
getFieldLength
- Parameters:
columnName
-- Returns:
- field length for column
-
setErrorMessage
Set error message- Parameters:
errorMessage
-
-
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
Description copied from interface:ImmutablePOSupport
mark PO as immutable- Specified by:
markImmutable
in interfaceImmutablePOSupport
- Returns:
- PO
-