IDEMPIERE-2648 implement pack-in pack-out handle for infoWindow

This commit is contained in:
Carlos Ruiz 2018-11-12 15:29:22 -02:00
parent f1b23aa97f
commit a7d4a7d690
14 changed files with 1015 additions and 10 deletions

View File

@ -0,0 +1,67 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-2648 implement pack-in pack-out handle for infoWindow
-- Nov 12, 2018, 2:11:41 PM BRST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType,IsHtml) VALUES (213804,0,'Info Window','Info and search/select Window','The Info window is used to search and select records as well as display information relevant to the selection.',50006,'AD_InfoWindow_ID',10,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_DATE('2018-11-12 14:11:40','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-11-12 14:11:40','YYYY-MM-DD HH24:MI:SS'),100,3068,'N','N','D','N','N','N','Y','6b52cd03-c9ae-4b0e-b24f-45323a7ed42d','Y',0,'N','N','C','N')
;
-- Nov 12, 2018, 2:12:32 PM BRST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_DATE('2018-11-12 14:12:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213804
;
-- Nov 12, 2018, 2:12:35 PM BRST
UPDATE AD_Column SET FKConstraintName='ADInfoWindow_ADPackageExpDetai', FKConstraintType='N',Updated=TO_DATE('2018-11-12 14:12:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213804
;
-- Nov 12, 2018, 2:12:35 PM BRST
ALTER TABLE AD_Package_Exp_Detail ADD AD_InfoWindow_ID NUMBER(10) DEFAULT NULL
;
-- Nov 12, 2018, 2:12:35 PM BRST
ALTER TABLE AD_Package_Exp_Detail ADD CONSTRAINT ADInfoWindow_ADPackageExpDetai FOREIGN KEY (AD_InfoWindow_ID) REFERENCES ad_infowindow(ad_infowindow_id) DEFERRABLE INITIALLY DEFERRED
;
-- Nov 12, 2018, 2:14:03 PM BRST
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200445,'Info Window',50004,'IW',0,0,'Y',TO_DATE('2018-11-12 14:14:02','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-11-12 14:14:02','YYYY-MM-DD HH24:MI:SS'),100,'D','c1e5ee93-987c-43cd-90e9-e4cf5d592105')
;
-- Nov 12, 2018, 2:15:14 PM BRST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (205861,'Info Window','Info and search/select Window','The Info window is used to search and select records as well as display information relevant to the selection.',50006,213804,'Y',10,330,'N','N','N','N',0,0,'Y',TO_DATE('2018-11-12 14:15:13','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2018-11-12 14:15:13','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','9cbe0104-e976-411a-9aa3-d35798c57519','Y',330,2)
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53284
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57418
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_DATE('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205861
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50116
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50117
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204547
;
-- Nov 12, 2018, 2:16:29 PM BRST
UPDATE AD_Field SET DisplayLogic='@Type@=''IW''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2018-11-12 14:16:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205861
;
-- Nov 12, 2018 2:49:09 PM BRST
UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_DATE('2018-11-12 14:49:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213804
;
SELECT register_migration_script('201811121420_IDEMPIERE-2648.sql') FROM dual
;

View File

@ -0,0 +1,64 @@
-- IDEMPIERE-2648 implement pack-in pack-out handle for infoWindow
-- Nov 12, 2018, 2:11:41 PM BRST
INSERT INTO AD_Column (AD_Column_ID,Version,Name,Description,Help,AD_Table_ID,ColumnName,FieldLength,IsKey,IsParent,IsMandatory,IsTranslated,IsIdentifier,SeqNo,IsEncrypted,AD_Reference_ID,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,AD_Element_ID,IsUpdateable,IsSelectionColumn,EntityType,IsSyncDatabase,IsAlwaysUpdateable,IsAutocomplete,IsAllowLogging,AD_Column_UU,IsAllowCopy,SeqNoSelection,IsToolbarButton,IsSecure,FKConstraintType) VALUES (213804,0,'Info Window','Info and search/select Window','The Info window is used to search and select records as well as display information relevant to the selection.',50006,'AD_InfoWindow_ID',10,'N','N','N','N','N',0,'N',19,0,0,'Y',TO_TIMESTAMP('2018-11-12 14:11:40','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-11-12 14:11:40','YYYY-MM-DD HH24:MI:SS'),100,3068,'N','N','D','N','N','N','Y','6b52cd03-c9ae-4b0e-b24f-45323a7ed42d','Y',0,'N','N','C')
;
-- Nov 12, 2018, 2:12:32 PM BRST
UPDATE AD_Column SET FKConstraintType='N',Updated=TO_TIMESTAMP('2018-11-12 14:12:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213804
;
-- Nov 12, 2018, 2:12:35 PM BRST
UPDATE AD_Column SET FKConstraintName='ADInfoWindow_ADPackageExpDetai', FKConstraintType='N',Updated=TO_TIMESTAMP('2018-11-12 14:12:35','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213804
;
-- Nov 12, 2018, 2:12:35 PM BRST
ALTER TABLE AD_Package_Exp_Detail ADD COLUMN AD_InfoWindow_ID NUMERIC(10) DEFAULT NULL
;
-- Nov 12, 2018, 2:12:35 PM BRST
ALTER TABLE AD_Package_Exp_Detail ADD CONSTRAINT ADInfoWindow_ADPackageExpDetai FOREIGN KEY (AD_InfoWindow_ID) REFERENCES ad_infowindow(ad_infowindow_id) DEFERRABLE INITIALLY DEFERRED
;
-- Nov 12, 2018, 2:14:03 PM BRST
INSERT INTO AD_Ref_List (AD_Ref_List_ID,Name,AD_Reference_ID,Value,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,EntityType,AD_Ref_List_UU) VALUES (200445,'Info Window',50004,'IW',0,0,'Y',TO_TIMESTAMP('2018-11-12 14:14:02','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-11-12 14:14:02','YYYY-MM-DD HH24:MI:SS'),100,'D','c1e5ee93-987c-43cd-90e9-e4cf5d592105')
;
-- Nov 12, 2018, 2:15:14 PM BRST
INSERT INTO AD_Field (AD_Field_ID,Name,Description,Help,AD_Tab_ID,AD_Column_ID,IsDisplayed,DisplayLength,SeqNo,IsSameLine,IsHeading,IsFieldOnly,IsEncrypted,AD_Client_ID,AD_Org_ID,IsActive,Created,CreatedBy,Updated,UpdatedBy,IsReadOnly,IsCentrallyMaintained,EntityType,AD_Field_UU,IsDisplayedGrid,SeqNoGrid,ColumnSpan) VALUES (205861,'Info Window','Info and search/select Window','The Info window is used to search and select records as well as display information relevant to the selection.',50006,213804,'Y',10,330,'N','N','N','N',0,0,'Y',TO_TIMESTAMP('2018-11-12 14:15:13','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2018-11-12 14:15:13','YYYY-MM-DD HH24:MI:SS'),100,'N','Y','D','9cbe0104-e976-411a-9aa3-d35798c57519','Y',330,2)
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=290, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=53284
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=300, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=57418
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET IsDisplayed='Y', SeqNo=310, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, XPosition=1, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205861
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET SeqNo=320, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50116
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET SeqNo=330, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50117
;
-- Nov 12, 2018, 2:15:57 PM BRST
UPDATE AD_Field SET SeqNo=0, AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-11-12 14:15:57','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=204547
;
-- Nov 12, 2018, 2:16:29 PM BRST
UPDATE AD_Field SET DisplayLogic='@Type@=''IW''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2018-11-12 14:16:29','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=205861
;
-- Nov 12, 2018 2:49:09 PM BRST
UPDATE AD_Column SET IsUpdateable='Y',Updated=TO_TIMESTAMP('2018-11-12 14:49:09','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Column_ID=213804
;
SELECT register_migration_script('201811121420_IDEMPIERE-2648.sql') FROM dual
;

View File

@ -90,6 +90,21 @@ public interface I_AD_Package_Exp_Detail
public org.compiere.model.I_AD_ImpFormat getAD_ImpFormat() throws RuntimeException;
/** Column name AD_InfoWindow_ID */
public static final String COLUMNNAME_AD_InfoWindow_ID = "AD_InfoWindow_ID";
/** Set Info Window.
* Info and search/select Window
*/
public void setAD_InfoWindow_ID (int AD_InfoWindow_ID);
/** Get Info Window.
* Info and search/select Window
*/
public int getAD_InfoWindow_ID();
public org.compiere.model.I_AD_InfoWindow getAD_InfoWindow() throws RuntimeException;
/** Column name AD_Menu_ID */
public static final String COLUMNNAME_AD_Menu_ID = "AD_Menu_ID";

View File

@ -119,6 +119,8 @@ public class MPackageExpDetail extends X_AD_Package_Exp_Detail
return getAD_Workflow_ID();
} else if (TYPE_EntityType.equals(type)) {
return getAD_EntityType_ID();
} else if (TYPE_InfoWindow.equals(type)) {
return getAD_InfoWindow_ID();
} else {
return 0;
}

View File

@ -30,7 +30,7 @@ public class X_AD_Package_Exp_Detail extends PO implements I_AD_Package_Exp_Deta
/**
*
*/
private static final long serialVersionUID = 20181104L;
private static final long serialVersionUID = 20181112L;
/** Standard Constructor */
public X_AD_Package_Exp_Detail (Properties ctx, int AD_Package_Exp_Detail_ID, String trxName)
@ -154,6 +154,34 @@ public class X_AD_Package_Exp_Detail extends PO implements I_AD_Package_Exp_Deta
return ii.intValue();
}
public org.compiere.model.I_AD_InfoWindow getAD_InfoWindow() throws RuntimeException
{
return (org.compiere.model.I_AD_InfoWindow)MTable.get(getCtx(), org.compiere.model.I_AD_InfoWindow.Table_Name)
.getPO(getAD_InfoWindow_ID(), get_TrxName()); }
/** Set Info Window.
@param AD_InfoWindow_ID
Info and search/select Window
*/
public void setAD_InfoWindow_ID (int AD_InfoWindow_ID)
{
if (AD_InfoWindow_ID < 1)
set_ValueNoCheck (COLUMNNAME_AD_InfoWindow_ID, null);
else
set_ValueNoCheck (COLUMNNAME_AD_InfoWindow_ID, Integer.valueOf(AD_InfoWindow_ID));
}
/** Get Info Window.
@return Info and search/select Window
*/
public int getAD_InfoWindow_ID ()
{
Integer ii = (Integer)get_Value(COLUMNNAME_AD_InfoWindow_ID);
if (ii == null)
return 0;
return ii.intValue();
}
public org.compiere.model.I_AD_Menu getAD_Menu() throws RuntimeException
{
return (org.compiere.model.I_AD_Menu)MTable.get(getCtx(), org.compiere.model.I_AD_Menu.Table_Name)
@ -915,6 +943,8 @@ public class X_AD_Package_Exp_Detail extends PO implements I_AD_Package_Exp_Deta
public static final String TYPE_EntityType = "ET";
/** SQL Mandatory = SQM */
public static final String TYPE_SQLMandatory = "SQM";
/** Info Window = IW */
public static final String TYPE_InfoWindow = "IW";
/** Set Type.
@param Type
Type of Validation (SQL, Java Script, Java Language)

View File

@ -207,7 +207,27 @@
<handler
class="org.adempiere.pipo2.handler.ViewColumnElementHandler"
id="AD_ViewColumn">
</handler>
</handler>
<handler
class="org.adempiere.pipo2.handler.InfoWindowElementHandler"
id="AD_InfoWindow">
</handler>
<handler
class="org.adempiere.pipo2.handler.InfoColumnElementHandler"
id="AD_InfoColumn ">
</handler>
<handler
class="org.adempiere.pipo2.handler.InfoProcessElementHandler"
id="AD_InfoProcess ">
</handler>
<handler
class="org.adempiere.pipo2.handler.InfoRelatedElementHandler"
id="AD_InfoRelated ">
</handler>
<handler
class="org.adempiere.pipo2.handler.InfoWindowAccessElementHandler"
id="AD_InfoWindow_Access">
</handler>
</extension>
</plugin>

View File

@ -0,0 +1,155 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz (globalqss) - sponsored by FH *
**********************************************************************/
package org.adempiere.pipo2.handler;
import java.util.List;
import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Element;
import org.compiere.model.I_AD_InfoColumn;
import org.compiere.model.I_AD_InfoWindow;
import org.compiere.model.X_AD_InfoColumn;
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 InfoColumnElementHandler extends AbstractElementHandler {
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_InfoColumn.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
if (isParentDefer(element, I_AD_InfoWindow.Table_Name)) {
element.defer = true;
return;
}
X_AD_InfoColumn mInfoColumn = findPO(ctx, element);
if (mInfoColumn == null) {
mInfoColumn = new X_AD_InfoColumn(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mInfoColumn, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
element.recordId = mInfoColumn.get_ID();
if (mInfoColumn.is_new() || mInfoColumn.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_InfoColumn.Table_Name, X_AD_InfoColumn.Table_ID);
String action = null;
if (!mInfoColumn.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_InfoColumn.Table_Name, mInfoColumn);
action = "Update";
} else {
action = "New";
}
if (mInfoColumn.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mInfoColumn.getColumnName(), mInfoColumn.get_ID(), action);
element.recordId = mInfoColumn.get_ID();
} else {
logImportDetail(ctx, impDetail, 0, mInfoColumn.getColumnName(), mInfoColumn.get_ID(), action);
throw new POSaveFailedException("Failed to save InfoColumn " + mInfoColumn.getColumnName());
}
}
} else {
element.skip = true;
}
}
public void endElement(PIPOContext ctx, Element element) throws SAXException {
}
public void create(PIPOContext ctx, TransformerHandler document) throws SAXException {
int AD_InfoColumn_ID = Env.getContextAsInt(ctx.ctx, X_AD_InfoColumn.COLUMNNAME_AD_InfoColumn_ID);
if (ctx.packOut.isExported(X_AD_InfoColumn.COLUMNNAME_AD_InfoColumn_ID+"|"+AD_InfoColumn_ID))
return;
X_AD_InfoColumn m_InfoColumn = new X_AD_InfoColumn(ctx.ctx, AD_InfoColumn_ID, getTrxName(ctx));
if (m_InfoColumn.getAD_Element_ID() > 0) {
PackOut packOut = ctx.packOut;
ElementHandler handler = packOut.getHandler(I_AD_Element.Table_Name);
try {
handler.packOut(packOut,document,null,m_InfoColumn.getAD_Element_ID());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
if (!isPackOutElement(ctx, m_InfoColumn))
return;
verifyPackOutRequirement(m_InfoColumn);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "table");
document.startElement("", "", I_AD_InfoColumn.Table_Name, atts);
createInfoColumnBinding(ctx, document, m_InfoColumn);
PackOut packOut = ctx.packOut;
packOut.getCtx().ctx.put("Table_Name",I_AD_InfoColumn.Table_Name);
try {
new CommonTranslationHandler().packOut(packOut,document,null,m_InfoColumn.get_ID());
} catch(Exception e) {
if (log.isLoggable(Level.INFO)) log.info(e.toString());
}
document.endElement("", "", I_AD_InfoColumn.Table_Name);
}
private void createInfoColumnBinding(PIPOContext ctx, TransformerHandler document, X_AD_InfoColumn m_InfoColumn) {
PoExporter filler = new PoExporter(ctx, document, m_InfoColumn);
List<String> excludes = defaultExcludeList(X_AD_InfoColumn.Table_Name);
if (m_InfoColumn.getAD_InfoColumn_ID() <= PackOut.MAX_OFFICIAL_ID)
filler.add("AD_InfoColumn_ID", new AttributesImpl());
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) throws Exception {
Env.setContext(packout.getCtx().ctx, I_AD_InfoColumn.COLUMNNAME_AD_InfoColumn_ID, recordId);
create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(I_AD_InfoColumn.COLUMNNAME_AD_InfoColumn_ID);
}
}

View File

@ -0,0 +1,143 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz (globalqss) - sponsored by FH *
**********************************************************************/
package org.adempiere.pipo2.handler;
import java.util.List;
import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_InfoProcess;
import org.compiere.model.I_AD_InfoWindow;
import org.compiere.model.X_AD_InfoProcess;
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 InfoProcessElementHandler extends AbstractElementHandler {
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_InfoProcess.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
if (isParentDefer(element, I_AD_InfoWindow.Table_Name)) {
element.defer = true;
return;
}
X_AD_InfoProcess mInfoProcess = findPO(ctx, element);
if (mInfoProcess == null) {
mInfoProcess = new X_AD_InfoProcess(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mInfoProcess, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
element.recordId = mInfoProcess.get_ID();
if (mInfoProcess.is_new() || mInfoProcess.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_InfoProcess.Table_Name, X_AD_InfoProcess.Table_ID);
String action = null;
if (!mInfoProcess.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_InfoProcess.Table_Name, mInfoProcess);
action = "Update";
} else {
action = "New";
}
if (mInfoProcess.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mInfoProcess.toString(), mInfoProcess.get_ID(), action);
element.recordId = mInfoProcess.get_ID();
} else {
logImportDetail(ctx, impDetail, 0, mInfoProcess.toString(), mInfoProcess.get_ID(), action);
throw new POSaveFailedException("Failed to save InfoProcess " + mInfoProcess.toString());
}
}
} else {
element.skip = true;
}
}
public void endElement(PIPOContext ctx, Element element) throws SAXException {
}
public void create(PIPOContext ctx, TransformerHandler document) throws SAXException {
int AD_InfoProcess_ID = Env.getContextAsInt(ctx.ctx, X_AD_InfoProcess.COLUMNNAME_AD_InfoProcess_ID);
if (ctx.packOut.isExported(X_AD_InfoProcess.COLUMNNAME_AD_InfoProcess_ID+"|"+AD_InfoProcess_ID))
return;
X_AD_InfoProcess m_InfoProcess = new X_AD_InfoProcess(ctx.ctx, AD_InfoProcess_ID, getTrxName(ctx));
if (!isPackOutElement(ctx, m_InfoProcess))
return;
verifyPackOutRequirement(m_InfoProcess);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "table");
document.startElement("", "", I_AD_InfoProcess.Table_Name, atts);
createInfoProcessBinding(ctx, document, m_InfoProcess);
PackOut packOut = ctx.packOut;
packOut.getCtx().ctx.put("Table_Name",I_AD_InfoProcess.Table_Name);
try {
new CommonTranslationHandler().packOut(packOut,document,null,m_InfoProcess.get_ID());
} catch(Exception e) {
if (log.isLoggable(Level.INFO)) log.info(e.toString());
}
document.endElement("", "", I_AD_InfoProcess.Table_Name);
}
private void createInfoProcessBinding(PIPOContext ctx, TransformerHandler document, X_AD_InfoProcess m_InfoProcess) {
PoExporter filler = new PoExporter(ctx, document, m_InfoProcess);
List<String> excludes = defaultExcludeList(X_AD_InfoProcess.Table_Name);
if (m_InfoProcess.getAD_InfoProcess_ID() <= PackOut.MAX_OFFICIAL_ID)
filler.add("AD_InfoProcess_ID", new AttributesImpl());
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) throws Exception {
Env.setContext(packout.getCtx().ctx, I_AD_InfoProcess.COLUMNNAME_AD_InfoProcess_ID, recordId);
create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(I_AD_InfoProcess.COLUMNNAME_AD_InfoProcess_ID);
}
}

