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
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:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description static StringLOCATION_MAPS_DESTINATION_ADDRESSstatic StringLOCATION_MAPS_ROUTE_PREFIXstatic StringLOCATION_MAPS_SOURCE_ADDRESSstatic StringLOCATION_MAPS_URL_PREFIXstatic StringupdateBPLocName-
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, 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
Constructors Constructor Description MLocation(Properties ctx, int C_Country_ID, int C_Region_ID, String city, String trxName)Full ConstructorMLocation(Properties ctx, int C_Location_ID, String trxName)Standard ConstructorMLocation(Properties ctx, ResultSet rs, String trxName)Load ConstructorMLocation(Properties ctx, MLocation copy)MLocation(Properties ctx, MLocation copy, String trxName)MLocation(MCountry country, MRegion region)Parent ConstructorMLocation(MLocation copy)
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description protected booleanafterSave(boolean newRecord, boolean success)After Saveprotected booleanbeforeSave(boolean newRecord)Before Savebooleanequals(int C_Country_ID, int C_Region_ID, String Postal, String Postal_Add, String City, String Address1, String Address2)Compares to current recordbooleanequals(Object cmp)Equalsstatic MLocationget(int C_Location_ID)Get Location from Cache (immutable)static MLocationget(int C_Location_ID, String trxName)Get Location from Cachestatic MLocationget(Properties ctx, int C_Location_ID, String trxName)Get Location from Cache (immutable)static MLocationgetBPLocation(Properties ctx, int C_BPartner_Location_ID, String trxName)Load Location with ID if Business Partner LocationStringgetCityRegionPostal()Get formatted City Region Postal linestatic MLocationgetCopy(Properties ctx, int C_Location_ID, String trxName)Get updateable copy of MLocation from cacheMCountrygetCountry()Get Country (immutable)StringgetCountry(boolean local)Get Country LineStringgetCountry(boolean local, String language)Get Country LineStringgetCountryName()Get Country NameStringgetErrorMessage()Get error messagestatic intgetFieldLength(String columnName)StringgetMapsLocation()Get edited Value (MLocation) for GoogleMaps / IDEMPIERE-147MRegiongetRegion()Get RegionStringgetRegionName()Get (local) Region NameStringgetRegionName(boolean getFromRegion)Get Region NameinthashCode()booleanisAddressLinesReverse()Print Address Reverse OrderMLocationmarkImmutable()mark PO as immutablebooleanprocessOnline(int C_AddressValidation_ID)Perform online address validationvoidsetC_Country_ID(int C_Country_ID)Set C_Country_IDvoidsetC_Region_ID(int C_Region_ID)Set C_Region_IDvoidsetCountry(MCountry country)Set CountryvoidsetErrorMessage(String errorMessage)Set error messagevoidsetRegion(MRegion region)Set RegionStringtoString()Return printable String representationStringtoStringCR()Return String representation with CR at line endStringtoStringX()Return detailed String representation-
Methods 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, 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_Value, get_Value, get_ValueAsBoolean, get_ValueAsInt, get_ValueAsInt, 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, load, loadByUU, loadComplete, loadDefaults, loadSpecial, lock, makeImmutable, postDelete, retrieveIdOfParentValue, retrieveIdOfParentValue, save, save, 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, 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 Detail
-
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:
- Constant Field Values
-
-
Constructor Detail
-
MLocation
public MLocation(Properties ctx, int C_Location_ID, String trxName)
Standard Constructor- Parameters:
ctx- contextC_Location_ID- idtrxName- transaction
-
MLocation
public MLocation(MCountry country, MRegion region)
Parent Constructor- Parameters:
country- mandatory countryregion- optional region
-
MLocation
public MLocation(Properties ctx, int C_Country_ID, int C_Region_ID, String city, String trxName)
Full Constructor- Parameters:
ctx- contextC_Country_ID- countryC_Region_ID- regioncity- citytrxName- transaction
-
MLocation
public MLocation(Properties ctx, ResultSet rs, String trxName)
Load Constructor- Parameters:
ctx- contextrs- result settrxName- transaction
-
MLocation
public MLocation(MLocation copy)
- Parameters:
copy-
-
MLocation
public MLocation(Properties ctx, MLocation copy)
- Parameters:
ctx-copy-
-
MLocation
public MLocation(Properties ctx, MLocation copy, String trxName)
- Parameters:
ctx-copy-trxName-
-
-
Method Detail
-
get
public static MLocation get(int C_Location_ID, String trxName)
Get Location from Cache- Parameters:
C_Location_ID- idtrxName- 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- contextC_Location_ID- idtrxName- 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- contextC_Location_ID-trxName-- Returns:
- MLocation
-
getBPLocation
public static MLocation getBPLocation(Properties ctx, int C_BPartner_Location_ID, String trxName)
Load Location with ID if Business Partner Location- Parameters:
ctx- contextC_BPartner_Location_ID- Business Partner LocationtrxName- 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_IDin interfaceI_C_Location- Overrides:
setC_Country_IDin classX_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 Line- Parameters:
local- if true only foreign country is returned- Returns:
- country or null
-
getCountry
public String getCountry(boolean local, String language)
Get Country Line- Parameters:
local- if true only foreign country is returned- Returns:
- country 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_IDin interfaceI_C_Location- Overrides:
setC_Region_IDin classX_C_Location- Parameters:
C_Region_ID- region
-
getRegion
public MRegion getRegion()
Get Region- Returns:
- region
-
getRegionName
public String getRegionName()
Get (local) Region Name- Specified by:
getRegionNamein interfaceI_C_Location- Overrides:
getRegionNamein classX_C_Location- Returns:
- region Name or ""
-
getRegionName
public String getRegionName(boolean getFromRegion)
Get Region Name- Parameters:
getFromRegion- get from region (not locally)- 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
public boolean equals(Object cmp)
Equals- Specified by:
equalsin interfaceComparator<Object>- Overrides:
equalsin classPO- Parameters:
cmp- comparator- Returns:
- true if ID the same
-
isAddressLinesReverse
public boolean isAddressLinesReverse()
Print Address 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:
toStringin classX_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)
Before Save- Overrides:
beforeSavein classPO- Parameters:
newRecord- new- Returns:
- true
-
afterSave
protected boolean afterSave(boolean newRecord, boolean success)After Save
-
getMapsLocation
public String getMapsLocation()
Get edited Value (MLocation) for GoogleMaps / IDEMPIERE-147- Returns:
- String address
-
getFieldLength
public static int getFieldLength(String columnName)
-
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:ImmutablePOSupportmark PO as immutable- Specified by:
markImmutablein interfaceImmutablePOSupport- Returns:
- PO
-
-