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 voidaddTextProperty(TransformerHandler handler, String qName, String text)protected voidaddTypeName(AttributesImpl atts, String typeName)protected voidappend(TransformerHandler document, String str)voidbackupRecord(PIPOContext ctx, int AD_Package_Imp_Detail_ID, String tableName, PO from)Make backup copy of record.intcopyFile(InputStream source, OutputStream target)CopyfileX_AD_Package_Imp_DetailcreateImportDetail(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 BigDecimalgetBigDecimal(Element element, String qName)protected booleangetBooleanValue(Element element, String qName, boolean defaultValue)protected intgetClientId(Properties ctx)Get client idprotected intgetIntValue(Element element, String qName)protected StringgetPackageDirectory(Properties ctx)protected intgetPackageImpId(Properties ctx)Get AD_Package_Imp_IDprotected intgetParentId(Element element, String expectedName)protected StringgetStringValue(Element element, String qName)return null for empty string ("").protected StringgetStringValue(Element element, String qName, List<String> excludes)return null for empty string ("").protected StringgetTrxName(PIPOContext ctx)Get current transaction nameprotected StringgetUpdateMode(Properties ctx)Get update system maintained dictionary flagprotected StringgetUUIDKey(PIPOContext ctx, Element element)protected booleanhasUUIDKey(PIPOContext ctx, Element element)protected booleanisHandleTranslations(Properties ctx)Returns option - Is export-import of AD translations is neededprotected booleanisOfficialId(Element element, String columnName)protected booleanisPackOutElement(PIPOContext ctx, PO element)protected booleanisParentDefer(Element element, String expectedName)protected booleanisParentSkip(Element element, String expectedName)protected booleanisProcessElement(Properties ctx, String entityType)Process element by entity type and user setting.voidlogImportDetail(PIPOContext ctx, X_AD_Package_Imp_Detail detail, int success, String objectName, int objectID, String action)Write results to log and records in history tablevoidlogImportDetail(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 tableFileInputStreamOpenInputfile(String filePath)Open input file for processingOutputStreamOpenOutputfile(String filePath)Open output file for processingprotected voidverifyPackOutRequirement(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)
-
-