View File

@ -0,0 +1,143 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz (globalqss) - sponsored by FH *
**********************************************************************/
package org.adempiere.pipo2.handler;
import java.util.List;
import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_InfoRelated;
import org.compiere.model.I_AD_InfoWindow;
import org.compiere.model.X_AD_InfoRelated;
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 InfoRelatedElementHandler extends AbstractElementHandler {
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_InfoRelated.Table_Name);
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
if (isParentDefer(element, I_AD_InfoWindow.Table_Name)) {
element.defer = true;
return;
}
X_AD_InfoRelated mInfoRelated = findPO(ctx, element);
if (mInfoRelated == null) {
mInfoRelated = new X_AD_InfoRelated(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mInfoRelated, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
element.recordId = mInfoRelated.get_ID();
if (mInfoRelated.is_new() || mInfoRelated.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_InfoRelated.Table_Name, X_AD_InfoRelated.Table_ID);
String action = null;
if (!mInfoRelated.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_InfoRelated.Table_Name, mInfoRelated);
action = "Update";
} else {
action = "New";
}
if (mInfoRelated.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mInfoRelated.toString(), mInfoRelated.get_ID(), action);
element.recordId = mInfoRelated.get_ID();
} else {
logImportDetail(ctx, impDetail, 0, mInfoRelated.toString(), mInfoRelated.get_ID(), action);
throw new POSaveFailedException("Failed to save InfoRelated " + mInfoRelated.toString());
}
}
} else {
element.skip = true;
}
}
public void endElement(PIPOContext ctx, Element element) throws SAXException {
}
public void create(PIPOContext ctx, TransformerHandler document) throws SAXException {
int AD_InfoRelated_ID = Env.getContextAsInt(ctx.ctx, X_AD_InfoRelated.COLUMNNAME_AD_InfoRelated_ID);
if (ctx.packOut.isExported(X_AD_InfoRelated.COLUMNNAME_AD_InfoRelated_ID+"|"+AD_InfoRelated_ID))
return;
X_AD_InfoRelated m_InfoRelated = new X_AD_InfoRelated(ctx.ctx, AD_InfoRelated_ID, getTrxName(ctx));
if (!isPackOutElement(ctx, m_InfoRelated))
return;
verifyPackOutRequirement(m_InfoRelated);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "table");
document.startElement("", "", I_AD_InfoRelated.Table_Name, atts);
createInfoRelatedBinding(ctx, document, m_InfoRelated);
PackOut packOut = ctx.packOut;
packOut.getCtx().ctx.put("Table_Name",I_AD_InfoRelated.Table_Name);
try {
new CommonTranslationHandler().packOut(packOut,document,null,m_InfoRelated.get_ID());
} catch(Exception e) {
if (log.isLoggable(Level.INFO)) log.info(e.toString());
}
document.endElement("", "", I_AD_InfoRelated.Table_Name);
}
private void createInfoRelatedBinding(PIPOContext ctx, TransformerHandler document, X_AD_InfoRelated m_InfoRelated) {
PoExporter filler = new PoExporter(ctx, document, m_InfoRelated);
List<String> excludes = defaultExcludeList(X_AD_InfoRelated.Table_Name);
if (m_InfoRelated.getAD_InfoRelated_ID() <= PackOut.MAX_OFFICIAL_ID)
filler.add("AD_InfoRelated_ID", new AttributesImpl());
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) throws Exception {
Env.setContext(packout.getCtx().ctx, I_AD_InfoRelated.COLUMNNAME_AD_InfoRelated_ID, recordId);
create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove(I_AD_InfoRelated.COLUMNNAME_AD_InfoRelated_ID);
}
}

