* Refactoring - merge ElementHandler and IPackOutHandler interface.

* Refactoring - move handler registry into its own interface and classes.
* Merge pack in and packout extension point into one - org.adempiere.pipo.Handlers.
* Created 2 handler registry implementation, one back by property file and one back by osgi service registry.
This commit is contained in:
Heng Sin Low 2010-08-06 16:02:29 +08:00
parent e5eef27435
commit 65690c8704
57 changed files with 806 additions and 739 deletions

View File

@ -1,8 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>
<extension-point id="org.adempiere.pipo.packOutHandlers" name="Packout Handlers" schema="schema/org.adempiere.pipo.packOutHandlers.exsd"/>
<extension-point id="org.adempiere.pipo.packInHandlers" name="Packin Handlers" schema="schema/org.adempiere.pipo.packInHandlers.exsd"/>
<extension-point id="org.adempiere.pipo.Handlers" name="Element Handlers" schema="schema/org.adempiere.pipo.Handlers.exsd"/>
<extension
point="org.adempiere.base.IDictionaryService">
<client

View File

@ -52,7 +52,7 @@
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
object type name, e.g ad.table, ad.table.column, etc
element name like AD_Message, AD_Table, Code_Snippet, etc
</documentation>
</annotation>
</attribute>
@ -62,17 +62,10 @@
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.adempiere.pipo2.IPackOutHandler"/>
<meta.attribute kind="java" basedOn=":org.adempiere.pipo2.ElementHandler"/>
</appinfo>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>

View File

@ -1,116 +0,0 @@
<?xml version='1.0' encoding='UTF-8'?>
<!-- Schema file written by PDE -->
<schema targetNamespace="org.adempiere.pipo" xmlns="http://www.w3.org/2001/XMLSchema">
<annotation>
<appinfo>
<meta.schema plugin="org.adempiere.pipo" id="org.adempiere.pipo.packInHandlers" name="Packin Handlers"/>
</appinfo>
<documentation>
[Enter description of this extension point.]
</documentation>
</annotation>
<element name="extension">
<annotation>
<appinfo>
<meta.element />
</appinfo>
</annotation>
<complexType>
<choice>
<element ref="handler" minOccurs="1" maxOccurs="unbounded"/>
</choice>
<attribute name="point" type="string" use="required">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="id" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute translatable="true"/>
</appinfo>
</annotation>
</attribute>
</complexType>
</element>
<element name="handler">
<complexType>
<attribute name="id" type="string" use="required">
<annotation>
<documentation>
object type name, e.g ad.table, ad.table.column, etc
</documentation>
</annotation>
</attribute>
<attribute name="class" type="string" use="required">
<annotation>
<documentation>
</documentation>
<appinfo>
<meta.attribute kind="java" basedOn=":org.adempiere.pipo2.ElementHandler"/>
</appinfo>
</annotation>
</attribute>
<attribute name="name" type="string">
<annotation>
<documentation>
</documentation>
</annotation>
</attribute>
</complexType>
</element>
<annotation>
<appinfo>
<meta.section type="since"/>
</appinfo>
<documentation>
[Enter the first release in which this extension point appears.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="examples"/>
</appinfo>
<documentation>
[Enter extension point usage example here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="apiinfo"/>
</appinfo>
<documentation>
[Enter API information here.]
</documentation>
</annotation>
<annotation>
<appinfo>
<meta.section type="implementation"/>
</appinfo>
<documentation>
[Enter information about supplied implementation of this extension point.]
</documentation>
</annotation>
</schema>

View File

@ -548,7 +548,6 @@ public abstract class AbstractElementHandler implements ElementHandler {
}
protected void addTypeName(AttributesImpl atts, String typeName) {
atts.addAttribute("", "", "type", "CDATA", "object");
atts.addAttribute("", "", "type-name", "CDATA", typeName);
atts.addAttribute("", "", "type", "CDATA", typeName);
}
}

View File

@ -18,14 +18,17 @@ package org.adempiere.pipo2;
import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.base.IService;
import org.xml.sax.SAXException;
/**
* Interface for handling import of table data from xml
* Interface for handling import and export of table data using xml
* @author Low Heng Sin
*
*/
public interface ElementHandler {
public interface ElementHandler extends IService {
/**
* Handle start of xml element ( import ).
@ -43,4 +46,13 @@ public interface ElementHandler {
* @throws SAXException
*/
public void endElement (Properties ctx, Element element) throws SAXException;
/**
* @param packout
* @param packoutHandler
* @param docHandler
* @param recordId
* @throws Exception
*/
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception;
}

View File

@ -0,0 +1,24 @@
package org.adempiere.pipo2;
public interface IHandlerRegistry {
public static final String ELEMENT_TYPE_TRANSLATION = "translation";
public static final String ELEMENT_TYPE_TABLE = "table";
public static final String ELEMENT_TYPE_TASK = "task";
public static final String ELEMENT_TYPE_PROPERTIES = "properties";
public static final String TABLE_TRANSLATION_HANDLER = "table.translationHandler";
public static final String TABLE_GENERIC_HANDLER = "table.genericHandler";
/**
* @param element
* @return ElementHandler
*/
public ElementHandler getHandler(Element element);
/**
* @param name
* @return ElementHandler
*/
public ElementHandler getHandler(String name);
}

View File

@ -1,14 +0,0 @@
package org.adempiere.pipo2;
import javax.xml.transform.sax.TransformerHandler;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
public interface IPackOutHandler {
public void packOut(PackOut packout, MPackageExp packageExp, MPackageExpDetail packageExpDetail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception;
}

View File

@ -0,0 +1,59 @@
/**
*
*/
package org.adempiere.pipo2;
import org.adempiere.base.Service;
import org.adempiere.base.ServiceQuery;
/**
* @author hengsin
*
*/
public class OSGiHandlerRegistry implements IHandlerRegistry {
private final static String SERVICE_ID = "org.adempiere.pipo.Handlers";
/**
*
*/
public OSGiHandlerRegistry() {
// TODO Auto-generated constructor stub
}
/* (non-Javadoc)
* @see org.adempiere.pipo2.IHandlerRegistry#getHandler(org.adempiere.pipo2.Element)
*/
@Override
public ElementHandler getHandler(Element element) {
String id = null;
ElementHandler handler = null;
String type = element.attributes.getValue("type");
if (ELEMENT_TYPE_TRANSLATION.equals(type)) {
id = TABLE_TRANSLATION_HANDLER;
} else {
id = element.getElementValue();
}
ServiceQuery query = new ServiceQuery();
query.put("id", id);
handler = Service.locate(ElementHandler.class, SERVICE_ID, query);
if (handler == null) {
id = TABLE_GENERIC_HANDLER;
query.put("id", id);
handler = Service.locate(ElementHandler.class, SERVICE_ID, query);
}
return handler;
}
/* (non-Javadoc)
* @see org.adempiere.pipo2.IHandlerRegistry#getHandler(java.lang.String)
*/
@Override
public ElementHandler getHandler(String name) {
ElementHandler handler = null;
ServiceQuery query = new ServiceQuery();
query.put("id", name);
handler = Service.locate(ElementHandler.class, SERVICE_ID, query);
return handler;
}
}

View File

@ -22,16 +22,13 @@ package org.adempiere.pipo2;
import java.io.File;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Stack;
import java.util.logging.Level;
@ -43,7 +40,6 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.exception.DatabaseAccessException;
import org.compiere.model.X_AD_Package_Imp;
import org.compiere.model.X_AD_Package_Imp_Inst;
@ -60,20 +56,18 @@ import org.xml.sax.helpers.DefaultHandler;
* SAX Handler for parsing XML description of the GUI.
*
* @author Marco LOMBARDO, lombardo@mayking.com
* @author Robert KLEIN, robeklein@hotmail
* @author Robert KLEIN, robeklein@hotmailo
*
* Contributor: William G. Heath - Import of workflows and dynamic validations
*/
public class PackInHandler extends DefaultHandler {
public static final String PACK_IN_PROCESS_CTX_KEY = "PackInProcess";
private static Properties handlerRegistry;
/**
* PackInHandler Handler
*/
public PackInHandler () {
setupHandlers();
} // PackInHandler
@ -95,7 +89,7 @@ public class PackInHandler extends DefaultHandler {
private String m_trxName = null;
private Properties m_ctx = null;
private Map<String, ElementHandler>handlers = null;
private IHandlerRegistry handlerRegistry = null;
private List<DeferEntry> defer = new ArrayList<DeferEntry>();
private Stack<Element> stack = new Stack<Element>();
private PackIn packIn;
@ -145,8 +139,7 @@ public class PackInHandler extends DefaultHandler {
}
private void setupHandlers() {
handlers = new HashMap<String, ElementHandler>();
handlerRegistry = new PropertyHandlerRegistry();
}
/**
@ -245,7 +238,7 @@ public class PackInHandler extends DefaultHandler {
{
e.parent = stack.peek();
String reference = atts.getValue("type");
if ("object".equals(reference))
if (!IHandlerRegistry.ELEMENT_TYPE_PROPERTIES.equals(reference))
{
e.parent.childrens.add(e);
}
@ -260,7 +253,7 @@ public class PackInHandler extends DefaultHandler {
private void processElement(Element element) throws SAXException
{
ElementHandler handler = getHandler(element);
ElementHandler handler = handlerRegistry.getHandler(element);
if (handler != null)
handler.startElement(m_ctx, element);
if (element.defer)
@ -304,34 +297,6 @@ public class PackInHandler extends DefaultHandler {
PackOut.addTextElement(logDocument, "Database", atts.getValue("Database"), attsOut);
}
/**
* @param element
* @return ElementHandler
*/
public ElementHandler getHandler(Element element)
{
String elementType = element.attributes.getValue("type-name");
ElementHandler handler = handlers.get(elementType);
if (handler == null)
{
String className = handlerRegistry.getProperty(elementType);
if (className != null)
{
try
{
Class<?> clazz = getClass().getClassLoader().loadClass(className);
handler = (ElementHandler) clazz.newInstance();
}
catch (Exception e)
{
throw new AdempiereException(e.getLocalizedMessage(), e);
}
handlers.put(elementType, handler);
}
}
return handler;
}
/**
* @see org.xml.sax.helpers.DefaultHandler#characters(char[], int, int)
*/
@ -418,7 +383,7 @@ public class PackInHandler extends DefaultHandler {
log.info("Processeing Element: " + d.element.getElementValue() + " - "
+ d.element.attributes.getValue(0));
}
ElementHandler handler = handlers.get(d.element.getElementValue());
ElementHandler handler = handlerRegistry.getHandler(d.element);
if (handler != null) {
if (d.startElement)
handler.startElement(m_ctx, d.element);
@ -490,14 +455,4 @@ public class PackInHandler extends DefaultHandler {
startElement = b;
}
}
static {
handlerRegistry = new Properties();
try {
handlerRegistry.load((PackInHandler.class.getResourceAsStream("packin-handler.properties")));
} catch (IOException e) {
e.printStackTrace();
}
}
} // PackInHandler

View File

@ -27,7 +27,6 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.io.OutputStreamWriter;
import java.io.UnsupportedEncodingException;
import java.util.HashMap;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
@ -39,6 +38,19 @@ import javax.xml.transform.sax.SAXTransformerFactory;
import javax.xml.transform.sax.TransformerHandler;
import javax.xml.transform.stream.StreamResult;
import org.compiere.model.I_AD_Form;
import org.compiere.model.I_AD_ImpFormat;
import org.compiere.model.I_AD_Menu;
import org.compiere.model.I_AD_Message;
import org.compiere.model.I_AD_PrintFormat;
import org.compiere.model.I_AD_Process;
import org.compiere.model.I_AD_Reference;
import org.compiere.model.I_AD_ReportView;
import org.compiere.model.I_AD_Role;
import org.compiere.model.I_AD_Table;
import org.compiere.model.I_AD_Val_Rule;
import org.compiere.model.I_AD_Window;
import org.compiere.model.I_AD_Workflow;
import org.compiere.model.MClient;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
@ -68,7 +80,6 @@ public class PackOut extends SvrProcess
{
private static final String TRX_NAME_CTX_KEY = "TrxName";
public static final String PACK_OUT_PROCESS_CTX_KEY = "PackOutProcess";
private static Properties handlerRegistry;
/** Record ID */
private int p_PackOut_ID = 0;
private String PackOutVer = "005";
@ -76,22 +87,14 @@ public class PackOut extends SvrProcess
public final static int MAX_OFFICIAL_ID = 999999;
private Properties localContext = null;
private HashMap<String, IPackOutHandler> handlers;
private MPackageExp packageExp;
private MPackageExpDetail packageExpDetail;
private String packOutDir;
private String packageDir;
private int blobCount = 0;
static {
handlerRegistry = new Properties();
try {
handlerRegistry.load((PackOut.class.getResourceAsStream("packout-handler.properties")));
} catch (IOException e) {
e.printStackTrace();
}
}
private IHandlerRegistry handlerRegistry = null;
/**
* Prepare - e.g., get Parameters.
*/
@ -122,7 +125,7 @@ public class PackOut extends SvrProcess
{
initContext();
handlers = new HashMap<String, IPackOutHandler>();
handlerRegistry = new PropertyHandlerRegistry();
OutputStream packageDocStream = null;
OutputStream packOutDocStream = null;
@ -162,15 +165,16 @@ public class PackOut extends SvrProcess
.setOrderBy("Line")
.setParameters(new Object[]{p_PackOut_ID})
.list();
for(MPackageExpDetail packageExpDetail : packageExpDetails){
String Type = packageExpDetail.getType();
for(MPackageExpDetail dtl : packageExpDetails){
packageExpDetail = dtl;
String type = packageExpDetail.getType();
log.info(Integer.toString(packageExpDetail.getLine()));
IPackOutHandler handler = getHandler(Type);
ElementHandler handler = handlerRegistry.getHandler(getTypeName(type));
if (handler != null)
handler.packOut(this,packageExp,packageExpDetail,packOutDocument,packageDocument,0);
handler.packOut(this,packOutDocument,packageDocument,dtl.getExpRecordId());
else
throw new IllegalArgumentException("Packout handler not found for type " + Type);
throw new IllegalArgumentException("Packout handler not found for type " + type);
processedCount++;
}
@ -303,59 +307,41 @@ public class PackOut extends SvrProcess
return packageDocument;
}
public IPackOutHandler getHandler(String type) {
String className = handlerRegistry.getProperty(getTypeName(type));
IPackOutHandler handler = className != null ? handlers.get(className) : null;
if (handler == null && className != null)
{
try
{
Class<?> clazz = getClass().getClassLoader().loadClass(className);
handler = (IPackOutHandler)clazz.newInstance();
handlers.put(className, handler);
} catch (Exception e)
{
throw new AdempiereException(e.getLocalizedMessage(), e);
}
}
return handler;
}
private String getTypeName(String type) {
if (X_AD_Package_Exp_Detail.TYPE_ApplicationOrModule.equals(type))
return "ad.menu";
return I_AD_Menu.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_CodeSnipit.equals(type))
return "ad.code-snippet";
return "Code_Snipit";
else if (X_AD_Package_Exp_Detail.TYPE_Data.equals(type))
return "ad.po.generic";
return IHandlerRegistry.TABLE_GENERIC_HANDLER;
else if (X_AD_Package_Exp_Detail.TYPE_DynamicValidationRule.equals(type))
return "ad.dynamic-validation";
return I_AD_Val_Rule.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_File_CodeOrOther.equals(type))
return "ad.dist-file";
return "Dist_File";
else if (X_AD_Package_Exp_Detail.TYPE_Form.equals(type))
return "ad.form";
return I_AD_Form.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_ImportFormat.equals(type))
return "ad.import-format";
return I_AD_ImpFormat.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_Message.equals(type))
return "ad.message";
return I_AD_Message.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_PrintFormat.equals(type))
return "ad.printformat";
return I_AD_PrintFormat.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_ProcessReport.equals(type))
return "ad.process";
return I_AD_Process.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_Reference.equals(type))
return "ad.reference";
return I_AD_Reference.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_ReportView.equals(type))
return "ad.report-view";
return I_AD_ReportView.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_Role.equals(type))
return "ad.role";
return I_AD_Role.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_SQLStatement.equals(type))
return "ad.SQLStatement";
return "SQL_Statement";
else if (X_AD_Package_Exp_Detail.TYPE_Table.equals(type))
return "ad.table";
return I_AD_Table.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_Window.equals(type))
return "ad.window";
return I_AD_Window.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_Workflow.equals(type))
return "ad.workflow";
return I_AD_Workflow.Table_Name;
return type;
}
@ -369,6 +355,10 @@ public class PackOut extends SvrProcess
localContext = tmp;
}
/**
* @param sourceName
* @param destName
*/
public void copyFile (String sourceName, String destName ) {
InputStream source = null; // Stream for reading from the source file.
OutputStream copy= null; // Stream for writing the copy.
@ -457,5 +447,26 @@ public class PackOut extends SvrProcess
}
return fileName;
}
/**
* @return MPackageExp
*/
public MPackageExp getPackageExp() {
return packageExp;
}
/**
* @return MPackageExpDetail
*/
public MPackageExpDetail getPackageExpDetail() {
return packageExpDetail;
}
/**
* @param name
* @return ElementHandler
*/
public ElementHandler getHandler(String name) {
return handlerRegistry.getHandler(name);
}
} // PackOut

