IDEMPIERE-4221 PackOut type "Data Single" (FHCA-1198)

This commit is contained in:
Carlos Ruiz 2020-03-24 21:23:09 +01:00
parent 41b8e0e62b
commit 6c56100724
8 changed files with 52 additions and 3 deletions

View File

@ -0,0 +1,19 @@
SET SQLBLANKLINES ON
SET DEFINE OFF
-- IDEMPIERE-4221 PackOut type Data Single (FHCA-1198)
-- Mar 24, 2020, 6:00:23 PM CET
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 (200492,'Data Single',50004,'DS',0,0,'Y',TO_DATE('2020-03-24 18:00:23','YYYY-MM-DD HH24:MI:SS'),100,TO_DATE('2020-03-24 18:00:23','YYYY-MM-DD HH24:MI:SS'),100,'D','bb6620c6-4cef-4796-90d6-007b83fe213f')
;
-- Mar 24, 2020, 6:26:24 PM CET
UPDATE AD_Field SET DisplayLogic='@Type@=''T''|@Type@=''D''|@Type@=''DS''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-03-24 18:26:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50103
;
-- Mar 24, 2020, 6:28:56 PM CET
UPDATE AD_Field SET DisplayLogic='@Type@=''D''|@Type@=''DS''|Type@=''SQL''|Type@=''SQM''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-03-24 18:28:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50105
;
SELECT register_migration_script('202003241800_IDEMPIERE-4221.sql') FROM dual
;

View File

@ -0,0 +1,16 @@
-- IDEMPIERE-4221 PackOut type Data Single (FHCA-1198)
-- Mar 24, 2020, 6:00:23 PM CET
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 (200492,'Data Single',50004,'DS',0,0,'Y',TO_TIMESTAMP('2020-03-24 18:00:23','YYYY-MM-DD HH24:MI:SS'),100,TO_TIMESTAMP('2020-03-24 18:00:23','YYYY-MM-DD HH24:MI:SS'),100,'D','bb6620c6-4cef-4796-90d6-007b83fe213f')
;
-- Mar 24, 2020, 6:26:24 PM CET
UPDATE AD_Field SET DisplayLogic='@Type@=''T''|@Type@=''D''|@Type@=''DS''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-03-24 18:26:24','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50103
;
-- Mar 24, 2020, 6:28:56 PM CET
UPDATE AD_Field SET DisplayLogic='@Type@=''D''|@Type@=''DS''|Type@=''SQL''|Type@=''SQM''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-03-24 18:28:56','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=50105
;
SELECT register_migration_script('202003241800_IDEMPIERE-4221.sql') FROM dual
;

View File

@ -91,6 +91,8 @@ public class MPackageExpDetail extends X_AD_Package_Exp_Detail
return 0;
} else if (TYPE_Data.equals(type)) {
return 0;
} else if (TYPE_DataSingle.equals(type)) {
return 0;
} else if (TYPE_DynamicValidationRule.equals(type)) {
return getAD_Val_Rule_ID();
} else if (TYPE_Form.equals(type)) {

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 = 20191121L;
private static final long serialVersionUID = 20200324L;
/** Standard Constructor */
public X_AD_Package_Exp_Detail (Properties ctx, int AD_Package_Exp_Detail_ID, String trxName)
@ -945,6 +945,8 @@ public class X_AD_Package_Exp_Detail extends PO implements I_AD_Package_Exp_Deta
public static final String TYPE_SQLMandatory = "SQM";
/** Info Window = IW */
public static final String TYPE_InfoWindow = "IW";
/** Data Single = DS */
public static final String TYPE_DataSingle = "DS";
/** Set Type.
@param Type
Type of Validation (SQL, Java Script, Java Language)

View File

@ -180,6 +180,10 @@
class="org.adempiere.pipo2.handler.GenericPOElementHandler"
id="table.genericHandler">
</handler>
<handler
class="org.adempiere.pipo2.handler.GenericPOElementHandler"
id="table.genericSingleHandler">
</handler>
<handler
class="org.adempiere.pipo2.handler.ModelValidatorElementHandler"
id="AD_ModelValidator">

View File

@ -32,6 +32,7 @@ import org.adempiere.pipo2.AbstractElementHandler;
import org.adempiere.pipo2.DataElementParameters;
import org.adempiere.pipo2.Element;
import org.adempiere.pipo2.ElementHandler;
import org.adempiere.pipo2.IHandlerRegistry;
import org.adempiere.pipo2.PIPOContext;
import org.adempiere.pipo2.PackOut;
import org.adempiere.pipo2.PackoutItem;
@ -172,7 +173,9 @@ public class GenericPOElementHandler extends AbstractElementHandler {
}
if (createElement) {
if (po.get_KeyColumns() != null && po.get_KeyColumns().length == 1 && po.get_ID() > 0) {
//
if (po.get_KeyColumns() != null && po.get_KeyColumns().length == 1 && po.get_ID() > 0
&& ! IHandlerRegistry.TABLE_GENERIC_SINGLE_HANDLER.equals(ctx.packOut.getCurrentPackoutItem().getType())) {
ElementHandler handler = ctx.packOut.getHandler(po.get_TableName());
if (handler != null && !handler.getClass().equals(this.getClass()) ) {
handler.packOut(ctx.packOut, document, ctx.logDocument, po.get_ID());

View File

@ -9,6 +9,7 @@ public interface IHandlerRegistry {
public static final String TABLE_TRANSLATION_HANDLER = "table.translationHandler";
public static final String TABLE_GENERIC_HANDLER = "table.genericHandler";
public static final String TABLE_GENERIC_SINGLE_HANDLER = "table.genericSingleHandler";
/**
* @param element

View File

@ -162,6 +162,8 @@ public class PackOutProcess extends SvrProcess
return "Code_Snipit";
else if (X_AD_Package_Exp_Detail.TYPE_Data.equals(type))
return IHandlerRegistry.TABLE_GENERIC_HANDLER;
else if (X_AD_Package_Exp_Detail.TYPE_DataSingle.equals(type))
return IHandlerRegistry.TABLE_GENERIC_SINGLE_HANDLER;
else if (X_AD_Package_Exp_Detail.TYPE_DynamicValidationRule.equals(type))
return I_AD_Val_Rule.Table_Name;
else if (X_AD_Package_Exp_Detail.TYPE_File_CodeOrOther.equals(type))
@ -204,7 +206,7 @@ public class PackOutProcess extends SvrProcess
private Map<String, Object> getExpProperties(MPackageExpDetail dtl) {
Map<String, Object> properties = new HashMap<String, Object>();
String type = dtl.getType();
if (MPackageExpDetail.TYPE_Data.equals(type)) {
if (MPackageExpDetail.TYPE_Data.equals(type) || MPackageExpDetail.TYPE_DataSingle.equals(type)) {
properties.put(DataElementParameters.AD_TABLE_ID, dtl.getAD_Table_ID());
properties.put(DataElementParameters.SQL_STATEMENT, dtl.getSQLStatement());
} else if (MPackageExpDetail.TYPE_SQLStatement.equals(type) || MPackageExpDetail.TYPE_SQLMandatory.equals(type)) {