Package org.adempiere.pipo2
Class AbstractElementHandler
- java.lang.Object
-
- org.adempiere.pipo2.AbstractElementHandler
-
- All Implemented Interfaces:
ElementHandler
public abstract class AbstractElementHandler extends Object implements ElementHandler
- Author:
- hengsin
-
-
Constructor Summary
Constructors Constructor Description AbstractElementHandler()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
addTextProperty(TransformerHandler handler, String qName, String text)
protected void
addTypeName(AttributesImpl atts, String typeName)
protected void
append(TransformerHandler document, String str)
void
backupRecord(PIPOContext ctx, int AD_Package_Imp_Detail_ID, String tableName, PO from)
Make backup copy of record.int
copyFile(InputStream source, OutputStream target)
CopyfileX_AD_Package_Imp_Detail
createImportDetail(PIPOContext ctx, String type, String tableName, int tableId)
protected List<String>
defaultExcludeList(String tableName)
protected <T extends PO>
TfindPO(PIPOContext ctx, Element element)
Find po by uuid or idprotected BigDecimal
getBigDecimal(Element element, String qName)
protected boolean
getBooleanValue(Element element, String qName, boolean defaultValue)
protected int
getClientId(Properties ctx)
Get client idprotected int
getIntValue(Element element, String qName)
protected String
getPackageDirectory(Properties ctx)
protected int
getPackageImpId(Properties ctx)
Get AD_Package_Imp_IDprotected int
getParentId(Element element, String expectedName)
protected String
getStringValue(Element element, String qName)
return null for empty string ("").protected String
getStringValue(Element element, String qName, List<String> excludes)
return null for empty string ("").protected String
getTrxName(PIPOContext ctx)
Get current transaction nameprotected String
getUpdateMode(Properties ctx)
Get update system maintained dictionary flagprotected String
getUUIDKey(PIPOContext ctx, Element element)
protected boolean
hasUUIDKey(PIPOContext ctx, Element element)
protected boolean
isHandleTranslations(Properties ctx)
Returns option - Is export-import of AD translations is neededprotected boolean
isOfficialId(Element element, String columnName)
protected boolean
isPackOutElement(PIPOContext ctx, PO element)
protected boolean
isParentDefer(Element element, String expectedName)
protected boolean
isParentSkip(Element element, String expectedName)
protected boolean
isProcessElement(Properties ctx, String entityType)
Process element by entity type and user setting.void
logImportDetail(PIPOContext ctx, X_AD_Package_Imp_Detail detail, int success, String objectName, int objectID, String action)
Write results to log and records in history tablevoid
logImportDetail(PIPOContext ctx, X_AD_Package_Imp_Detail detail, int success, String objectName, int objectID, String action, String execCode, String result)
Write results to log and records in history tableFileInputStream
OpenInputfile(String filePath)
Open input file for processingOutputStream
OpenOutputfile(String filePath)
Open output file for processingprotected void
verifyPackOutRequirement(PO po)
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.adempiere.pipo2.ElementHandler
endElement, packOut, packOut, startElement
-
-
-
-
Field Detail
-
log
protected transient CLogger log
-
-
Method Detail
-
createImportDetail
public X_AD_Package_Imp_Detail createImportDetail(PIPOContext ctx, String type, String tableName, int tableId)
- Parameters:
ctx
-type
-tableName
-tableId
-- Returns:
- X_AD_Package_Imp_Detail
-
logImportDetail
public void logImportDetail(PIPOContext ctx, X_AD_Package_Imp_Detail detail, int success, String objectName, int objectID, String action) throws SAXException
Write results to log and records in history table- Parameters:
ctx
-success
-detail
-objectName
-objectID
-action
-- Throws:
SAXException
-
logImportDetail
public void logImportDetail(PIPOContext ctx, X_AD_Package_Imp_Detail detail, int success, String objectName, int objectID, String action, String execCode, String result) throws SAXException
Write results to log and records in history table- Parameters:
ctx
-success
-detail
-objectName
-objectID
-action
-execCode
-result
-- Throws:
SAXException
-
backupRecord
public void backupRecord(PIPOContext ctx, int AD_Package_Imp_Detail_ID, String tableName, PO from)
Make backup copy of record.- Parameters:
ctx
-AD_Package_Imp_Detail_ID
-tableName
-from
-
-
OpenInputfile
public FileInputStream OpenInputfile(String filePath)
Open input file for processing- Parameters:
filePath
- file with path- Returns:
-
OpenOutputfile
public OutputStream OpenOutputfile(String filePath)
Open output file for processing- Parameters:
filePath
- file with path- Returns:
-
copyFile
public int copyFile(InputStream source, OutputStream target)
Copyfile- Parameters:
source
-target
-- Returns:
-
getClientId
protected int getClientId(Properties ctx)
Get client id- Parameters:
ctx
-- Returns:
- int
-
getPackageImpId
protected int getPackageImpId(Properties ctx)
Get AD_Package_Imp_ID- Parameters:
ctx
-- Returns:
- int
-
getUpdateMode
protected String getUpdateMode(Properties ctx)
Get update system maintained dictionary flag- Parameters:
ctx
-- Returns:
- update mode
-
getTrxName
protected String getTrxName(PIPOContext ctx)
Get current transaction name- Parameters:
ctx
-- Returns:
- transaction name
-
getPackageDirectory
protected String getPackageDirectory(Properties ctx)
- Parameters:
ctx
-- Returns:
- package directory
-
isProcessElement
protected boolean isProcessElement(Properties ctx, String entityType)
Process element by entity type and user setting.- Parameters:
ctx
-entityType
-- Returns:
- boolean
-
getStringValue
protected String getStringValue(Element element, String qName)
return null for empty string ("").- Parameters:
element
-qName
-- Returns:
- string value
-
getStringValue
protected String getStringValue(Element element, String qName, List<String> excludes)
return null for empty string ("").- Parameters:
element
-qName
-- Returns:
- string value
-
getBooleanValue
protected boolean getBooleanValue(Element element, String qName, boolean defaultValue)
- Parameters:
element
-qName
-defaultValue
-- Returns:
- boolean
-
getBigDecimal
protected BigDecimal getBigDecimal(Element element, String qName)
- Parameters:
element
-qName
-- Returns:
- BigDecimal
-
getIntValue
protected int getIntValue(Element element, String qName)
- Parameters:
element
-qName
-- Returns:
- int
-
isHandleTranslations
protected boolean isHandleTranslations(Properties ctx)
Returns option - Is export-import of AD translations is needed- Parameters:
ctx
-- Returns:
-
defaultExcludeList
protected List<String> defaultExcludeList(String tableName)
- Parameters:
tableName
-- Returns:
- list of column to exclude from processing
-
getParentId
protected int getParentId(Element element, String expectedName)
- Parameters:
element
-expectedName
-- Returns:
- Parent element record id
-
isParentDefer
protected boolean isParentDefer(Element element, String expectedName)
- Parameters:
element
-expectedName
-- Returns:
- true if parent element is defer for next round of processing
-
isParentSkip
protected boolean isParentSkip(Element element, String expectedName)
- Parameters:
element
-expectedName
-- Returns:
- true if parent element is being ignore
-
isOfficialId
protected boolean isOfficialId(Element element, String columnName)
- Parameters:
element
-columnName
-- Returns:
- true if value of columnName is office id.
-
addTextProperty
protected void addTextProperty(TransformerHandler handler, String qName, String text) throws SAXException
- Parameters:
handler
-qName
-text
-- Throws:
SAXException
-
append
protected void append(TransformerHandler document, String str) throws SAXException
- Parameters:
document
-str
-- Throws:
SAXException
-
findPO
protected <T extends PO> T findPO(PIPOContext ctx, Element element)
Find po by uuid or id- Type Parameters:
T
-- Parameters:
ctx
-element
-- Returns:
- T
-
hasUUIDKey
protected boolean hasUUIDKey(PIPOContext ctx, Element element)
-
getUUIDKey
protected String getUUIDKey(PIPOContext ctx, Element element)
-
addTypeName
protected void addTypeName(AttributesImpl atts, String typeName)
- Parameters:
atts
-typeName
-
-
verifyPackOutRequirement
protected void verifyPackOutRequirement(PO po)
-
isPackOutElement
protected boolean isPackOutElement(PIPOContext ctx, PO element)
-
-