View File

@ -0,0 +1,100 @@
/**
*
*/
package org.adempiere.pipo2;
import java.io.IOException;
import java.util.HashMap;
import java.util.Map;
import java.util.Properties;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.handler.CommonTranslationHandler;
import org.adempiere.pipo2.handler.GenericPOElementHandler;
/**
* @author hengsin
*
*/
public class PropertyHandlerRegistry implements IHandlerRegistry {
private static Properties handlerRegistry;
static {
handlerRegistry = new Properties();
try {
handlerRegistry.load((PackInHandler.class.getResourceAsStream("pipo-handler.properties")));
} catch (IOException e) {
e.printStackTrace();
}
}
private Map<String, ElementHandler>handlers = null;
/**
* default constructor
*/
public PropertyHandlerRegistry() {
handlers = new HashMap<String, ElementHandler>();
handlers.put(TABLE_GENERIC_HANDLER, new GenericPOElementHandler());
handlers.put(TABLE_TRANSLATION_HANDLER, new CommonTranslationHandler());
}
/**
* @see org.adempiere.pipo2.IHandlerRegistry#getHandler(org.adempiere.pipo2.Element)
*/
@Override
public ElementHandler getHandler(Element element) {
ElementHandler handler = null;
String type = element.attributes.getValue("type");
if (ELEMENT_TYPE_TRANSLATION.equals(type))
handler = handlers.get(TABLE_TRANSLATION_HANDLER);
else
handler = handlers.get(element.getElementValue());
if (handler == null)
{
String className = handlerRegistry.getProperty(element.getElementValue());
if (className != null)
{
try
{
Class<?> clazz = getClass().getClassLoader().loadClass(className);
handler = (ElementHandler) clazz.newInstance();
}
catch (Exception e)
{
throw new AdempiereException(e.getLocalizedMessage(), e);
}
handlers.put(element.getElementValue(), handler);
}
else
{
handler = handlers.get(TABLE_GENERIC_HANDLER);
}
}
return handler;
}
/**
* @see org.adempiere.pipo2.IHandlerRegistry#getHandler(java.lang.String)
*/
@Override
public ElementHandler getHandler(String name) {
String className = handlerRegistry.getProperty(name);
ElementHandler handler = className != null ? handlers.get(className) : null;
if (handler == null && className != null)
{
try
{
Class<?> clazz = getClass().getClassLoader().loadClass(className);
handler = (ElementHandler)clazz.newInstance();
handlers.put(className, handler);
} catch (Exception e)
{
throw new AdempiereException(e.getLocalizedMessage(), e);
}
}
return handler;
}
}

View File

@ -24,14 +24,11 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.M_Element;
import org.compiere.model.X_AD_Element;
import org.compiere.model.X_AD_Package_Imp_Detail;
@ -40,7 +37,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class AdElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class AdElementHandler extends AbstractElementHandler {
private List<Integer> processedElements = new ArrayList<Integer>();
@ -123,7 +120,7 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
X_AD_Element m_AdElement = new X_AD_Element(ctx, adElement_id, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.element");
addTypeName(atts, "table");
document.startElement("", "", "AD_Element", atts);
createAdElementBinding(ctx, document, m_AdElement);
@ -131,7 +128,7 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
try{
new CommonTranslationHandler().packOut(packOut,null,null,document,null,m_AdElement.get_ID());
new CommonTranslationHandler().packOut(packOut,document,null,m_AdElement.get_ID());
}
catch(Exception e)
{
@ -153,10 +150,10 @@ public class AdElementHandler extends AbstractElementHandler implements IPackOut
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp packageExp, MPackageExpDetail packageExpDetail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
Env.setContext(packout.getCtx(), X_AD_Element.COLUMNNAME_AD_Element_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Element.COLUMNNAME_AD_Element_ID);
}
}

View File

@ -34,7 +34,6 @@ import javax.xml.transform.sax.TransformerHandler;
import org.compiere.Adempiere;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Backup;
@ -46,10 +45,9 @@ import org.xml.sax.helpers.AttributesImpl;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PackOut;
public class CodeSnippetElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class CodeSnippetElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element) throws SAXException {
String action = null;
@ -204,10 +202,10 @@ public class CodeSnippetElementHandler extends AbstractElementHandler implements
String NewCode = Env.getContext(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_New);
String ReleaseNo = Env.getContext(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.code-snippet");
addTypeName(atts, "custom");
createSnipitBinding(atts, FileDir, FileName, OldCode, NewCode, ReleaseNo);
document.startElement("","","codesnippet",atts);
document.endElement("","","codesnippet");
document.startElement("","","Code_Snipit",atts);
document.endElement("","","Code_Snipit");
}
private AttributesImpl createSnipitBinding( AttributesImpl atts, String FileDir, String FileName, String OldCode, String NewCode, String ReleaseNo)
@ -231,14 +229,15 @@ public class CodeSnippetElementHandler extends AbstractElementHandler implements
return atts;
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
MPackageExpDetail detail = packout.getPackageExpDetail();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_Destination_Directory, detail.getDestination_Directory());
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_FileName, detail.getDestination_FileName());
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_Old, detail.getAD_Package_Code_Old());
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_New, detail.getAD_Package_Code_New());
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo,detail.getReleaseNo());
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_File_Directory);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_FileName);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Package_Code_Old);