View File

@ -0,0 +1,96 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz (globalqss) - sponsored by FH *
**********************************************************************/
package org.adempiere.pipo2.handler;
import java.util.List;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.PoFiller;
import org.compiere.model.I_AD_InfoWindow_Access;
import org.compiere.model.Query;
import org.compiere.model.X_AD_InfoWindow;
import org.compiere.model.X_AD_InfoWindow_Access;
import org.compiere.model.X_AD_Role;
import org.compiere.util.Env;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.AttributesImpl;
public class InfoWindowAccessElementHandler extends AbstractElementHandler {
public void startElement(PIPOContext ctx, Element element) throws SAXException {
List<String> excludes = defaultExcludeList(X_AD_InfoWindow_Access.Table_Name);
X_AD_InfoWindow_Access po = findPO(ctx, element);
if (po == null) {
po = new X_AD_InfoWindow_Access(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, po, element, this);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
po.saveEx();
}
public void endElement(PIPOContext ctx, Element element) throws SAXException {
}
public void create(PIPOContext ctx, TransformerHandler document) throws SAXException {
int AD_InfoWindow_ID = Env.getContextAsInt(ctx.ctx, X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID);
int AD_Role_ID = Env.getContextAsInt(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID);
Query query = new Query(ctx.ctx, "AD_InfoWindow_Access", "AD_Role_ID=? AND AD_InfoWindow_ID=?", getTrxName(ctx));
X_AD_InfoWindow_Access po = query.setParameters(AD_Role_ID, AD_InfoWindow_ID).first();
if (po != null) {
if (!isPackOutElement(ctx, po))
return;
verifyPackOutRequirement(po);
AttributesImpl atts = new AttributesImpl();
addTypeName(atts, "table");
document.startElement("", "", I_AD_InfoWindow_Access.Table_Name, atts);
createInfoWindowAccessBinding(ctx, document, po);
document.endElement("", "", I_AD_InfoWindow_Access.Table_Name);
}
}
private void createInfoWindowAccessBinding(PIPOContext ctx, TransformerHandler document, X_AD_InfoWindow_Access po) {
PoExporter filler = new PoExporter(ctx, document, po);
List<String> excludes = defaultExcludeList(X_AD_InfoWindow_Access.Table_Name);
filler.export(excludes);
}
@Override
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler, int recordId) throws Exception {
create(packout.getCtx(), packoutHandler);
}
}