View File

@ -307,7 +307,7 @@ public class ColumnElementHandler extends AbstractElementHandler {
AttributesImpl atts = new AttributesImpl();
X_AD_Column m_Column = new X_AD_Column(ctx, AD_Column_ID,
getTrxName(ctx));
addTypeName(atts, "ad.table.column");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Column.Table_Name, atts);
createColumnBinding(ctx, document, m_Column);
document.endElement("", "", I_AD_Column.Table_Name);
@ -332,4 +332,12 @@ public class ColumnElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -11,7 +11,6 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.DBException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.ElementHandler;
@ -21,18 +20,14 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Element;
public class CommonTranslationHandler extends AbstractElementHandler implements ElementHandler,IPackOutHandler{
public class CommonTranslationHandler extends AbstractElementHandler implements ElementHandler {
public static final String CONTEXT_KEY_PARENT_TABLE = "currentParentTableForTranslation";
public static final String CONTEXT_KEY_PARENT_RECORD_ID = "currentParentTableRecordID_ForTranslation";
public static final String SPECIAL_ATRRIBUTE_TABLE_NAME = "ParentTable";
private HashMap<String, ArrayList<String>> cached_PIPO_ColumnsByTable = new HashMap<String, ArrayList<String>>();//Key: table name. Value: set of PIPO columns
private HashMap<String, ArrayList<String>> cacheColumns = new HashMap<String, ArrayList<String>>();//Key: table name. Value: set of PIPO columns
public void startElement(Properties ctx, Element element) throws SAXException {
@ -56,25 +51,24 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
if(parentID ==0)
throw new SAXException();
String parentTable = getStringValue(element, SPECIAL_ATRRIBUTE_TABLE_NAME);
String language = getStringValue(element, "AD_Language");
log.info(elementValue+" "+parentTable+" "+getStringValue(element, "Name"));
log.info(elementValue+" "+getStringValue(element, "Name"));
if(isRecordExists(parentTable, parentID, language, ctx)){
updateTranslation(parentTable, parentID, ctx, element);
if(isRecordExists(elementValue, parentID, language, ctx)){
updateTranslation(elementValue, parentID, ctx, element);
}else{
insertTranslation(parentTable, parentID, ctx, element);
insertTranslation(elementValue, parentID, ctx, element);
}
}
private boolean isRecordExists(String parentTable, int parentID,
private boolean isRecordExists(String tableName, int parentID,
String language, Properties ctx) {
String sql =
"SELECT AD_Client_ID FROM " + parentTable +"_TRL WHERE " +
parentTable + "_ID = ? AND AD_Language = ?";
"SELECT AD_Client_ID FROM " + tableName +" WHERE " +
tableName.substring(0, tableName.length()-4) + "_ID = ? AND AD_Language = ?";
if(DB.getSQLValue(getTrxName(ctx), sql, parentID, language) == -1){
return false;
@ -84,17 +78,22 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
}
private void insertTranslation(String parentTable, int parentID,
private void insertTranslation(String tableName, int parentID,
Properties ctx, Element element) throws SAXException{
ArrayList<String> pipoColumns = getExportableColumns(parentTable);
StringBuffer sql = new StringBuffer(
"INSERT INTO " + parentTable + "_TRL (" + parentTable + "_ID, " +
" AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, " + cast(pipoColumns) +
") values ( ?, ?, ?, ?, ? ");
String parentTable = tableName.substring(0, tableName.length()-4);
ArrayList<String> columns = getTranslatedColumns(parentTable);
StringBuffer sql = new StringBuffer();
sql.append("INSERT INTO ")
.append(tableName)
.append(" (")
.append(parentTable)
.append("_ID, ")
.append(" AD_Client_ID, AD_Org_ID, CreatedBy, UpdatedBy, ")
.append(cast(columns))
.append(") values ( ?, ?, ?, ?, ? ");
for (int i = 0; i<pipoColumns.size(); i++) {
for (int i = 0; i<columns.size(); i++) {
sql.append(",?");
}
@ -110,7 +109,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
pstm.setInt(5, 0);
int i = 5;
for (String columnName : pipoColumns) {
for (String columnName : columns) {
i++;
String value = getStringValue(element, columnName);
@ -133,17 +132,16 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
}
private void updateTranslation(String parentTable, int parentID,
private void updateTranslation(String tableName, int parentID,
Properties ctx, Element element) throws SAXException{
ArrayList<String> pipoColumns = getExportableColumns(parentTable);
StringBuffer sqlBuf = new StringBuffer("UPDATE "+parentTable+"_TRL SET ");
for (String columnName : pipoColumns) {
sqlBuf.append(columnName).append("=?,");
String parentTable = tableName.substring(0, tableName.length()-4);
ArrayList<String> columns = getTranslatedColumns(parentTable);
StringBuffer buffer = new StringBuffer("UPDATE "+tableName+" SET ");
for (String columnName : columns) {
buffer.append(columnName).append("=?,");
}
String sql = sqlBuf.substring(0, sqlBuf.length()-1);
String sql = buffer.substring(0, buffer.length()-1);
sql += " WHERE AD_Language = '"+getStringValue(element, "AD_Language")+
"' AND "+parentTable+"_ID="+parentID;
@ -151,8 +149,7 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
try {
pstm = DB.prepareStatement(sql,getTrxName(ctx));
int i=0;
for (String columnName : pipoColumns) {
for (String columnName : columns) {
String value = getStringValue(element, columnName);
i++;
@ -194,52 +191,47 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
private void createTranslationTags(Properties ctx, String parentTable,
int parentRecordID, TransformerHandler document) throws SAXException {
ArrayList<String> exportableColumns = getExportableColumns(parentTable);
ArrayList<String> translatedColumns = getTranslatedColumns(parentTable);
String sql =
"select "+cast(exportableColumns)+" from "+parentTable+"_trl where "+
"select "+cast(translatedColumns)+" from "+parentTable+"_trl where "+
parentTable+"_ID="+parentRecordID;
PreparedStatement pstm = DB.prepareStatement(sql, null);
PreparedStatement pstm = null;
ResultSet rs = null;
try {
ResultSet rs = pstm.executeQuery();
pstm = DB.prepareStatement(sql, null);
rs = pstm.executeQuery();
String elementName = parentTable + "_Trl";
while(rs.next()){
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.trl");
document.startElement("", "", "trl", atts);
addTextProperty(null, SPECIAL_ATRRIBUTE_TABLE_NAME, parentTable);
getAttsForOneTrlRow(ctx, document, exportableColumns, rs);
document.endElement("", "", "trl");
addTypeName(atts, "translation");
document.startElement("", "", elementName, atts);
exportRow(ctx, document, translatedColumns, rs);
document.endElement("", "", elementName);
}
rs.close();
pstm.close();
} catch (Exception e) {
e.printStackTrace();
throw new SAXException();
} finally {
DB.close(rs, pstm);
}
}
private void getAttsForOneTrlRow(Properties ctx, TransformerHandler document, ArrayList<String> exportableColumns,
private void exportRow(Properties ctx, TransformerHandler document, ArrayList<String> columns,
ResultSet rs) throws Exception {
AttributesImpl atts = new AttributesImpl();
PoExporter af = new PoExporter(ctx, document, null);
for (String columnName : exportableColumns) {
for (String columnName : columns) {
if(columnName.equalsIgnoreCase("IsActive")||
columnName.equalsIgnoreCase("IsTranslated")){
af.addBoolean(columnName, rs.getString(columnName).equalsIgnoreCase("Y"), atts);
}else{
af.addString(columnName, rs.getString(columnName), atts);
columnName.equalsIgnoreCase("IsTranslated")) {
af.addBoolean(columnName, rs.getString(columnName).equalsIgnoreCase("Y"), new AttributesImpl());
} else{
af.addString(columnName, rs.getString(columnName), new AttributesImpl());
}
}
}
@ -250,59 +242,57 @@ public class CommonTranslationHandler extends AbstractElementHandler implements
* @return
* @throws SAXException
*/
@SuppressWarnings("unchecked")
private ArrayList<String> getExportableColumns(String parentTable) throws SAXException {
private ArrayList<String> getTranslatedColumns(String parentTable) throws SAXException {
Object pipolColumns = cached_PIPO_ColumnsByTable.get(parentTable);
ArrayList<String> pipolColumns = cacheColumns.get(parentTable);
if(pipolColumns != null){
return (ArrayList<String>)pipolColumns;
return pipolColumns;
}
ArrayList<String> new_PIPO_Columns = new ArrayList<String>();
ArrayList<String> columns = new ArrayList<String>();
String sql = "select * from ad_column where ad_table_id = " +
"(select ad_table_id from ad_table where tableName = ?)" +
"and isTranslated='Y'";
PreparedStatement pstm = DB.prepareStatement(sql, null);
PreparedStatement pstm = null;
ResultSet rs = null;
try {
pstm = DB.prepareStatement(sql, null);
pstm.setString(1, parentTable);
ResultSet rs = pstm.executeQuery();
rs = pstm.executeQuery();
while(rs.next()){
new_PIPO_Columns.add(rs.getString("columnName"));
columns.add(rs.getString("columnName"));
}
pstm.close();
rs.close();
} catch (SQLException e) {
e.printStackTrace();
throw new SAXException();
} finally {
DB.close(rs, pstm);
}
new_PIPO_Columns.add("AD_Language");
new_PIPO_Columns.add("IsActive");
new_PIPO_Columns.add("IsTranslated");
columns.add("AD_Language");
columns.add("IsActive");
columns.add("IsTranslated");
//Putting in cache
cached_PIPO_ColumnsByTable.put(parentTable, new_PIPO_Columns);
cacheColumns.put(parentTable, columns);
return (ArrayList<String>)new_PIPO_Columns;
return columns;
}
private String cast(ArrayList<String> arg){
return arg.toString().substring(1, arg.toString().length()-1);
String str = arg.toString();
return str.substring(1, str.length()-1);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if("true".equals(packout.getCtx().getProperty("isHandleTranslations"))){
Env.setContext(packout.getCtx(), CommonTranslationHandler.CONTEXT_KEY_PARENT_TABLE,X_AD_Element.Table_Name);
Env.setContext(packout.getCtx(), CommonTranslationHandler.CONTEXT_KEY_PARENT_RECORD_ID,recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(CommonTranslationHandler.CONTEXT_KEY_PARENT_TABLE);
packout.getCtx().remove(CommonTranslationHandler.CONTEXT_KEY_PARENT_RECORD_ID);

View File

@ -185,14 +185,14 @@ public class DistFileElementHandler extends AbstractElementHandler {
String Target_Directory = Env.getContext(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory);
String ReleaseNo = Env.getContext(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_ReleaseNo);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.dist-file");
document.startElement("","","distfile",atts);
addTypeName(atts, "custom");
document.startElement("","","Dist_File",atts);
addTextProperty(document,"filename",FileName);
addTextProperty(document,"sourceDirectory",Source_Directory);
addTextProperty(document,"targetDirectory",Target_Directory);
addTextProperty(document,"ReleaseNo",ReleaseNo);
atts.addAttribute("","","ReleaseNo","CDATA",ReleaseNo);
document.endElement("","","distfile");
document.endElement("","","Dist_File");
}
public void doPackout(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,AttributesImpl atts,int recordId) throws Exception
@ -207,4 +207,12 @@ public class DistFileElementHandler extends AbstractElementHandler {
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_Target_Directory);
packout.getCtx().remove("Source_Directory");
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -23,15 +23,12 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Val_Rule;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_Val_Rule;
@ -39,7 +36,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class DynValRuleElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class DynValRuleElementHandler extends AbstractElementHandler {
private List<Integer> rules = new ArrayList<Integer>();
@ -103,7 +100,7 @@ public class DynValRuleElementHandler extends AbstractElementHandler implements
rules.add(AD_Val_Rule_ID);
X_AD_Val_Rule m_ValRule = new X_AD_Val_Rule (ctx, AD_Val_Rule_ID, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.dynamic-validation");
addTypeName(atts, "table");
document.startElement("","",I_AD_Val_Rule.Table_Name, atts);
createDynamicValidationRuleBinding(ctx,document,m_ValRule);
document.endElement("","",I_AD_Val_Rule.Table_Name);
@ -122,15 +119,12 @@ public class DynValRuleElementHandler extends AbstractElementHandler implements
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0 )
recordId = detail.getAD_Val_Rule_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID);
}
}

View File

@ -22,7 +22,7 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -134,7 +134,7 @@ public class FieldElementHandler extends AbstractElementHandler {
X_AD_Field.COLUMNNAME_AD_Field_ID);
X_AD_Field m_Field = new X_AD_Field(ctx, AD_Field_ID, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.tab.field");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Field.Table_Name, atts);
createFieldBinding(ctx, document, m_Field);
@ -144,26 +144,26 @@ public class FieldElementHandler extends AbstractElementHandler {
{
if(m_Field.getAD_FieldGroup_ID() > 0)
{
IPackOutHandler handler = packOut.getHandler("FG");
handler.packOut(packOut,null,null,document,null,m_Field.getAD_FieldGroup_ID());
ElementHandler handler = packOut.getHandler("FG");
handler.packOut(packOut,document,null,m_Field.getAD_FieldGroup_ID());
}
if (m_Field.getAD_Reference_ID()>0)
{
IPackOutHandler handler = packOut.getHandler("REF");
handler.packOut(packOut,null,null,document,null,m_Field.getAD_Reference_ID());
ElementHandler handler = packOut.getHandler("REF");
handler.packOut(packOut,document,null,m_Field.getAD_Reference_ID());
}
if (m_Field.getAD_Reference_Value_ID()>0)
{
IPackOutHandler handler = packOut.getHandler("REF");
handler.packOut(packOut,null,null,document,null,m_Field.getAD_Reference_Value_ID());
ElementHandler handler = packOut.getHandler("REF");
handler.packOut(packOut,document,null,m_Field.getAD_Reference_Value_ID());
}
if (m_Field.getAD_Val_Rule_ID()>0)
{
IPackOutHandler handler = packOut.getHandler("V");
handler.packOut(packOut,null,null,document,null,m_Field.getAD_Val_Rule_ID());
ElementHandler handler = packOut.getHandler("V");
handler.packOut(packOut,document,null,m_Field.getAD_Val_Rule_ID());
}
}
catch(Exception e)
@ -185,4 +185,12 @@ public class FieldElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -24,22 +24,19 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_FieldGroup;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_FieldGroup;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class FieldGroupElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class FieldGroupElementHandler extends AbstractElementHandler {
private List<Integer> processedFieldGroups = new ArrayList<Integer>();
@ -128,7 +125,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
X_AD_FieldGroup fieldGroup = new X_AD_FieldGroup(ctx, fieldGroup_id, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.field-group");
addTypeName(atts, "table");
document.startElement("", "", I_AD_FieldGroup.Table_Name, atts);
createAdElementBinding(ctx, document, fieldGroup);
@ -136,7 +133,7 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
PackOut packOut = (PackOut)ctx.get("PackOutProcess");
try{
new CommonTranslationHandler().packOut(packOut,null,null,document,null,fieldGroup.get_ID());
new CommonTranslationHandler().packOut(packOut,document,null,fieldGroup.get_ID());
}
catch(Exception e)
{
@ -158,11 +155,11 @@ public class FieldGroupElementHandler extends AbstractElementHandler implements
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
Env.setContext(packout.getCtx(), X_AD_FieldGroup.COLUMNNAME_AD_FieldGroup_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_FieldGroup.COLUMNNAME_AD_FieldGroup_ID);
}
}

View File

@ -1,81 +1,97 @@
package org.adempiere.pipo2.handler;
import java.io.File;
import java.util.Properties;
import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PackOut;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.util.CLogger;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class FileElementHandler implements IPackOutHandler{
public class FileElementHandler implements ElementHandler {
private CLogger log = CLogger.getCLogger(FileElementHandler.class);
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
{
log.log(Level.INFO,"In PackOut.java handling Code or Other 2pack module creation");
String fileDirectory = header.getFile_Directory() + header.getName() + detail.getTarget_Directory();
log.log(Level.INFO,"targetDirectory" + fileDirectory);
String targetDirectory=null;
char fileseperator1 = '/';
char fileseperator2 = '\\';
//Correct package for proper file seperator
if (File.separator.equals("/")){
targetDirectory = fileDirectory.replace(fileseperator2,fileseperator1);
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler, int recordId) throws Exception {
MPackageExp header = packout.getPackageExp();
MPackageExpDetail detail = packout.getPackageExpDetail();
log.log(Level.INFO,
"In PackOut.java handling Code or Other 2pack module creation");
String fileDirectory = header.getFile_Directory() + header.getName()
+ detail.getTarget_Directory();
log.log(Level.INFO, "targetDirectory" + fileDirectory);
String targetDirectory = null;
char fileseperator1 = '/';
char fileseperator2 = '\\';
// Correct package for proper file seperator
if (File.separator.equals("/")) {
targetDirectory = fileDirectory.replace(fileseperator2,
fileseperator1);
} else
targetDirectory = fileDirectory.replace(fileseperator1,
fileseperator2);
String sourceDirectory = null;
fileDirectory = detail.getFile_Directory();
// Correct package for proper file seperator
if (File.separator.equals("/")) {
sourceDirectory = fileDirectory.replace(fileseperator2,
fileseperator1);
} else
sourceDirectory = fileDirectory.replace(fileseperator2,
fileseperator1);
packout.copyFile(sourceDirectory + detail.getFileName(),
targetDirectory + detail.getFileName());
AttributesImpl atts = new AttributesImpl();
if (detail.getDestination_Directory() != null) {
fileDirectory = detail.getDestination_Directory();
String destinationDirectory = null;
// Correct package for proper file seperator
if (File.separator.equals("/")) {
destinationDirectory = fileDirectory.replace(fileseperator2,
fileseperator1);
} else
destinationDirectory = fileDirectory.replace(fileseperator2,
fileseperator1);
try {
new DistFileElementHandler(destinationDirectory).doPackout(
packout, null, detail, packoutHandler, null, null, 0);
} catch (Exception e) {
throw new AdempiereException(e.getLocalizedMessage(), e);
}
else
targetDirectory = fileDirectory.replace(fileseperator1,fileseperator2);
String sourceDirectory = null;
fileDirectory = detail.getFile_Directory();
//Correct package for proper file seperator
if (File.separator.equals("/")){
sourceDirectory = fileDirectory.replace(fileseperator2,fileseperator1);
}
else
sourceDirectory = fileDirectory.replace(fileseperator2,fileseperator1);
packout.copyFile(
sourceDirectory + detail.getFileName(),
targetDirectory + detail.getFileName()
);
AttributesImpl atts = new AttributesImpl();
if(detail.getDestination_Directory() != null){
fileDirectory = detail.getDestination_Directory();
String destinationDirectory=null;
//Correct package for proper file seperator
if (File.separator.equals("/")){
destinationDirectory = fileDirectory.replace(fileseperator2,fileseperator1);
}
else
destinationDirectory = fileDirectory.replace(fileseperator2,fileseperator1);
try{
new DistFileElementHandler(destinationDirectory).doPackout(packout,null,detail,packOutDocument,null,null,0);
}
catch(Exception e)
{
throw new AdempiereException(e.getLocalizedMessage(), e);
}
}
if(detail.getFileName() != null){
PackOut.addTextElement(packageDocument, "file", "File: "+detail.getFileName(),atts);
}
PackOut.addTextElement(packageDocument, "filedirectory", "Directory: " + detail.getTarget_Directory(), atts);
PackOut.addTextElement(packageDocument, "filenotes", "Notes: " + detail.getDescription(), atts);
}
if (detail.getFileName() != null) {
PackOut.addTextElement(docHandler, "file",
"File: " + detail.getFileName(), atts);
}
PackOut.addTextElement(docHandler, "filedirectory", "Directory: "
+ detail.getTarget_Directory(), atts);
PackOut.addTextElement(docHandler, "filenotes",
"Notes: " + detail.getDescription(), atts);
}
@Override
public void startElement(Properties ctx, Element element)
throws SAXException {
}
@Override
public void endElement(Properties ctx, Element element) throws SAXException {
}
}

View File

@ -22,6 +22,7 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller;
@ -95,7 +96,7 @@ public class FormAccessElementHandler extends AbstractElementHandler {
int AD_Form_ID = Env.getContextAsInt(ctx, X_AD_Form.COLUMNNAME_AD_Form_ID);
int AD_Role_ID = Env.getContextAsInt(ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.form-access");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Form_Access.Table_Name, atts);
createFormAccessBinding(ctx, document, AD_Form_ID, AD_Role_ID);
document.endElement("", "", I_AD_Form_Access.Table_Name);
@ -113,4 +114,12 @@ public class FormAccessElementHandler extends AbstractElementHandler {
}
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -24,7 +24,6 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -32,8 +31,6 @@ import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Form;
import org.compiere.model.MForm;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Form;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
@ -41,7 +38,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class FormElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class FormElementHandler extends AbstractElementHandler {
private List<Integer> forms = new ArrayList<Integer>();
@ -105,7 +102,7 @@ public class FormElementHandler extends AbstractElementHandler implements IPackO
forms.add(AD_Form_ID);
X_AD_Form m_Form = new X_AD_Form (ctx, AD_Form_ID, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.form");
addTypeName(atts, "table");
document.startElement("","",I_AD_Form.Table_Name,atts);
createFormBinding(ctx, document, m_Form);
document.endElement("","",I_AD_Form.Table_Name);
@ -122,14 +119,10 @@ public class FormElementHandler extends AbstractElementHandler implements IPackO
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Form_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID);
}
}

View File

@ -28,13 +28,11 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.model.GenericPO;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.compiere.model.MColumn;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.MRole;
import org.compiere.model.MTable;
@ -54,7 +52,7 @@ import org.xml.sax.helpers.AttributesImpl;
* @author Low Heng Sin
*
*/
public class GenericPOElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class GenericPOElementHandler extends AbstractElementHandler {
public GenericPOElementHandler() {
}
@ -159,7 +157,7 @@ public class GenericPOElementHandler extends AbstractElementHandler implements I
int AD_Client_ID = po.getAD_Client_ID();
if (AD_Client_ID != Env.getAD_Client_ID(ctx))
continue;
addTypeName(atts, "ad.po.generic");
addTypeName(atts, "table");
document.startElement("","", tableName, atts);
PoExporter filler = new PoExporter(ctx, document, po);
filler.export(excludes);
@ -209,11 +207,12 @@ public class GenericPOElementHandler extends AbstractElementHandler implements I
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
MPackageExpDetail detail = packout.getPackageExpDetail();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID, detail.getAD_Table_ID());
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement, detail.getSQLStatement());
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement);
}

View File

@ -26,7 +26,6 @@ import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -34,8 +33,6 @@ import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.DatabaseAccessException;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_ImpFormat;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_ImpFormat;
import org.compiere.model.X_AD_ImpFormat_Row;
import org.compiere.model.X_AD_Package_Exp_Detail;
@ -45,7 +42,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class ImpFormatElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class ImpFormatElementHandler extends AbstractElementHandler {
private ImpFormatRowElementHandler rowHandler = new ImpFormatRowElementHandler();
@ -110,7 +107,7 @@ public class ImpFormatElementHandler extends AbstractElementHandler implements
formats.add(import_id);
AttributesImpl atts = new AttributesImpl();
X_AD_ImpFormat m_ImpFormat = new X_AD_ImpFormat(ctx, import_id, null);
addTypeName(atts, "ad.import-format");
addTypeName(atts, "table");
document.startElement("", "", I_AD_ImpFormat.Table_Name, atts);
createImpFormatBinding(ctx, document, m_ImpFormat);
@ -157,13 +154,10 @@ public class ImpFormatElementHandler extends AbstractElementHandler implements
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_ImpFormat_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ImpFormat_ID);
}
}

View File

@ -146,7 +146,7 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
int AD_ImpFormat_Row_ID = Env.getContextAsInt(ctx, X_AD_ImpFormat_Row.COLUMNNAME_AD_ImpFormat_Row_ID);
X_AD_ImpFormat_Row m_ImpFormat_Row = new X_AD_ImpFormat_Row (ctx, AD_ImpFormat_Row_ID, getTrxName(ctx));
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.import-format.row");
addTypeName(atts, "table");
document.startElement("","",I_AD_ImpFormat_Row.Table_Name,atts);
createImpFormatRowBinding(ctx,document,m_ImpFormat_Row);
document.endElement("","",I_AD_ImpFormat_Row.Table_Name);
@ -169,4 +169,12 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -27,15 +27,13 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.DBException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.ReferenceUtils;
import org.compiere.model.I_AD_Menu;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Menu;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Backup;
@ -47,7 +45,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class MenuElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class MenuElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element)
throws SAXException {
@ -191,7 +189,7 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
createApplication(ctx, document, AD_Menu_ID);
} else {
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.menu");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Menu.Table_Name, atts);
createMenuBinding(ctx, document, m_Menu);
createModule(ctx, document, AD_Menu_ID);
@ -249,27 +247,27 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
// Call CreateWindow.
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID)>0)
{
IPackOutHandler handler = packOut.getHandler("W");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID));
ElementHandler handler = packOut.getHandler("W");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID));
}
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
{
IPackOutHandler handler = packOut.getHandler("P");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID));
ElementHandler handler = packOut.getHandler("P");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID));
} else if (rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID)>0)
{
IPackOutHandler handler = packOut.getHandler("ad.task");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID));
ElementHandler handler = packOut.getHandler("ad.task");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID));
}
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID) > 0)
{
IPackOutHandler handler = packOut.getHandler("X");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID));
ElementHandler handler = packOut.getHandler("X");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID));
}
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID) > 0)
{
IPackOutHandler handler = packOut.getHandler("F");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID));
ElementHandler handler = packOut.getHandler("F");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID));
}
// Call CreateModule because entry is a summary menu
} else {
@ -315,28 +313,28 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
// Call CreateWindow.
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID)>0)
{
IPackOutHandler handler = packOut.getHandler("W");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID));
ElementHandler handler = packOut.getHandler("W");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID));
}
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
{
IPackOutHandler handler = packOut.getHandler("P");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID));
ElementHandler handler = packOut.getHandler("P");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID));
}
else if (rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID)>0)
{
IPackOutHandler handler = packOut.getHandler("K");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID));
ElementHandler handler = packOut.getHandler("K");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Task.COLUMNNAME_AD_Task_ID));
}
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID) > 0)
{
IPackOutHandler handler = packOut.getHandler("X");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID));
ElementHandler handler = packOut.getHandler("X");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Form_ID));
}
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID) > 0)
{
IPackOutHandler handler = packOut.getHandler("F");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID));
ElementHandler handler = packOut.getHandler("F");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID));
}
// Call CreateModule because entry is a summary menu
} else {
@ -352,14 +350,10 @@ public class MenuElementHandler extends AbstractElementHandler implements IPackO
}
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail, TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Menu_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Menu_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Menu_ID);
}
}

View File

@ -23,7 +23,6 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -31,8 +30,6 @@ import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Message;
import org.compiere.model.MMessage;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Message;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
@ -40,7 +37,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class MessageElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class MessageElementHandler extends AbstractElementHandler {
private List<Integer> messages = new ArrayList<Integer>();
@ -102,7 +99,7 @@ public class MessageElementHandler extends AbstractElementHandler implements IPa
messages.add(AD_Message_ID);
AttributesImpl atts = new AttributesImpl();
X_AD_Message m_Message = new X_AD_Message (ctx, AD_Message_ID, null);
addTypeName(atts, "ad.message");
addTypeName(atts, "table");
document.startElement("","",I_AD_Message.Table_Name,atts);
createMessageBinding(ctx,document,m_Message);
document.endElement("","",I_AD_Message.Table_Name);
@ -118,14 +115,10 @@ public class MessageElementHandler extends AbstractElementHandler implements IPa
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Message_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Message_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Message_ID);
}
}

View File

@ -23,6 +23,7 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.ReferenceUtils;
@ -84,7 +85,7 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
int AD_Org_ID = Env.getContextAsInt(ctx, "AD_Org_ID");
int AD_Role_ID = Env.getContextAsInt(ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.organization-role");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Role_OrgAccess.Table_Name, atts);
createOrgAccessBinding(ctx, document, AD_Org_ID, AD_Role_ID);
document.endElement("", "", I_AD_Role_OrgAccess.Table_Name);
@ -109,4 +110,12 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
excludes.add("AD_Role_ID");
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -109,7 +109,7 @@ public class PreferenceElementHandler extends AbstractElementHandler {
X_AD_Preference m_Preference = new X_AD_Preference(ctx,
AD_Preference_ID, getTrxName(ctx));
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.preference");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Preference.Table_Name, atts);
createPreferenceBinding(ctx, document, m_Preference);
document.endElement("", "", I_AD_Preference.Table_Name);
@ -125,4 +125,12 @@ public class PreferenceElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -27,15 +27,12 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.DBException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_PrintFormat;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_PrintFormat;
@ -45,7 +42,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class PrintFormatElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class PrintFormatElementHandler extends AbstractElementHandler {
private List<Integer> formats = new ArrayList<Integer>();
@ -107,12 +104,12 @@ public class PrintFormatElementHandler extends AbstractElementHandler implements
X_AD_PrintFormat m_Printformat = new X_AD_PrintFormat(ctx, AD_PrintFormat_ID, null);
if (m_Printformat.getAD_PrintPaper_ID() > 0) {
try {
getPackOutProcess(ctx).getHandler("PP").packOut(getPackOutProcess(ctx), null, null, document, getLogDocument(ctx), m_Printformat.getAD_PrintPaper_ID());
getPackOutProcess(ctx).getHandler("PP").packOut(getPackOutProcess(ctx), document, getLogDocument(ctx), m_Printformat.getAD_PrintPaper_ID());
} catch (Exception e) {
throw new SAXException(e);
}
}
addTypeName(atts, "ad.print-format");
addTypeName(atts, "table");
document.startElement("", "", I_AD_PrintFormat.Table_Name, atts);
createPrintFormatBinding(ctx, document, m_Printformat);
@ -139,7 +136,7 @@ public class PrintFormatElementHandler extends AbstractElementHandler implements
private void createItem(Properties ctx, TransformerHandler document,
int AD_PrintFormatItem_ID) throws SAXException {
try {
getPackOutProcess(ctx).getHandler("ad.printformat.item").packOut(getPackOutProcess(ctx), null, null, document, getLogDocument(ctx), AD_PrintFormatItem_ID);
getPackOutProcess(ctx).getHandler("ad.printformat.item").packOut(getPackOutProcess(ctx), document, getLogDocument(ctx), AD_PrintFormatItem_ID);
} catch (Exception e) {
throw new SAXException(e);
}
@ -157,14 +154,10 @@ public class PrintFormatElementHandler extends AbstractElementHandler implements
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_PrintFormat_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_PrintFormat_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_PrintFormat_ID);
}
}

View File

@ -23,7 +23,6 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -31,8 +30,6 @@ import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.ReferenceUtils;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_PrintFormatItem;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_PrintFormatItem;
import org.compiere.util.DB;
@ -40,7 +37,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class PrintFormatItemElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class PrintFormatItemElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element)
throws SAXException {
@ -142,7 +139,7 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler implem
X_AD_PrintFormatItem m_PrintFormatItem = new X_AD_PrintFormatItem(ctx,
AD_PrintFormatItem_ID, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.print-format.item");
addTypeName(atts, "table");
document.startElement("", "", I_AD_PrintFormatItem.Table_Name, atts);
createPrintFormatItemBinding(ctx, document, m_PrintFormatItem);
document.endElement("", "", I_AD_PrintFormatItem.Table_Name);
@ -168,14 +165,13 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler implem
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp packageExp,
MPackageExpDetail packageExpDetail,
TransformerHandler packOutDocument,
TransformerHandler packageDocument, int recordId) throws Exception {
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
Env.setContext(packout.getCtx(), X_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormatItem_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormatItem_ID);
}
}