View File

@ -0,0 +1,226 @@
/***********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* This program is distributed in the hope that it will be useful, *
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
* GNU General Public License for more details. *
* *
* You should have received a copy of the GNU General Public License *
* along with this program; if not, write to the Free Software *
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Carlos Ruiz (globalqss) - sponsored by FH *
**********************************************************************/
package org.adempiere.pipo2.handler;
import java.util.List;
import java.util.logging.Level;
import javax.xml.transform.sax.TransformerHandler;
import org.adempiere.exceptions.AdempiereException;
import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoExporter;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_InfoWindow;
import org.compiere.model.I_AD_Process;
import org.compiere.model.I_AD_Reference;
import org.compiere.model.I_AD_Table;
import org.compiere.model.I_AD_Val_Rule;
import org.compiere.model.Query;
import org.compiere.model.X_AD_InfoColumn;
import org.compiere.model.X_AD_InfoProcess;
import org.compiere.model.X_AD_InfoRelated;
import org.compiere.model.X_AD_InfoWindow;
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 InfoWindowElementHandler extends AbstractElementHandler {
private InfoColumnElementHandler infoColumnHandler = new InfoColumnElementHandler();
private InfoProcessElementHandler infoProcessHandler = new InfoProcessElementHandler();
private InfoRelatedElementHandler infoRelatedHandler = new InfoRelatedElementHandler();
public void startElement(PIPOContext ctx, Element element) throws SAXException {
String entitytype = getStringValue(element, "EntityType");
if (isProcessElement(ctx.ctx, entitytype)) {
X_AD_InfoWindow mInfoWindow = findPO(ctx, element);
if (mInfoWindow == null) {
mInfoWindow = new X_AD_InfoWindow(ctx.ctx, 0, getTrxName(ctx));
}
PoFiller filler = new PoFiller(ctx, mInfoWindow, element, this);
List<String> excludes = defaultExcludeList(X_AD_InfoWindow.Table_Name);
List<String> notfounds = filler.autoFill(excludes);
if (notfounds.size() > 0) {
element.defer = true;
element.unresolved = notfounds.toString();
return;
}
element.recordId = mInfoWindow.get_ID();
if (mInfoWindow.is_new() || mInfoWindow.is_Changed()) {
X_AD_Package_Imp_Detail impDetail = createImportDetail(ctx, element.qName, X_AD_InfoWindow.Table_Name, X_AD_InfoWindow.Table_ID);
String action = null;
if (!mInfoWindow.is_new()) {
backupRecord(ctx, impDetail.getAD_Package_Imp_Detail_ID(), X_AD_InfoWindow.Table_Name, mInfoWindow);
action = "Update";
} else {
action = "New";
}
if (mInfoWindow.save(getTrxName(ctx)) == true) {
logImportDetail(ctx, impDetail, 1, mInfoWindow.getName(), mInfoWindow.get_ID(), action);
element.recordId = mInfoWindow.get_ID();
element.requireRoleAccessUpdate = true;
} else {
logImportDetail(ctx, impDetail, 0, mInfoWindow.getName(), mInfoWindow.get_ID(), action);
throw new POSaveFailedException("Failed to save InfoWindow " + mInfoWindow.getName());
}
}
} else {
element.skip = true;
}
}
public void endElement(PIPOContext ctx, Element element) throws SAXException {
}
public void create(PIPOContext ctx, TransformerHandler document) throws SAXException {
int AD_InfoWindow_ID = Env.getContextAsInt(ctx.ctx, "AD_InfoWindow_ID");
if (ctx.packOut.isExported("AD_InfoWindow_ID"+"|"+AD_InfoWindow_ID))
return;
PackOut packOut = ctx.packOut;
X_AD_InfoWindow m_InfoWindow = new X_AD_InfoWindow(ctx.ctx, AD_InfoWindow_ID, getTrxName(ctx));
AttributesImpl atts = new AttributesImpl();
try {
if (m_InfoWindow.getAD_Table_ID() > 0) {
ElementHandler handler = packOut.getHandler(I_AD_Table.Table_Name);
handler.packOut(packOut,document,null,m_InfoWindow.getAD_Table_ID());
}
boolean createElement = isPackOutElement(ctx, m_InfoWindow);
if (createElement) {
verifyPackOutRequirement(m_InfoWindow);
addTypeName(atts, "table");
document.startElement("", "", I_AD_InfoWindow.Table_Name, atts);
createInfoWindowBinding(ctx, document, m_InfoWindow);
packOut.getCtx().ctx.put("Table_Name",I_AD_InfoWindow.Table_Name);
try {
new CommonTranslationHandler().packOut(packOut,document,null,m_InfoWindow.get_ID());
} catch(Exception e) {
if (log.isLoggable(Level.INFO)) log.info(e.toString());
}
}
Query queryCols = new Query(ctx.ctx, "AD_InfoColumn", "AD_InfoWindow_ID = ?", getTrxName(ctx));
List<X_AD_InfoColumn> infoColumnlist = queryCols.setParameters(AD_InfoWindow_ID).list();
for (X_AD_InfoColumn infoColumn : infoColumnlist) {
if (infoColumn.getAD_Reference_ID()>0)
{
ElementHandler handler = packOut.getHandler(I_AD_Reference.Table_Name);
handler.packOut(packOut,document,null,infoColumn.getAD_Reference_ID());
}
if (infoColumn.getAD_Reference_Value_ID()>0)
{
ElementHandler handler = packOut.getHandler(I_AD_Reference.Table_Name);
handler.packOut(packOut,document,null,infoColumn.getAD_Reference_Value_ID());
}
if (infoColumn.getAD_Val_Rule_ID() > 0)
{
ElementHandler handler = packOut.getHandler(I_AD_Val_Rule.Table_Name);
handler.packOut(packOut,document,null,infoColumn.getAD_Val_Rule_ID());
}
createInfoColumn(ctx, document, infoColumn.getAD_InfoColumn_ID());
}
Query queryProc= new Query(ctx.ctx, "AD_InfoProcess", "AD_InfoWindow_ID = ?", getTrxName(ctx));
List<X_AD_InfoProcess> infoProcesslist = queryProc.setParameters(AD_InfoWindow_ID).list();
for (X_AD_InfoProcess infoProcess : infoProcesslist) {
if (infoProcess.getAD_Process_ID()>0)
{
ElementHandler handler = packOut.getHandler(I_AD_Process.Table_Name);
handler.packOut(packOut,document,null,infoProcess.getAD_Process_ID());
}
createInfoProcess(ctx, document, infoProcess.getAD_InfoColumn_ID());
}
Query queryRel= new Query(ctx.ctx, "AD_InfoRelated", "AD_InfoWindow_ID = ?", getTrxName(ctx));
List<X_AD_InfoRelated> infoRelatedlist = queryRel.setParameters(AD_InfoWindow_ID).list();
for (X_AD_InfoRelated infoRelated : infoRelatedlist) {
createInfoRelated(ctx, document, infoRelated.getAD_InfoRelated_ID());
}
if (createElement) {
document.endElement("", "", X_AD_InfoWindow.Table_Name);
}
} catch (Exception e) {
throw new AdempiereException(e);
}
}
private void createInfoColumn(PIPOContext ctx, TransformerHandler document, int AD_InfoColumn_ID) throws SAXException {
Env.setContext(ctx.ctx, X_AD_InfoColumn.COLUMNNAME_AD_InfoColumn_ID, AD_InfoColumn_ID);
infoColumnHandler.create(ctx, document);
ctx.ctx.remove(X_AD_InfoColumn.COLUMNNAME_AD_InfoColumn_ID);
}
private void createInfoProcess(PIPOContext ctx, TransformerHandler document, int AD_InfoProcess_ID) throws SAXException {
Env.setContext(ctx.ctx, X_AD_InfoProcess.COLUMNNAME_AD_InfoProcess_ID, AD_InfoProcess_ID);
infoProcessHandler.create(ctx, document);
ctx.ctx.remove(X_AD_InfoProcess.COLUMNNAME_AD_InfoProcess_ID);
}
private void createInfoRelated(PIPOContext ctx, TransformerHandler document, int AD_InfoRelated_ID) throws SAXException {
Env.setContext(ctx.ctx, X_AD_InfoRelated.COLUMNNAME_AD_InfoRelated_ID, AD_InfoRelated_ID);
infoRelatedHandler.create(ctx, document);
ctx.ctx.remove(X_AD_InfoRelated.COLUMNNAME_AD_InfoRelated_ID);
}
private void createInfoWindowBinding(PIPOContext ctx, TransformerHandler document, X_AD_InfoWindow m_InfoWindow) {
PoExporter filler = new PoExporter(ctx, document, m_InfoWindow);
List<String> excludes = defaultExcludeList(X_AD_InfoWindow.Table_Name);
if (m_InfoWindow.getAD_InfoWindow_ID() <= PackOut.MAX_OFFICIAL_ID)
filler.add("AD_InfoWindow_ID", new AttributesImpl());
filler.export(excludes);
}
public void packOut(PackOut packout, TransformerHandler packoutHandler, TransformerHandler docHandler,int recordId) throws Exception
{
Env.setContext(packout.getCtx().ctx, "AD_InfoWindow_ID", recordId);
this.create(packout.getCtx(), packoutHandler);
packout.getCtx().ctx.remove("AD_InfoWindow_ID");
}
}