View File

@ -23,22 +23,19 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_PrintPaper;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_PrintPaper;
import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class PrintPaperElementHandler extends AbstractElementHandler implements IPackOutHandler {
public class PrintPaperElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element)
throws SAXException {
@ -94,7 +91,7 @@ public class PrintPaperElementHandler extends AbstractElementHandler implements
X_AD_PrintPaper printPaper = new X_AD_PrintPaper(ctx,
AD_PrintPaper_ID, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.print-paper");
addTypeName(atts, "table");
document.startElement("", "", I_AD_PrintPaper.Table_Name, atts);
createPrintPaperBinding(ctx, document, printPaper);
document.endElement("", "", I_AD_PrintPaper.Table_Name);
@ -112,13 +109,12 @@ public class PrintPaperElementHandler extends AbstractElementHandler implements
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp packageExp,
MPackageExpDetail packageExpDetail,
TransformerHandler packOutDocument,
TransformerHandler packageDocument, int recordId) throws Exception {
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
Env.setContext(packout.getCtx(), X_AD_PrintPaper.COLUMNNAME_AD_PrintPaper_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_PrintPaper.COLUMNNAME_AD_PrintPaper_ID);
}
}

View File

@ -22,6 +22,7 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller;
@ -83,7 +84,7 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
int AD_Process_ID = Env.getContextAsInt(ctx, X_AD_Process.COLUMNNAME_AD_Process_ID);
int AD_Role_ID = Env.getContextAsInt(ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.process-access");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Process_Access.Table_Name, atts);
createProcessAccessBinding(ctx, document, AD_Process_ID, AD_Role_ID);
document.endElement("", "", I_AD_Process_Access.Table_Name);
@ -102,4 +103,12 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -24,15 +24,13 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Process;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.Query;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
@ -42,7 +40,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class ProcessElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class ProcessElementHandler extends AbstractElementHandler {
private ProcessParaElementHandler paraHandler = new ProcessParaElementHandler();
@ -117,19 +115,19 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
try {
if (m_Process.isReport() && m_Process.getAD_ReportView_ID() > 0)
{
IPackOutHandler handler = packOut.getHandler("R");
handler.packOut(packOut,null,null,document,null,m_Process.getAD_ReportView_ID());
ElementHandler handler = packOut.getHandler("R");
handler.packOut(packOut,document,null,m_Process.getAD_ReportView_ID());
}
if (m_Process.isReport() && m_Process.getAD_PrintFormat_ID() > 0)
{
IPackOutHandler handler = packOut.getHandler("PFT");
handler.packOut(packOut,null,null,document,null,m_Process.getAD_PrintFormat_ID());
ElementHandler handler = packOut.getHandler("PFT");
handler.packOut(packOut,document,null,m_Process.getAD_PrintFormat_ID());
}
if (m_Process.getAD_Workflow_ID() > 0) {
IPackOutHandler handler = packOut.getHandler("F");
handler.packOut(packOut,null,null,document,null,m_Process.getAD_Workflow_ID());
ElementHandler handler = packOut.getHandler("F");
handler.packOut(packOut,document,null,m_Process.getAD_Workflow_ID());
}
addTypeName(atts, "ad.process");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Process.Table_Name, atts);
createProcessBinding(ctx, document, m_Process);
@ -138,20 +136,20 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
for (X_AD_Process_Para para : paralist) {
if (para.getAD_Reference_ID()>0)
{
IPackOutHandler handler = packOut.getHandler("REF");
handler.packOut(packOut,null,null,document,null,para.getAD_Reference_ID());
ElementHandler handler = packOut.getHandler("REF");
handler.packOut(packOut,document,null,para.getAD_Reference_ID());
}
if (para.getAD_Reference_Value_ID()>0)
{
IPackOutHandler handler = packOut.getHandler("REF");
handler.packOut(packOut,null,null,document,null,para.getAD_Reference_Value_ID());
ElementHandler handler = packOut.getHandler("REF");
handler.packOut(packOut,document,null,para.getAD_Reference_Value_ID());
}
if (para.getAD_Val_Rule_ID() > 0)
{
IPackOutHandler handler = packOut.getHandler("V");
handler.packOut(packOut,null,null,document,null,para.getAD_Val_Rule_ID());
ElementHandler handler = packOut.getHandler("V");
handler.packOut(packOut,document,null,para.getAD_Val_Rule_ID());
}
createProcessPara(ctx, document, para.getAD_Process_Para_ID());
@ -183,14 +181,10 @@ public class ProcessElementHandler extends AbstractElementHandler implements IPa
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Process_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID);
}
}

View File

@ -23,7 +23,7 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -123,15 +123,15 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
if (m_Processpara.getAD_Element_ID() > 0) {
PackOut packOut = getPackOutProcess(ctx);
IPackOutHandler handler = packOut.getHandler("ELE");
ElementHandler handler = packOut.getHandler("ELE");
try {
handler.packOut(packOut,null,null,document,null,m_Processpara.getAD_Element_ID());
handler.packOut(packOut,document,null,m_Processpara.getAD_Element_ID());
} catch (Exception e) {
throw new AdempiereException(e);
}
}
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.process.parameter");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Process_Para.Table_Name, atts);
createProcessParaBinding(ctx, document, m_Processpara);
document.endElement("", "", I_AD_Process_Para.Table_Name);
@ -147,4 +147,12 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
filler.add("AD_Process_Para_ID", new AttributesImpl());
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -27,7 +27,6 @@ import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -35,8 +34,6 @@ import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.DatabaseAccessException;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Reference;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_Ref_List;
@ -47,7 +44,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class ReferenceElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class ReferenceElementHandler extends AbstractElementHandler {
private ReferenceListElementHandler listHandler = new ReferenceListElementHandler();
private ReferenceTableElementHandler tableHandler = new ReferenceTableElementHandler();
@ -123,7 +120,7 @@ public class ReferenceElementHandler extends AbstractElementHandler implements I
X_AD_Reference m_Reference = new X_AD_Reference(ctx, Reference_id, getTrxName(ctx));
addTypeName(atts, "ad.reference");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Reference.Table_Name, atts);
createReferenceBinding(ctx, document, m_Reference);
@ -189,13 +186,10 @@ public class ReferenceElementHandler extends AbstractElementHandler implements I
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Reference_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID);
}
}

View File

@ -108,7 +108,7 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
X_AD_Ref_List m_Ref_List = new X_AD_Ref_List(ctx, AD_Ref_List_ID,
getTrxName(ctx));
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.reference.list");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Ref_List.Table_Name, atts);
createRefListBinding(ctx, document, m_Ref_List);
document.endElement("", "", I_AD_Ref_List.Table_Name);
@ -123,4 +123,12 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -132,7 +132,7 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
int Reference_id = Env.getContextAsInt(ctx,
X_AD_Ref_Table.COLUMNNAME_AD_Reference_ID);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.reference.table");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Ref_Table.Table_Name, atts);
createReferenceTableBinding(ctx, document, Reference_id);
document.endElement("", "", I_AD_Ref_Table.Table_Name);
@ -171,4 +171,12 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
DB.close(rs, pstmt);
}
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -144,7 +144,7 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
X_AD_ReportView_Col m_Reportview_Col = new X_AD_ReportView_Col(ctx,
AD_ReportView_Col_ID, getTrxName(ctx));
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.report-view.column");
addTypeName(atts, "table");
document.startElement("", "", I_AD_ReportView_Col.Table_Name, atts);
createReportViewColBinding(ctx, document, m_Reportview_Col);
document.endElement("", "", I_AD_ReportView_Col.Table_Name);
@ -167,4 +167,12 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -26,15 +26,13 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_ReportView;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_ReportView;
@ -44,7 +42,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class ReportViewElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class ReportViewElementHandler extends AbstractElementHandler {
private ReportViewColElementHandler columnHandler = new ReportViewColElementHandler();
@ -108,14 +106,14 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
X_AD_ReportView m_Reportview = new X_AD_ReportView(ctx, AD_ReportView_ID, getTrxName(ctx));
// Export Table if neccessary
IPackOutHandler tableHandler = packOut.getHandler("T");
ElementHandler tableHandler = packOut.getHandler("T");
try {
tableHandler.packOut(packOut, null, null, document, null,m_Reportview.getAD_Table_ID());
tableHandler.packOut(packOut, document, null, m_Reportview.getAD_Table_ID());
} catch (Exception e) {
throw new AdempiereException(e);
}
addTypeName(atts, "ad.report-view");
addTypeName(atts, "table");
document.startElement("", "", I_AD_ReportView.Table_Name, atts);
createReportViewBinding(ctx, document, m_Reportview);
document.endElement("", "", I_AD_ReportView.Table_Name);
@ -128,8 +126,8 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
rs = pstmt.executeQuery();
while (rs.next()) {
IPackOutHandler pftHandler = packOut.getHandler("PFT");
pftHandler.packOut(packOut, null, null, document, null, rs.getInt(1));
ElementHandler pftHandler = packOut.getHandler("PFT");
pftHandler.packOut(packOut, document, null, rs.getInt(1));
}
} catch (Exception e) {
@ -175,14 +173,10 @@ public class ReportViewElementHandler extends AbstractElementHandler implements
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_ReportView_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_ReportView_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_ReportView_ID);
}
}