View File

@ -34,6 +34,7 @@ import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PoFiller;
import org.adempiere.pipo2.ReferenceUtils;
import org.compiere.model.I_AD_Form;
import org.compiere.model.I_AD_InfoWindow;
import org.compiere.model.I_AD_Menu;
import org.compiere.model.I_AD_Process;
import org.compiere.model.I_AD_Task;
@ -230,7 +231,7 @@ public class MenuElementHandler extends AbstractElementHandler {
String sql = null;
int AD_Tree_ID = getDefaultMenuTreeId();
sql = "SELECT A.Node_ID, B.AD_Menu_ID, B.Name, B.AD_WINDOW_ID, B.AD_WORKFLOW_ID, B.AD_TASK_ID, "
+ "B.AD_PROCESS_ID, B.AD_FORM_ID, B.AD_WORKBENCH_ID "
+ "B.AD_PROCESS_ID, B.AD_FORM_ID, B.AD_WORKBENCH_ID, B.AD_INFOWINDOW_ID "
+ "FROM AD_TreeNodeMM A, AD_Menu B "
+ "WHERE A.Node_ID = "
+ AD_Menu_ID + " AND A.Node_ID = B.AD_Menu_ID" + " AND A.AD_Tree_ID="+AD_Tree_ID;
@ -257,10 +258,11 @@ public class MenuElementHandler extends AbstractElementHandler {
}
if (rs.getInt("AD_WINDOW_ID") > 0
|| rs.getInt("AD_WORKFLOW_ID") > 0
|| rs.getInt("AD_TASK_ID") > 0
|| rs.getInt("AD_PROCESS_ID") > 0
|| rs.getInt("AD_FORM_ID") > 0) {
|| rs.getInt("AD_TASK_ID") > 0
|| rs.getInt("AD_FORM_ID") > 0
|| rs.getInt("AD_WORKFLOW_ID") > 0
|| rs.getInt("AD_INFOWINDOW_ID") > 0) {
// Call CreateWindow.
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID)>0)
{
@ -286,6 +288,11 @@ public class MenuElementHandler extends AbstractElementHandler {
ElementHandler handler = packOut.getHandler(I_AD_Workflow.Table_Name);
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID));
}
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_InfoWindow_ID) > 0)
{
ElementHandler handler = packOut.getHandler(I_AD_InfoWindow.Table_Name);
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_InfoWindow_ID));
}
// Call CreateModule because entry is a summary menu
} else {
createModule(ctx, document, rs.getInt("Node_ID"));
@ -306,7 +313,7 @@ public class MenuElementHandler extends AbstractElementHandler {
String sql = null;
int AD_Tree_ID = getDefaultMenuTreeId();
sql = "SELECT A.Node_ID, B.AD_Menu_ID, B.Name, B.AD_WINDOW_ID, B.AD_WORKFLOW_ID, B.AD_TASK_ID, "
+ "B.AD_PROCESS_ID, B.AD_FORM_ID, B.AD_WORKBENCH_ID "
+ "B.AD_PROCESS_ID, B.AD_FORM_ID, B.AD_WORKBENCH_ID, B.AD_INFOWINDOW_ID "
+ "FROM AD_TreeNodeMM A, AD_Menu B "
+ "WHERE A.Parent_ID = "
+ menu_id + " AND A.Node_ID = B.AD_Menu_ID" + " AND A.AD_Tree_ID="+AD_Tree_ID;
@ -326,10 +333,11 @@ public class MenuElementHandler extends AbstractElementHandler {
document.startElement("", "", I_AD_Menu.Table_Name, atts);
createMenuBinding(ctx, document, m_Menu);
if (rs.getInt("AD_WINDOW_ID") > 0
|| rs.getInt("AD_WORKFLOW_ID") > 0
|| rs.getInt("AD_TASK_ID") > 0
|| rs.getInt("AD_PROCESS_ID") > 0
|| rs.getInt("AD_FORM_ID") > 0) {
|| rs.getInt("AD_TASK_ID") > 0
|| rs.getInt("AD_FORM_ID") > 0
|| rs.getInt("AD_WORKFLOW_ID") > 0
|| rs.getInt("AD_INFOWINDOW_ID") > 0) {
// Call CreateWindow.
if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Window_ID)>0)
{
@ -356,6 +364,11 @@ public class MenuElementHandler extends AbstractElementHandler {
ElementHandler handler = packOut.getHandler("AD_Workflow");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_Workflow_ID));
}
else if (rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_InfoWindow_ID) > 0)
{
ElementHandler handler = packOut.getHandler("AD_InfoWindow");
handler.packOut(packOut,document,null,rs.getInt(X_AD_Package_Exp_Detail.COLUMNNAME_AD_InfoWindow_ID));
}
// Call CreateModule because entry is a summary menu
} else {
createModule(ctx, document, rs.getInt("Node_ID"));

View File

@ -34,6 +34,7 @@ import org.adempiere.pipo2.exception.POSaveFailedException;
import org.compiere.model.I_AD_Role;
import org.compiere.model.MRole;
import org.compiere.model.X_AD_Form;
import org.compiere.model.X_AD_InfoWindow;
import org.compiere.model.X_AD_Package_Exp_Detail;
import org.compiere.model.X_AD_Package_Imp_Detail;
import org.compiere.model.X_AD_Process;
@ -55,6 +56,7 @@ public class RoleElementHandler extends AbstractElementHandler {
private FormAccessElementHandler formHandler = new FormAccessElementHandler();
private TaskAccessElementHandler taskHandler = new TaskAccessElementHandler();
private WorkflowAccessElementHandler workflowHandler = new WorkflowAccessElementHandler();
private InfoWindowAccessElementHandler infoWindowHandler = new InfoWindowAccessElementHandler();
public void startElement(PIPOContext ctx, Element element)
throws SAXException {
@ -240,6 +242,23 @@ public class RoleElementHandler extends AbstractElementHandler {
} finally {
DB.close(rs, pstmt);
}
// Process AD_InfoWindow_Access Values
sql = "SELECT AD_InfoWindow_ID, AD_Role_ID FROM AD_InfoWindow_Access WHERE AD_Role_ID= " + Role_id;
pstmt = null;
rs = null;
try {
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
rs = pstmt.executeQuery();
while (rs.next()) {
createInfoWindowAccess(ctx, document, rs.getInt("AD_InfoWindow_ID"), rs.getInt("AD_Role_ID"));
}
} catch (Exception e) {
log.log(Level.SEVERE, "AD_InfoWindow_Access", e);
throw new DatabaseAccessException("Failed to export InfoWindow access.");
} finally {
DB.close(rs, pstmt);
}
if (createElement) {
document.endElement("", "", X_AD_Role.Table_Name);
@ -291,6 +310,15 @@ public class RoleElementHandler extends AbstractElementHandler {
ctx.ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
}
private void createInfoWindowAccess(PIPOContext ctx,
TransformerHandler document, int AD_InfoWindow_ID, int AD_Role_ID) throws SAXException {
Env.setContext(ctx.ctx, X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID, AD_InfoWindow_ID);
Env.setContext(ctx.ctx, X_AD_Role.COLUMNNAME_AD_Role_ID, AD_Role_ID);
infoWindowHandler.create(ctx, document);
ctx.ctx.remove(X_AD_InfoWindow.COLUMNNAME_AD_InfoWindow_ID);
ctx.ctx.remove(X_AD_Role.COLUMNNAME_AD_Role_ID);
}
/*
private void createUserRole(PIPOContext ctx, TransformerHandler document,
int AD_User_ID, int AD_Role_ID, int AD_Org_ID) throws SAXException {

View File

@ -29,6 +29,7 @@ import java.util.logging.Level;
import org.compiere.model.I_AD_EntityType;
import org.compiere.model.I_AD_Form;
import org.compiere.model.I_AD_ImpFormat;
import org.compiere.model.I_AD_InfoWindow;
import org.compiere.model.I_AD_Menu;
import org.compiere.model.I_AD_Message;
import org.compiere.model.I_AD_ModelValidator;
@ -195,6 +196,8 @@ public class PackOutProcess extends SvrProcess
return I_AD_ModelValidator.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_EntityType.equals(type))
return I_AD_EntityType.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_InfoWindow.equals(type))
return I_AD_InfoWindow.Table_Name;
return type;
}