View File

@ -26,7 +26,6 @@ import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -35,8 +34,6 @@ import org.adempiere.pipo2.ReferenceUtils;
import org.adempiere.pipo2.exception.DatabaseAccessException;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Role;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.MRole;
import org.compiere.model.X_AD_Form;
import org.compiere.model.X_AD_Package_Exp_Detail;
@ -52,7 +49,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class RoleElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class RoleElementHandler extends AbstractElementHandler {
private List<Integer> roles = new ArrayList<Integer>();
@ -121,7 +118,7 @@ public class RoleElementHandler extends AbstractElementHandler implements IPackO
roles.add(Role_id);
X_AD_Role m_Role = new X_AD_Role(ctx, Role_id, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.role");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Role.Table_Name, atts);
createRoleBinding(ctx, document, m_Role);
@ -330,14 +327,10 @@ public class RoleElementHandler extends AbstractElementHandler implements IPackO
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Role_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Role_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Role_ID);
}
}

View File

@ -26,9 +26,7 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PackOut;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.util.DB;
@ -36,7 +34,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class SQLStatementElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class SQLStatementElementHandler extends AbstractElementHandler {
public void startElement(Properties ctx, Element element) throws SAXException {
String elementValue = element.getElementValue();
@ -95,7 +93,7 @@ public class SQLStatementElementHandler extends AbstractElementHandler implement
String SQLStatement = Env.getContext(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement);
String DBType = Env.getContext(ctx, X_AD_Package_Exp_Detail.COLUMNNAME_DBType);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.sql-statement");
addTypeName(atts, "custom");
document.startElement("","","SQLStatement",atts);
createSQLStatmentBinding(document, SQLStatement, DBType);
document.endElement("","","SQLStatement");
@ -115,11 +113,12 @@ public class SQLStatementElementHandler extends AbstractElementHandler implement
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int field) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int field) throws Exception
{
MPackageExpDetail detail = packout.getPackageExpDetail();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement, detail.getSQLStatement());
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_DBType, detail.getDBType());
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_SQLStatement);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_DBType);
}

View File

@ -26,7 +26,7 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -167,7 +167,7 @@ public class TabElementHandler extends AbstractElementHandler {
int AD_Tab_ID = Env.getContextAsInt(ctx, X_AD_Tab.COLUMNNAME_AD_Tab_ID);
X_AD_Tab m_Tab = new X_AD_Tab (ctx, AD_Tab_ID, getTrxName(ctx));
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.window.tab");
addTypeName(atts, "table");
document.startElement("","",I_AD_Tab.Table_Name,atts);
createTabBinding(ctx,document,m_Tab);
//Fields tags.
@ -198,8 +198,8 @@ public class TabElementHandler extends AbstractElementHandler {
{
try
{
IPackOutHandler handler = packOut.getHandler("P");
handler.packOut(packOut,null,null,document,null,m_Tab.getAD_Process_ID());
ElementHandler handler = packOut.getHandler("P");
handler.packOut(packOut,document,null,m_Tab.getAD_Process_ID());
}
catch(Exception e)
{
@ -226,4 +226,12 @@ public class TabElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -26,7 +26,7 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackIn;
@ -34,8 +34,6 @@ import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Table;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.MTable;
import org.compiere.model.X_AD_Column;
import org.compiere.model.X_AD_Package_Exp_Detail;
@ -46,7 +44,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class TableElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class TableElementHandler extends AbstractElementHandler {
private ColumnElementHandler columnHandler = new ColumnElementHandler();
private List<Integer>tables = new ArrayList<Integer>();
@ -128,7 +126,7 @@ public class TableElementHandler extends AbstractElementHandler implements IPack
//Export table if not already done so
if (!exported){
X_AD_Table m_Table = new X_AD_Table (ctx, AD_Table_ID, null);
addTypeName(atts, "ad.table");
addTypeName(atts, "table");
document.startElement("","",I_AD_Table.Table_Name,atts);
createTableBinding(ctx,document,m_Table);
@ -144,31 +142,31 @@ public class TableElementHandler extends AbstractElementHandler implements IPack
rs = pstmt.executeQuery();
while (rs.next()){
IPackOutHandler handler = packOut.getHandler("ELE");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Column.COLUMNNAME_AD_Element_ID));
ElementHandler handler = packOut.getHandler("ELE");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Column.COLUMNNAME_AD_Element_ID));
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID)>0)
{
handler = packOut.getHandler("REF");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID));
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Reference_ID));
}
if (rs.getInt("AD_Reference_Value_ID")>0)
{
handler = packOut.getHandler("REF");
handler.packOut(packOut,null,null,document,null,rs.getInt("AD_Reference_Value_ID"));
handler.packOut(packOut,document,null,rs.getInt("AD_Reference_Value_ID"));
}
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID)>0)
{
handler = packOut.getHandler("P");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID));
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Process_ID));
}
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID)>0)
{
handler = packOut.getHandler("V");
handler.packOut(packOut,null,null,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID));
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Val_Rule_ID));
}
createColumn(ctx, document, rs.getInt("AD_Column_ID"));
@ -210,14 +208,10 @@ public class TableElementHandler extends AbstractElementHandler implements IPack
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Table_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Table_ID);
}
}

View File

@ -22,6 +22,7 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller;
@ -82,7 +83,7 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
int AD_Task_ID = Env.getContextAsInt(ctx, X_AD_Task.COLUMNNAME_AD_Task_ID);
int AD_Role_ID = Env.getContextAsInt(ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.task-access");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Task_Access.Table_Name, atts);
createTaskAccessBinding(ctx, document, AD_Task_ID, AD_Role_ID);
document.endElement("", "", I_AD_Task_Access.Table_Name);
@ -98,4 +99,12 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -24,15 +24,12 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Task;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.MTask;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_Task;
@ -40,7 +37,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class TaskElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class TaskElementHandler extends AbstractElementHandler {
private List<Integer> tasks = new ArrayList<Integer>();
@ -103,7 +100,7 @@ public class TaskElementHandler extends AbstractElementHandler implements IPackO
tasks.add(AD_Task_ID);
X_AD_Task m_Task = new X_AD_Task(ctx, AD_Task_ID, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.task");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Task.Table_Name, atts);
createTaskBinding(ctx, document, m_Task);
document.endElement("", "", I_AD_Task.Table_Name);
@ -119,11 +116,11 @@ public class TaskElementHandler extends AbstractElementHandler implements IPackO
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
Env.setContext(packout.getCtx(), X_AD_Task.COLUMNNAME_AD_Task_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Task.COLUMNNAME_AD_Task_ID);
}
}

View File

@ -22,6 +22,7 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller;
@ -89,7 +90,7 @@ public class UserRoleElementHandler extends AbstractElementHandler {
int AD_Role_ID = Env.getContextAsInt(ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
int AD_Org_ID = Env.getContextAsInt(ctx, "AD_Org_ID");
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.user-role");
addTypeName(atts, "table");
document.startElement("", "", I_AD_User_Roles.Table_Name, atts);
createUserAssignBinding(ctx, document, AD_User_ID,AD_Role_ID, AD_Org_ID);
document.endElement("", "", I_AD_User_Roles.Table_Name);
@ -105,4 +106,12 @@ public class UserRoleElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -22,6 +22,7 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller;
@ -88,7 +89,7 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
int AD_Window_ID = Env.getContextAsInt(ctx, X_AD_Window.COLUMNNAME_AD_Window_ID);
int AD_Role_ID = Env.getContextAsInt(ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.window-access");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Window_Access.Table_Name, atts);
createWindowAccessBinding(ctx, document, AD_Window_ID, AD_Role_ID);
document.endElement("", "", I_AD_Window_Access.Table_Name);
@ -104,4 +105,12 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -27,7 +27,7 @@ import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
@ -35,8 +35,6 @@ import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.DatabaseAccessException;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Window;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.MWindow;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
@ -48,7 +46,7 @@ import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class WindowElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class WindowElementHandler extends AbstractElementHandler {
private TabElementHandler tabHandler = new TabElementHandler();
private PreferenceElementHandler preferenceHandler = new PreferenceElementHandler();
@ -124,7 +122,7 @@ public class WindowElementHandler extends AbstractElementHandler implements IPac
X_AD_Window m_Window = new X_AD_Window(ctx, AD_Window_ID, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.window");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Window.Table_Name, atts);
createWindowBinding(ctx, document, m_Window);
// Tab Tag
@ -136,8 +134,8 @@ public class WindowElementHandler extends AbstractElementHandler implements IPac
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
rs = pstmt.executeQuery();
while (rs.next()) {
IPackOutHandler handler = packOut.getHandler("T");
handler.packOut(packOut,null,null,document,null,rs.getInt("AD_Table_ID"));
ElementHandler handler = packOut.getHandler("T");
handler.packOut(packOut,document,null,rs.getInt("AD_Table_ID"));
createTab(ctx, document, rs.getInt("AD_Tab_ID"));
}
@ -212,14 +210,10 @@ public class WindowElementHandler extends AbstractElementHandler implements IPac
filler.export(excludes);
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Window_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID);
}
}

View File

@ -22,6 +22,7 @@ import java.util.Properties;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PoFiller;
@ -83,7 +84,7 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
int AD_Workflow_ID = Env.getContextAsInt(ctx, X_AD_Workflow.COLUMNNAME_AD_Workflow_ID);
int AD_Role_ID = Env.getContextAsInt(ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.workflow-access");
addTypeName(atts, "table");
document.startElement("", "", I_AD_Workflow_Access.Table_Name, atts);
createWorkflowAccessBinding(ctx, document, AD_Workflow_ID, AD_Role_ID);
document.endElement("", "", I_AD_Workflow_Access.Table_Name);
@ -100,4 +101,12 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -26,15 +26,12 @@ import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.DBException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.IPackOutHandler;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Workflow;
import org.compiere.model.MPackageExp;
import org.compiere.model.MPackageExpDetail;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_WF_NextCondition;
@ -47,7 +44,7 @@ import org.compiere.wf.MWorkflow;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class WorkflowElementHandler extends AbstractElementHandler implements IPackOutHandler{
public class WorkflowElementHandler extends AbstractElementHandler {
private WorkflowNodeElementHandler nodeHandler = new WorkflowNodeElementHandler();
private WorkflowNodeNextElementHandler nodeNextHandler = new WorkflowNodeNextElementHandler();
@ -245,14 +242,10 @@ public class WorkflowElementHandler extends AbstractElementHandler implements IP
}
public void packOut(PackOut packout, MPackageExp header, MPackageExpDetail detail,TransformerHandler packOutDocument,TransformerHandler packageDocument,int recordId) throws Exception
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
if(recordId <= 0)
recordId = detail.getAD_Workflow_ID();
Env.setContext(packout.getCtx(), X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID, recordId);
this.create(packout.getCtx(), packOutDocument);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().remove(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID);
}
}

View File

@ -129,7 +129,7 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
X_AD_WF_Node m_WF_Node = new X_AD_WF_Node(ctx, AD_WF_Node_ID,
getTrxName(ctx));
addTypeName(atts, "ad.workflow.node");
addTypeName(atts, "table");
document.startElement("", "", I_AD_WF_Node.Table_Name, atts);
createWorkflowNodeBinding(ctx, document, m_WF_Node);
document.endElement("", "", I_AD_WF_Node.Table_Name);
@ -145,4 +145,12 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -167,7 +167,7 @@ public class WorkflowNodeNextConditionElementHandler extends
X_AD_WF_NextCondition m_WF_NodeNextCondition = new X_AD_WF_NextCondition(
ctx, ad_wf_nodenextcondition_id, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.workflow.node.next-condition");
addTypeName(atts, "table");
document.startElement("", "", I_AD_WF_NextCondition.Table_Name, atts);
createWorkflowNodeNextConditionBinding(ctx, document, m_WF_NodeNextCondition);
document.endElement("", "", I_AD_WF_NextCondition.Table_Name);
@ -205,4 +205,12 @@ public class WorkflowNodeNextConditionElementHandler extends
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -144,7 +144,7 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
X_AD_WF_NodeNext m_WF_NodeNext = new X_AD_WF_NodeNext(
ctx, ad_wf_nodenext_id, null);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "ad.workflow.node.next-element");
addTypeName(atts, "table");
document.startElement("", "", I_AD_WF_NodeNext.Table_Name, atts);
createWorkflowNodeNextBinding(ctx, document, m_WF_NodeNext);
document.endElement("", "", I_AD_WF_NodeNext.Table_Name);
@ -163,4 +163,12 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler,
TransformerHandler docHandler,
int recordId) throws Exception {
// TODO Auto-generated method stub
}
}

View File

@ -1,42 +0,0 @@
ad.menu=org.adempiere.pipo2.handler.MenuElementHandler
ad.window=org.adempiere.pipo2.handler.WindowElementHandler
ad.window.access=org.adempiere.pipo2.handler.WindowAccessElementHandler
ad.preference=org.adempiere.pipo2.handler.PreferenceElementHandler
ad.window.tab=org.adempiere.pipo2.handler.TabElementHandler
ad.tab.field=org.adempiere.pipo2.handler.FieldElementHandler
ad.process=org.adempiere.pipo2.handler.ProcessElementHandler
ad.process.parameter=org.adempiere.pipo2.handler.ProcessParaElementHandler
ad.process-access=org.adempiere.pipo2.handler.ProcessAccessElementHandler
ad.message=org.adempiere.pipo2.handler.MessageElementHandler
ad.dynamic-validation=org.adempiere.pipo2.handler.DynValRuleElementHandler
ad.workflow=org.adempiere.pipo2.handler.WorkflowElementHandler
ad.workflow.node=org.adempiere.pipo2.handler.WorkflowNodeElementHandler
ad.workflow.node.next=org.adempiere.pipo2.handler.WorkflowNodeNextElementHandler
ad.workflow.node.next-condition=org.adempiere.pipo2.handler.WorkflowNodeNextConditionElementHandler
ad.workflow-access=org.adempiere.pipo2.handler.WorkflowAccessElementHandler
ad.table=org.adempiere.pipo2.handler.TableElementHandler
ad.table.column=org.adempiere.pipo2.handler.ColumnElementHandler
ad.role=org.adempiere.pipo2.handler.RoleElementHandler
ad.user-role=org.adempiere.pipo2.handler.UserRoleElementHandler
ad.organization-role=org.adempiere.pipo2.handler.OrgRoleElementHandler
ad.form=org.adempiere.pipo2.handler.FormElementHandler
ad.form-access=org.adempiere.pipo2.handler.FormAccessElementHandler
ad.task=org.adempiere.pipo2.handler.TaskElementHandler
ad.task-access=org.adempiere.pipo2.handler.TaskAccessElementHandler
ad.import-format=org.adempiere.pipo2.handler.ImpFormatElementHandler
ad.import-format.row=org.adempiere.pipo2.handler.ImpFormatRowElementHandler
ad.code-snippet=org.adempiere.pipo2.handler.CodeSnipitElementHandler
ad.dist-file=org.adempiere.pipo2.handler.DistFileElementHandler
ad.report-view=org.adempiere.pipo2.handler.ReportViewElementHandler
ad.report-view.column=org.adempiere.pipo2.handler.ReportViewColElementHandler
ad.printformat=org.adempiere.pipo2.handler.PrintFormatElementHandler
ad.printformat.item=org.adempiere.pipo2.handler.PrintFormatItemElementHandler
ad.print-paper=org.adempiere.pipo2.handler.PrintPaperElementHandler
ad.SQLStatement=org.adempiere.pipo2.handler.SQLStatementElementHandler
ad.reference=org.adempiere.pipo2.handler.ReferenceElementHandler
ad.reference.list=org.adempiere.pipo2.handler.ReferenceListElementHandler
ad.reference.table=org.adempiere.pipo2.handler.ReferenceTableElementHandler
ad.fieldgroup=org.adempiere.pipo2.handler.FieldGroupElementHandler
ad.element=org.adempiere.pipo2.handler.AdElementHandler
ad.trl=org.adempiere.pipo2.handler.CommonTranslationHandler
ad.po.generic=org.adempiere.pipo2.handler.GenericPOElementHandler

View File

@ -1,23 +0,0 @@
#Properties files
ad,menu=org.adempiere.pipo2.handler.MenuElementHandler
ad.process=org.adempiere.pipo2.handler.ProcessElementHandler
ad.report-view=org.adempiere.pipo2.handler.ReportViewElementHandler
ad.po.generic=org.adempiere.pipo2.handler.GenericPOElementHandler
ad.table=org.adempiere.pipo2.handler.TableElementHandler
ad.form=org.adempiere.pipo2.handler.FormElementHandler
ad.window=org.adempiere.pipo2.handler.WindowElementHandler
ad.role=org.adempiere.pipo2.handler.RoleElementHandler
ad.SQLStatement=org.adempiere.pipo2.handler.SQLStatementElementHandler
ad.import-format=org.adempiere.pipo2.handler.ImpFormatElementHandler
ad.reference=org.adempiere.pipo2.handler.ReferenceElementHandler
ad.code-snippet=org.adempiere.pipo2.handler.CodeSnippetElementHandler
ad.workflow=org.adempiere.pipo2.handler.WorkflowElementHandler
ad.dynamic-validation=org.adempiere.pipo2.handler.DynValRuleElementHandler
ad.message=org.adempiere.pipo2.handler.MessageElementHandler
ad.printformat=org.adempiere.pipo2.handler.PrintFormatElementHandler
ad.printformat.item=org.adempiere.pipo2.handler.PrintFormatItemElementHandler
ad.print-paper=org.adempiere.pipo2.handler.PrintPaperElementHandler
ad.task=org.adempiere.pipo2.handler.TaskElementHandler
ad.fieldgroup=org.adempiere.pipo2.handler.FieldGroupElementHandler
ad.element=org.adempiere.pipo2.handler.AdElementHandler

View File

@ -0,0 +1,40 @@
AD_Menu=org.adempiere.pipo2.handler.MenuElementHandler
AD_Window=org.adempiere.pipo2.handler.WindowElementHandler
AD_Window_Access=org.adempiere.pipo2.handler.WindowAccessElementHandler
AD_Preference=org.adempiere.pipo2.handler.PreferenceElementHandler
AD_Tab=org.adempiere.pipo2.handler.TabElementHandler
AD_Field=org.adempiere.pipo2.handler.FieldElementHandler
AD_Process=org.adempiere.pipo2.handler.ProcessElementHandler
AD_Process_Para=org.adempiere.pipo2.handler.ProcessParaElementHandler
AD_Process_Access=org.adempiere.pipo2.handler.ProcessAccessElementHandler
AD_Messsage=org.adempiere.pipo2.handler.MessageElementHandler
AD_Val_Rule=org.adempiere.pipo2.handler.DynValRuleElementHandler
AD_Workflow=org.adempiere.pipo2.handler.WorkflowElementHandler
AD_WF_Node=org.adempiere.pipo2.handler.WorkflowNodeElementHandler
AD_WF_NodeNext=org.adempiere.pipo2.handler.WorkflowNodeNextElementHandler
AD_WF_NextCondition=org.adempiere.pipo2.handler.WorkflowNodeNextConditionElementHandler
AD_Workflow_Access=org.adempiere.pipo2.handler.WorkflowAccessElementHandler
AD_Table=org.adempiere.pipo2.handler.TableElementHandler
AD_Column=org.adempiere.pipo2.handler.ColumnElementHandler
AD_Role=org.adempiere.pipo2.handler.RoleElementHandler
AD_User_Roles=org.adempiere.pipo2.handler.UserRoleElementHandler
AD_Role_OrgAccess=org.adempiere.pipo2.handler.OrgRoleElementHandler
AD_Form=org.adempiere.pipo2.handler.FormElementHandler
AD_Form_Access=org.adempiere.pipo2.handler.FormAccessElementHandler
AD_Task=org.adempiere.pipo2.handler.TaskElementHandler
AD_Task_Access=org.adempiere.pipo2.handler.TaskAccessElementHandler
AD_ImpFormat=org.adempiere.pipo2.handler.ImpFormatElementHandler
AD_ImpFormat_Row=org.adempiere.pipo2.handler.ImpFormatRowElementHandler
Code_Snippet=org.adempiere.pipo2.handler.CodeSnipitElementHandler
Dist_File=org.adempiere.pipo2.handler.DistFileElementHandler
AD_ReportView=org.adempiere.pipo2.handler.ReportViewElementHandler
AD_ReportView_Col=org.adempiere.pipo2.handler.ReportViewColElementHandler
AD_PrintFormat=org.adempiere.pipo2.handler.PrintFormatElementHandler
AD_PrintFormatItem=org.adempiere.pipo2.handler.PrintFormatItemElementHandler
AD_PrintPaper=org.adempiere.pipo2.handler.PrintPaperElementHandler
SQLStatement=org.adempiere.pipo2.handler.SQLStatementElementHandler
AD_Reference=org.adempiere.pipo2.handler.ReferenceElementHandler
AD_Ref_List=org.adempiere.pipo2.handler.ReferenceListElementHandler
AD_Ref_Table=org.adempiere.pipo2.handler.ReferenceTableElementHandler
AD_FieldGroup=org.adempiere.pipo2.handler.FieldGroupElementHandler
AD_Element=org.adempiere.pipo2.handler.AdElementHandler