forward-porting release-1.0c
This commit is contained in:
commit
0770d77cfc
|
@ -65,15 +65,15 @@ Check the inventory level after the document
|
||||||
|@ExpectedInventoryLevelAfter@|@SQL=SELECT SUM(s.qtyonhand) FROM m_storage s, m_locator l, m_warehouse w WHERE s.m_product_id=133 AND s.m_locator_id = l.m_locator_id AND l.m_warehouse_id=w.m_warehouse_id AND w.m_warehouse_id=103|
|
|@ExpectedInventoryLevelAfter@|@SQL=SELECT SUM(s.qtyonhand) FROM m_storage s, m_locator l, m_warehouse w WHERE s.m_product_id=133 AND s.m_locator_id = l.m_locator_id AND l.m_warehouse_id=w.m_warehouse_id AND w.m_warehouse_id=103|
|
||||||
|
|
||||||
|
|
||||||
Check the bp balance after the document
|
Check the bp balance after the document (with the new cash payment is applied immediately so there must not be variance on the bp balance)
|
||||||
|
|
||||||
!|Assert Record|
|
!|Assert Record|
|
||||||
|*Table* |C_bpartner |
|
|*Table* |C_bpartner |
|
||||||
|*Where* |c_bpartner_id=120 |
|
|*Where* |c_bpartner_id=120 |
|
||||||
|*Read* | |
|
|*Read* | |
|
||||||
|actuallifetimevalue|@SQL=SELECT @C_bpartner.actuallifetimevalue@ + @c_order.grandtotal@ FROM DUAL|
|
|actuallifetimevalue|@SQL=SELECT @C_bpartner.actuallifetimevalue@ + @c_order.grandtotal@ FROM DUAL|
|
||||||
|so_creditused |@SQL=SELECT @C_bpartner.so_creditused@ + @c_order.grandtotal@ FROM DUAL |
|
|so_creditused |@SQL=SELECT @C_bpartner.so_creditused@ FROM DUAL |
|
||||||
|totalopenbalance |@SQL=SELECT @C_bpartner.totalopenbalance@ + @c_order.grandtotal@ FROM DUAL |
|
|totalopenbalance |@SQL=SELECT @C_bpartner.totalopenbalance@ FROM DUAL |
|
||||||
|
|
||||||
Check existance of shipment
|
Check existance of shipment
|
||||||
|
|
||||||
|
@ -123,17 +123,14 @@ Check existance of invoice
|
||||||
|qtyinvoiced | |
|
|qtyinvoiced | |
|
||||||
|linenetamt | |
|
|linenetamt | |
|
||||||
|
|
||||||
Check existance of cash journal line
|
Check existance of cash payment (now on payment table)
|
||||||
|
|
||||||
!|Read Record|
|
!|Read Record|
|
||||||
|*Table* |C_CashLine |
|
|*Table* |C_Payment |
|
||||||
|C_Invoice_id|@C_Invoice.C_Invoice_id@|
|
|C_Invoice_id|@C_Invoice.C_Invoice_id@|
|
||||||
|*Read* | |
|
|*Read* | |
|
||||||
|line | |
|
|documentno | |
|
||||||
|c_cash_id | |
|
|
||||||
|line | |
|
|
||||||
|description | |
|
|description | |
|
||||||
|amount | |
|
|amount | |
|
||||||
|isgenerated | |
|
|
||||||
|processed | |
|
|processed | |
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
This test tries to create a reference in the database, intentionally the !-ValidationType-! is left to a wrong value (Y) to make it fail.
|
This test tries to create a reference in the database, intentionally the !-ValidationType-! is set to a wrong value (Y) to make it fail.
|
||||||
|
|
||||||
!include TestLoginSystem
|
!include TestLoginSystem
|
||||||
|
|
||||||
|
@ -7,4 +7,4 @@ This test tries to create a reference in the database, intentionally the !-Valid
|
||||||
|Name |Fitnesse Test|
|
|Name |Fitnesse Test|
|
||||||
|ValidationType|Y |
|
|ValidationType|Y |
|
||||||
|invalidcolumn|Y |
|
|invalidcolumn|Y |
|
||||||
|*Save* | |
|
|*Save*Error* |java.lang.Exception: Cannot set value of column|
|
||||||
|
|
|
@ -2,12 +2,16 @@ This test creates a new tenant in the database.
|
||||||
|
|
||||||
!include TestLoginSystem
|
!include TestLoginSystem
|
||||||
|
|
||||||
!|Run Process|
|
!|Set Variable |
|
||||||
|
|@random_string@|@random_string(,,6)|
|
||||||
|
|
||||||
|
|
||||||
|
!|Run Process |
|
||||||
|*ProcessValue* |InitialClientSetup |
|
|*ProcessValue* |InitialClientSetup |
|
||||||
|ClientName |Prueba |
|
|ClientName |TestClient @random_string@ |
|
||||||
|OrgName |Prueba |
|
|OrgName |TestOrg @random_string@ |
|
||||||
|AdminUserName |PruebaAdmin |
|
|AdminUserName |@random_string@Admin |
|
||||||
|NormalUserName |PruebaUser |
|
|NormalUserName |@random_string@User |
|
||||||
|C_Currency_ID |230 |
|
|C_Currency_ID |230 |
|
||||||
|C_Country_ID |156 |
|
|C_Country_ID |156 |
|
||||||
|CityName |Bogotá |
|
|CityName |Bogotá |
|
||||||
|
@ -16,5 +20,5 @@ This test creates a new tenant in the database.
|
||||||
|IsUseProjectDimension |Y |
|
|IsUseProjectDimension |Y |
|
||||||
|IsUseCampaignDimension |N |
|
|IsUseCampaignDimension |N |
|
||||||
|IsUseSalesRegionDimension|N |
|
|IsUseSalesRegionDimension|N |
|
||||||
|CoAFile |/home/carlos/hgAdempiere/adempiere361/data/import/AccountingUS.csv|
|
|CoAFile |${fitnesse_home}/../org.adempiere.server-feature/data/import/AccountingUS.csv|
|
||||||
|*Run* | |
|
|*Run* | |
|
||||||
|
|
|
@ -4,43 +4,49 @@ https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2713724&group_id=17
|
||||||
|
|
||||||
!include -c TestLoginGardenAdmin
|
!include -c TestLoginGardenAdmin
|
||||||
|
|
||||||
|
!|Set Variable |
|
||||||
|
|@InventoryLevelBefore@ |@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101|
|
||||||
|
|@ExpectedInventoryLevelAfter@|@SQL=SELECT @InventoryLevelBefore@-2 FROM dual |
|
||||||
|
|
||||||
Create the internal use document
|
Create the internal use document
|
||||||
|
|
||||||
!|Create Record|
|
!|Create Record |
|
||||||
|*Table*|M_Inventory |
|
|*Table* |M_Inventory |
|
||||||
|ad_org_id |11 |
|
|ad_org_id |11 |
|
||||||
|c_doctype_id |144 |
|
|c_doctype_id |200000 |
|
||||||
|m_warehouse_id|103 |
|
|m_warehouse_id|103 |
|
||||||
|movementdate |2009-03-26 00:00:00.0|
|
|movementdate |2013-06-26 00:00:00.0|
|
||||||
|*Save*| |
|
|*Save* | |
|
||||||
|
|
||||||
Create internal use line
|
Create internal use line
|
||||||
|
|
||||||
!|Create Record|
|
!|Create Record |
|
||||||
|*Table*|M_InventoryLine |
|
|*Table* |M_InventoryLine |
|
||||||
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@ |
|
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@|
|
||||||
|ad_org_id |@M_Inventory.AD_Org_ID@ |
|
|ad_org_id |@M_Inventory.AD_Org_ID@ |
|
||||||
|m_locator_id |101 |
|
|m_locator_id |101 |
|
||||||
|m_product_id |141 |
|
|m_product_id |141 |
|
||||||
|c_charge_id |101 |
|
|c_charge_id |101 |
|
||||||
|qtyinternaluse|@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101 and m_attributesetinstance_id=0|
|
|qtyinternaluse|2 |
|
||||||
|qtybook|@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101 and m_attributesetinstance_id=0|
|
|*Save* | |
|
||||||
|*Save*| |
|
|
||||||
|
|
||||||
Complete the internal use
|
Complete the internal use
|
||||||
|
|
||||||
!|Run Process|
|
!|Run Process |
|
||||||
|*ProcessValue*|M_Inventory Process |
|
|*ProcessValue*|M_Inventory Process |
|
||||||
|*RecordID* |@M_Inventory.M_Inventory_ID@|
|
|*RecordID* |@M_Inventory.M_Inventory_ID@|
|
||||||
|*DocAction* |CO |
|
|*DocAction* |CO |
|
||||||
|*Run*| |
|
|*Run* | |
|
||||||
|
|
||||||
|
!|Assert Variable |
|
||||||
|
|@ExpectedInventoryLevelAfter@|@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101|
|
||||||
|
|
||||||
Post
|
Post
|
||||||
|
|
||||||
!|Set DocAction|
|
!|Set DocAction |
|
||||||
|*Table* |M_Inventory|
|
|*Table* |M_Inventory |
|
||||||
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@ |
|
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@|
|
||||||
|docAction |PO |
|
|docAction |PO |
|
||||||
|*Save*| |
|
|*Save* | |
|
||||||
|
|
||||||
Check the postings
|
Check the postings
|
|
@ -1,3 +1,9 @@
|
||||||
|
|IdempiereSuite.TestInitialClientSetup||17:03:35 vie, jun 28, 2013|
|
||||||
|
|IdempiereSuite.TestPostInternalInventory||15:31:05 vie, jun 28, 2013|
|
||||||
|
|IdempiereSuite.TestCreateReference||14:44:52 vie, jun 28, 2013|
|
||||||
|
|IdempiereSuite.TestCashPosOrder||14:42:20 vie, jun 28, 2013|
|
||||||
|
|ZkSuite.ZkGardenAdminLogin||13:02:13 vie, jun 28, 2013|
|
||||||
|
|ZkSuite.ZkSystemAdminLogin||13:00:38 vie, jun 28, 2013|
|
||||||
|||12:04:00 jue, dic 20, 2012|
|
|||12:04:00 jue, dic 20, 2012|
|
||||||
|FitLibraryWeb||01:41:13 Thu, Dec 13, 2012|
|
|FitLibraryWeb||01:41:13 Thu, Dec 13, 2012|
|
||||||
|FitLibrary||01:40:51 Thu, Dec 13, 2012|
|
|FitLibrary||01:40:51 Thu, Dec 13, 2012|
|
||||||
|
@ -9,13 +15,9 @@
|
||||||
|CommonTests.CreateProductPrice||01:29:57 mar, abr 03, 2012|
|
|CommonTests.CreateProductPrice||01:29:57 mar, abr 03, 2012|
|
||||||
|AvgCostSuite.BasicTest||01:18:34 mar, abr 03, 2012|
|
|AvgCostSuite.BasicTest||01:18:34 mar, abr 03, 2012|
|
||||||
|CommonTests.CreatePurchaseOrder||01:13:34 mar, abr 03, 2012|
|
|CommonTests.CreatePurchaseOrder||01:13:34 mar, abr 03, 2012|
|
||||||
|IdempiereSuite.TestPostInternalInventory||24:21:25 mar, abr 03, 2012|
|
|
||||||
|IdempiereSuite.TestInitialClientSetup||24:20:45 mar, abr 03, 2012|
|
|
||||||
|IdempiereSuite.TestCreateReference||24:20:15 mar, abr 03, 2012|
|
|
||||||
|IdempiereSuite.TestLoginSystem||24:20:05 mar, abr 03, 2012|
|
|IdempiereSuite.TestLoginSystem||24:20:05 mar, abr 03, 2012|
|
||||||
|IdempiereSuite.TestCreateBusinessPartner||24:19:40 mar, abr 03, 2012|
|
|IdempiereSuite.TestCreateBusinessPartner||24:19:40 mar, abr 03, 2012|
|
||||||
|IdempiereSuite.TestCompletePayment||24:19:18 mar, abr 03, 2012|
|
|IdempiereSuite.TestCompletePayment||24:19:18 mar, abr 03, 2012|
|
||||||
|IdempiereSuite.TestCashPosOrder||24:18:46 mar, abr 03, 2012|
|
|
||||||
|IdempiereSuite||24:17:17 mar, abr 03, 2012|
|
|IdempiereSuite||24:17:17 mar, abr 03, 2012|
|
||||||
|IdempiereSuite.TestLoginGardenAdmin||24:17:07 mar, abr 03, 2012|
|
|IdempiereSuite.TestLoginGardenAdmin||24:17:07 mar, abr 03, 2012|
|
||||||
|IdempiereSuite.QuickTest||24:16:36 mar, abr 03, 2012|
|
|IdempiereSuite.QuickTest||24:16:36 mar, abr 03, 2012|
|
||||||
|
|
|
@ -15,12 +15,12 @@
|
||||||
|''window''|${windowId}|''click toolbar''|!-BtnSave-!|
|
|''window''|${windowId}|''click toolbar''|!-BtnSave-!|
|
||||||
|''wait response''|
|
|''wait response''|
|
||||||
|''window message''|${windowId}|is|!-Record saved-!|
|
|''window message''|${windowId}|is|!-Record saved-!|
|
||||||
|''window''|${windowId}|''click detail toolbar''|!-BtnNew-!|
|
|''window''|${windowId}|''click detail toolbar''|!-BtnEdit-!|
|
||||||
|''wait response''|
|
|''wait response''|
|
||||||
|''text of''|${windowId} $recordInfo|is|!-+*1/1-!|
|
|''text of''|${windowId} $recordInfo|is|!-+*1/1-!|
|
||||||
|''window''|${windowId}|''click toolbar''|!-BtnParentRecord-!|
|
|''window''|${windowId}|''click toolbar''|!-BtnParentRecord-!|
|
||||||
|''wait response''|
|
|''wait response''|
|
||||||
|''window''|${windowId}|''click process button''|!-CreateFrom-!|
|
|''click''|${windowId} $Production $CreateFrom|
|
||||||
|''wait response''|
|
|''wait response''|
|
||||||
|''click''|${windowId} @window[title="Create Production"] $Ok|
|
|''click''|${windowId} @window[title="Create Production"] $Ok|
|
||||||
|''wait response''|
|
|''wait response''|
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
'''start firefox,chrome or phantomjs'''
|
'''start firefox,chrome or phantomjs'''
|
||||||
|''start spider with''|firefox|
|
|''start spider with''|firefox|
|
||||||
|''shutdown browser automatically''|false|
|
|''shutdown browser automatically''|false|
|
||||||
|''get url''|http://localhost:8080/webui/index.zul|
|
|''get url''|http://localhost:${ADEMPIERE_WEB_PORT}/webui/index.zul|
|
||||||
|
|
||||||
|''wait response''|
|
|''wait response''|
|
||||||
|
|
||||||
|
|
|
@ -3,7 +3,7 @@
|
||||||
'''start firefox,chrome or phantomjs'''
|
'''start firefox,chrome or phantomjs'''
|
||||||
|''start spider with''|firefox|
|
|''start spider with''|firefox|
|
||||||
|''shutdown browser automatically''|false|
|
|''shutdown browser automatically''|false|
|
||||||
|''get url''|http://localhost:8080/webui/index.zul|
|
|''get url''|http://localhost:${ADEMPIERE_WEB_PORT}/webui/index.zul|
|
||||||
|
|
||||||
|''wait response''|
|
|''wait response''|
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,12 @@
|
||||||
|
-- Jul 3, 2013 5:16:26 PM COT
|
||||||
|
-- IDEMPIERE-1123 Unnecessary showing user security fields
|
||||||
|
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2013-07-03 17:16:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200473
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 3, 2013 5:16:32 PM COT
|
||||||
|
-- IDEMPIERE-1123 Unnecessary showing user security fields
|
||||||
|
UPDATE AD_Field SET IsActive='N',Updated=TO_DATE('2013-07-03 17:16:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('20130603172740_IDEMPIERE-1123.sql') FROM dual
|
||||||
|
;
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- Jul 3, 2013 6:25:43 PM COT
|
||||||
|
-- IDEMPIERE-1121 Field Customization IsUpdateable mandatory on DB not in dict
|
||||||
|
ALTER TABLE AD_UserDef_Field MODIFY IsUpdateable CHAR(1) DEFAULT NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 3, 2013 6:25:44 PM COT
|
||||||
|
-- IDEMPIERE-1121 Field Customization IsUpdateable mandatory on DB not in dict
|
||||||
|
ALTER TABLE AD_UserDef_Field MODIFY IsUpdateable NULL
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('20130603182945_IDEMPIERE-1121.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- 4/07/2013 06:07:52 PM COT
|
||||||
|
-- IDEMPIERE-1133 Customize grid not translated
|
||||||
|
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Org_ID,AD_Client_ID,EntityType) VALUES ('I','Save Column Width',200186,'e55bb769-5507-483c-bfd4-c938c5c5d93f','SaveColumnWidth','Y',TO_DATE('2013-07-04 18:07:52','YYYY-MM-DD HH24:MI:SS'),100,100,TO_DATE('2013-07-04 18:07:52','YYYY-MM-DD HH24:MI:SS'),0,0,'D')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 4/07/2013 06:07:52 PM COT
|
||||||
|
-- IDEMPIERE-1133 Customize grid not translated
|
||||||
|
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200186 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201307041818_IDEMPIERE-1133.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- Jul 3, 2013 5:16:26 PM COT
|
||||||
|
-- IDEMPIERE-1123 Unnecessary showing user security fields
|
||||||
|
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2013-07-03 17:16:26','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200473
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 3, 2013 5:16:32 PM COT
|
||||||
|
-- IDEMPIERE-1123 Unnecessary showing user security fields
|
||||||
|
UPDATE AD_Field SET IsActive='N',Updated=TO_TIMESTAMP('2013-07-03 17:16:32','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=200475
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('20130603172740_IDEMPIERE-1123.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- Jul 3, 2013 6:25:43 PM COT
|
||||||
|
-- IDEMPIERE-1121 Field Customization IsUpdateable mandatory on DB not in dict
|
||||||
|
INSERT INTO t_alter_column values('ad_userdef_field','IsUpdateable','CHAR(1)',null,'NULL')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 3, 2013 6:25:44 PM COT
|
||||||
|
-- IDEMPIERE-1121 Field Customization IsUpdateable mandatory on DB not in dict
|
||||||
|
INSERT INTO t_alter_column values('ad_userdef_field','IsUpdateable',null,'NULL',null)
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('20130603182945_IDEMPIERE-1121.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,13 @@
|
||||||
|
-- 4/07/2013 06:07:52 PM COT
|
||||||
|
-- IDEMPIERE-1133 Customize grid not translated
|
||||||
|
INSERT INTO AD_Message (MsgType,MsgText,AD_Message_ID,AD_Message_UU,Value,IsActive,Updated,CreatedBy,UpdatedBy,Created,AD_Org_ID,AD_Client_ID,EntityType) VALUES ('I','Save Column Width',200186,'e55bb769-5507-483c-bfd4-c938c5c5d93f','SaveColumnWidth','Y',TO_TIMESTAMP('2013-07-04 18:07:52','YYYY-MM-DD HH24:MI:SS'),100,100,TO_TIMESTAMP('2013-07-04 18:07:52','YYYY-MM-DD HH24:MI:SS'),0,0,'D')
|
||||||
|
;
|
||||||
|
|
||||||
|
-- 4/07/2013 06:07:52 PM COT
|
||||||
|
-- IDEMPIERE-1133 Customize grid not translated
|
||||||
|
INSERT INTO AD_Message_Trl (AD_Language,AD_Message_ID, MsgText,MsgTip, IsTranslated,AD_Client_ID,AD_Org_ID,Created,Createdby,Updated,UpdatedBy,AD_Message_Trl_UU ) SELECT l.AD_Language,t.AD_Message_ID, t.MsgText,t.MsgTip, 'N',t.AD_Client_ID,t.AD_Org_ID,t.Created,t.Createdby,t.Updated,t.UpdatedBy,Generate_UUID() FROM AD_Language l, AD_Message t WHERE l.IsActive='Y' AND l.IsSystemLanguage='Y' AND l.IsBaseLanguage='N' AND t.AD_Message_ID=200186 AND NOT EXISTS (SELECT * FROM AD_Message_Trl tt WHERE tt.AD_Language=l.AD_Language AND tt.AD_Message_ID=t.AD_Message_ID)
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('201307041818_IDEMPIERE-1133.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -1143,6 +1143,11 @@ public class DocLine
|
||||||
} // getReversalLine_ID
|
} // getReversalLine_ID
|
||||||
//end AZ Goodwill
|
//end AZ Goodwill
|
||||||
|
|
||||||
|
public PO getPO()
|
||||||
|
{
|
||||||
|
return p_po;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String representation
|
* String representation
|
||||||
* @return String
|
* @return String
|
||||||
|
|
|
@ -21,6 +21,8 @@ import java.sql.ResultSet;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.model.I_M_InOutLine;
|
||||||
|
import org.compiere.model.I_M_RMALine;
|
||||||
import org.compiere.model.MTax;
|
import org.compiere.model.MTax;
|
||||||
import org.compiere.model.MCurrency;
|
import org.compiere.model.MCurrency;
|
||||||
import org.compiere.model.MAccount;
|
import org.compiere.model.MAccount;
|
||||||
|
@ -33,6 +35,7 @@ import org.compiere.model.MProduct;
|
||||||
import org.compiere.model.ProductCost;
|
import org.compiere.model.ProductCost;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Util;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Post Shipment/Receipt Documents.
|
* Post Shipment/Receipt Documents.
|
||||||
|
@ -177,11 +180,21 @@ public class Doc_InOut extends Doc
|
||||||
{
|
{
|
||||||
MProduct product = line.getProduct();
|
MProduct product = line.getProduct();
|
||||||
if (product.isStocked())
|
if (product.isStocked())
|
||||||
|
{
|
||||||
|
//ok if we have purchased zero cost item from vendor before
|
||||||
|
int count = DB.getSQLValue(null, "SELECT Count(*) FROM M_CostDetail WHERE M_Product_ID=? AND Processed='Y' AND Amt=0.00 AND Qty > 0 AND (C_OrderLine_ID > 0 OR C_InvoiceLine_ID > 0)",
|
||||||
|
product.getM_Product_ID());
|
||||||
|
if (count > 0)
|
||||||
|
{
|
||||||
|
costs = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
p_Error = "No Costs for " + line.getProduct().getName();
|
p_Error = "No Costs for " + line.getProduct().getName();
|
||||||
log.log(Level.WARNING, p_Error);
|
log.log(Level.WARNING, p_Error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else // ignore service
|
else // ignore service
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -381,6 +394,7 @@ public class Doc_InOut extends Doc
|
||||||
DocLine line = p_lines[i];
|
DocLine line = p_lines[i];
|
||||||
BigDecimal costs = null;
|
BigDecimal costs = null;
|
||||||
MProduct product = line.getProduct();
|
MProduct product = line.getProduct();
|
||||||
|
MOrderLine orderLine = null;
|
||||||
if (!isReversal(line))
|
if (!isReversal(line))
|
||||||
{
|
{
|
||||||
//get costing method for product
|
//get costing method for product
|
||||||
|
@ -393,7 +407,7 @@ public class Doc_InOut extends Doc
|
||||||
// Low - check if c_orderline_id is valid
|
// Low - check if c_orderline_id is valid
|
||||||
if (C_OrderLine_ID > 0)
|
if (C_OrderLine_ID > 0)
|
||||||
{
|
{
|
||||||
MOrderLine orderLine = new MOrderLine (getCtx(), C_OrderLine_ID, getTrxName());
|
orderLine = new MOrderLine (getCtx(), C_OrderLine_ID, getTrxName());
|
||||||
// Elaine 2008/06/26
|
// Elaine 2008/06/26
|
||||||
C_Currency_ID = orderLine.getC_Currency_ID();
|
C_Currency_ID = orderLine.getC_Currency_ID();
|
||||||
//
|
//
|
||||||
|
@ -419,7 +433,7 @@ public class Doc_InOut extends Doc
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
p_Error = "Resubmit - No Costs for " + product.getName();
|
p_Error = "Resubmit - No Costs for " + product.getName() + " (required order line)";
|
||||||
log.log(Level.WARNING, p_Error);
|
log.log(Level.WARNING, p_Error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -431,12 +445,20 @@ public class Doc_InOut extends Doc
|
||||||
}
|
}
|
||||||
|
|
||||||
if (costs == null || costs.signum() == 0)
|
if (costs == null || costs.signum() == 0)
|
||||||
|
{
|
||||||
|
//ok if purchase price is actually zero
|
||||||
|
if (orderLine != null && orderLine.getPriceActual().signum() == 0)
|
||||||
|
{
|
||||||
|
costs = BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
p_Error = "Resubmit - No Costs for " + product.getName();
|
p_Error = "Resubmit - No Costs for " + product.getName();
|
||||||
log.log(Level.WARNING, p_Error);
|
log.log(Level.WARNING, p_Error);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
costs = BigDecimal.ZERO;
|
costs = BigDecimal.ZERO;
|
||||||
|
@ -524,8 +546,34 @@ public class Doc_InOut extends Doc
|
||||||
BigDecimal costs = null;
|
BigDecimal costs = null;
|
||||||
MProduct product = line.getProduct();
|
MProduct product = line.getProduct();
|
||||||
if (!isReversal(line))
|
if (!isReversal(line))
|
||||||
|
{
|
||||||
|
MInOutLine ioLine = (MInOutLine) line.getPO();
|
||||||
|
I_M_RMALine rmaLine = ioLine.getM_RMALine();
|
||||||
|
costs = rmaLine != null ? rmaLine.getAmt() : BigDecimal.ZERO;
|
||||||
|
I_M_InOutLine originalInOutLine = rmaLine != null ? rmaLine.getM_InOutLine() : null;
|
||||||
|
if (originalInOutLine != null && originalInOutLine.getC_OrderLine_ID() > 0)
|
||||||
|
{
|
||||||
|
MOrderLine originalOrderLine = (MOrderLine) originalInOutLine.getC_OrderLine();
|
||||||
|
// Goodwill: Correct included Tax
|
||||||
|
int C_Tax_ID = originalOrderLine.getC_Tax_ID();
|
||||||
|
if (originalOrderLine.isTaxIncluded() && C_Tax_ID != 0)
|
||||||
|
{
|
||||||
|
MTax tax = MTax.get(getCtx(), C_Tax_ID);
|
||||||
|
if (!tax.isZeroTax())
|
||||||
|
{
|
||||||
|
int stdPrecision = MCurrency.getStdPrecision(getCtx(), originalOrderLine.getC_Currency_ID());
|
||||||
|
BigDecimal costTax = tax.calculateTax(costs, true, stdPrecision);
|
||||||
|
if (log.isLoggable(Level.FINE)) log.fine("Costs=" + costs + " - Tax=" + costTax);
|
||||||
|
costs = costs.subtract(costTax);
|
||||||
|
}
|
||||||
|
} // correct included Tax
|
||||||
|
costs = costs.multiply(line.getQty());
|
||||||
|
costs = costs.negate();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
|
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
|
||||||
|
}
|
||||||
if (costs == null || costs.signum() == 0)
|
if (costs == null || costs.signum() == 0)
|
||||||
{
|
{
|
||||||
p_Error = "Resubmit - No Costs for " + product.getName();
|
p_Error = "Resubmit - No Costs for " + product.getName();
|
||||||
|
@ -535,7 +583,8 @@ public class Doc_InOut extends Doc
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
costs = BigDecimal.ZERO;
|
//update below
|
||||||
|
costs = Env.ONE;
|
||||||
}
|
}
|
||||||
// NotInvoicedReceipt DR
|
// NotInvoicedReceipt DR
|
||||||
// Elaine 2008/06/26
|
// Elaine 2008/06/26
|
||||||
|
@ -596,7 +645,15 @@ public class Doc_InOut extends Doc
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String costingError = createVendorRMACostDetail(as, line, costs);
|
||||||
|
if (!Util.isEmpty(costingError))
|
||||||
|
{
|
||||||
|
p_Error = costingError;
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
} // Purchasing Return
|
} // Purchasing Return
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -613,4 +670,20 @@ public class Doc_InOut extends Doc
|
||||||
return m_Reversal_ID !=0 && line.getReversalLine_ID() != 0;
|
return m_Reversal_ID !=0 && line.getReversalLine_ID() != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String createVendorRMACostDetail(MAcctSchema as, DocLine line, BigDecimal costs)
|
||||||
|
{
|
||||||
|
BigDecimal tQty = line.getQty();
|
||||||
|
BigDecimal tAmt = costs;
|
||||||
|
if (tAmt.signum() != tQty.signum())
|
||||||
|
{
|
||||||
|
tAmt = tAmt.negate();
|
||||||
|
}
|
||||||
|
if (!MCostDetail.createShipment(as, line.getAD_Org_ID(), line.getM_Product_ID(),
|
||||||
|
line.getM_AttributeSetInstance_ID(), line.get_ID(), 0, tAmt, tQty,
|
||||||
|
line.getDescription(), false, getTrxName()))
|
||||||
|
{
|
||||||
|
return "SaveError";
|
||||||
|
}
|
||||||
|
return "";
|
||||||
|
}
|
||||||
} // Doc_InOut
|
} // Doc_InOut
|
||||||
|
|
|
@ -205,27 +205,9 @@ public class Doc_MatchInv extends Doc
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("Line Net Amt=0 - M_Product_ID=" + getM_Product_ID()
|
if (log.isLoggable(Level.FINE)) log.fine("Line Net Amt=0 - M_Product_ID=" + getM_Product_ID()
|
||||||
+ ",Qty=" + getQty() + ",InOutQty=" + m_receiptLine.getMovementQty());
|
+ ",Qty=" + getQty() + ",InOutQty=" + m_receiptLine.getMovementQty());
|
||||||
|
|
||||||
// Invoice Price Variance
|
cr = fact.createLine (null, expense, as.getC_Currency_ID(), null, Env.ONE);
|
||||||
BigDecimal ipv = dr.getSourceBalance().negate();
|
cr.setAmtAcctCr(BigDecimal.ZERO);
|
||||||
if (ipv.signum() != 0)
|
cr.setAmtSourceCr(BigDecimal.ZERO);
|
||||||
{
|
|
||||||
MInvoice m_invoice = m_invoiceLine.getParent();
|
|
||||||
int C_Currency_ID = m_invoice.getC_Currency_ID();
|
|
||||||
FactLine pv = fact.createLine(null,
|
|
||||||
m_pc.getAccount(ProductCost.ACCTTYPE_P_IPV, as),
|
|
||||||
C_Currency_ID, ipv);
|
|
||||||
pv.setC_Activity_ID(m_invoiceLine.getC_Activity_ID());
|
|
||||||
pv.setC_Campaign_ID(m_invoiceLine.getC_Campaign_ID());
|
|
||||||
pv.setC_Project_ID(m_invoiceLine.getC_Project_ID());
|
|
||||||
pv.setC_ProjectPhase_ID(m_invoiceLine.getC_ProjectPhase_ID());
|
|
||||||
pv.setC_ProjectTask_ID(m_invoiceLine.getC_ProjectTask_ID());
|
|
||||||
pv.setC_UOM_ID(m_invoiceLine.getC_UOM_ID());
|
|
||||||
pv.setUser1_ID(m_invoiceLine.getUser1_ID());
|
|
||||||
pv.setUser2_ID(m_invoiceLine.getUser2_ID());
|
|
||||||
}
|
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("IPV=" + ipv + "; Balance=" + fact.getSourceBalance());
|
|
||||||
facts.add(fact);
|
|
||||||
return facts;
|
|
||||||
}
|
}
|
||||||
cr.setQty(getQty().negate());
|
cr.setQty(getQty().negate());
|
||||||
temp = cr.getAcctBalance();
|
temp = cr.getAcctBalance();
|
||||||
|
@ -351,6 +333,8 @@ public class Doc_MatchInv extends Doc
|
||||||
if (m_invoiceLine != null && m_invoiceLine.get_ID() > 0
|
if (m_invoiceLine != null && m_invoiceLine.get_ID() > 0
|
||||||
&& m_receiptLine != null && m_receiptLine.get_ID() > 0)
|
&& m_receiptLine != null && m_receiptLine.get_ID() > 0)
|
||||||
{
|
{
|
||||||
|
MMatchInv matchInv = (MMatchInv)getPO();
|
||||||
|
|
||||||
BigDecimal LineNetAmt = m_invoiceLine.getLineNetAmt();
|
BigDecimal LineNetAmt = m_invoiceLine.getLineNetAmt();
|
||||||
BigDecimal multiplier = getQty()
|
BigDecimal multiplier = getQty()
|
||||||
.divide(m_invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP)
|
.divide(m_invoiceLine.getQtyInvoiced(), 12, BigDecimal.ROUND_HALF_UP)
|
||||||
|
@ -358,8 +342,6 @@ public class Doc_MatchInv extends Doc
|
||||||
if (multiplier.compareTo(Env.ONE) != 0)
|
if (multiplier.compareTo(Env.ONE) != 0)
|
||||||
LineNetAmt = LineNetAmt.multiply(multiplier);
|
LineNetAmt = LineNetAmt.multiply(multiplier);
|
||||||
|
|
||||||
// Source from Doc_MatchInv.createFacts(MAcctSchema)
|
|
||||||
// Cost Detail Record - data from Expense/IncClearing (CR) record
|
|
||||||
// MZ Goodwill
|
// MZ Goodwill
|
||||||
// Create Cost Detail Matched Invoice using Total Amount and Total Qty based on InvoiceLine
|
// Create Cost Detail Matched Invoice using Total Amount and Total Qty based on InvoiceLine
|
||||||
MMatchInv[] mInv = MMatchInv.getInvoiceLine(getCtx(), m_invoiceLine.getC_InvoiceLine_ID(), getTrxName());
|
MMatchInv[] mInv = MMatchInv.getInvoiceLine(getCtx(), m_invoiceLine.getC_InvoiceLine_ID(), getTrxName());
|
||||||
|
@ -367,7 +349,7 @@ public class Doc_MatchInv extends Doc
|
||||||
BigDecimal tAmt = Env.ZERO;
|
BigDecimal tAmt = Env.ZERO;
|
||||||
for (int i = 0 ; i < mInv.length ; i++)
|
for (int i = 0 ; i < mInv.length ; i++)
|
||||||
{
|
{
|
||||||
if (mInv[i].isPosted() && mInv[i].getM_MatchInv_ID() != get_ID())
|
if (mInv[i].isPosted() && mInv[i].getM_MatchInv_ID() != get_ID() && mInv[i].getM_AttributeSetInstance_ID() == matchInv.getM_AttributeSetInstance_ID())
|
||||||
{
|
{
|
||||||
tQty = tQty.add(mInv[i].getQty());
|
tQty = tQty.add(mInv[i].getQty());
|
||||||
multiplier = mInv[i].getQty()
|
multiplier = mInv[i].getQty()
|
||||||
|
@ -398,7 +380,6 @@ public class Doc_MatchInv extends Doc
|
||||||
else
|
else
|
||||||
tQty = tQty.add(getQty());
|
tQty = tQty.add(getQty());
|
||||||
|
|
||||||
MMatchInv matchInv = (MMatchInv)getPO();
|
|
||||||
// Set Total Amount and Total Quantity from Matched Invoice
|
// Set Total Amount and Total Quantity from Matched Invoice
|
||||||
if (!MCostDetail.createInvoice(as, getAD_Org_ID(),
|
if (!MCostDetail.createInvoice(as, getAD_Org_ID(),
|
||||||
getM_Product_ID(), matchInv.getM_AttributeSetInstance_ID(),
|
getM_Product_ID(), matchInv.getM_AttributeSetInstance_ID(),
|
||||||
|
|
|
@ -34,7 +34,7 @@ public class MColor extends X_AD_Color
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 8672637038417465668L;
|
private static final long serialVersionUID = 3054697070898921956L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Color Model
|
* Color Model
|
||||||
|
@ -49,6 +49,11 @@ public class MColor extends X_AD_Color
|
||||||
setName("-/-");
|
setName("-/-");
|
||||||
} // MColor
|
} // MColor
|
||||||
|
|
||||||
|
public MColor(Properties ctx, ResultSet rs, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* String Representation
|
* String Representation
|
||||||
* @return string
|
* @return string
|
||||||
|
|
|
@ -290,6 +290,8 @@ public class MCost extends X_M_Cost
|
||||||
if (retValue == null || retValue.signum() == 0)
|
if (retValue == null || retValue.signum() == 0)
|
||||||
retValue = getLastPOPrice(product, M_ASI_ID, Org_ID, as.getC_Currency_ID());
|
retValue = getLastPOPrice(product, M_ASI_ID, Org_ID, as.getC_Currency_ID());
|
||||||
}
|
}
|
||||||
|
else if (MCostElement.COSTINGMETHOD_StandardCosting.equals(costingMethod))
|
||||||
|
;
|
||||||
else if (MCostElement.COSTINGMETHOD_UserDefined.equals(costingMethod))
|
else if (MCostElement.COSTINGMETHOD_UserDefined.equals(costingMethod))
|
||||||
;
|
;
|
||||||
else
|
else
|
||||||
|
@ -1480,9 +1482,9 @@ public class MCost extends X_M_Cost
|
||||||
public void setWeightedAverage (BigDecimal amt, BigDecimal qty)
|
public void setWeightedAverage (BigDecimal amt, BigDecimal qty)
|
||||||
{
|
{
|
||||||
//amount must follow the sign of qty
|
//amount must follow the sign of qty
|
||||||
if (amt.signum() != 0 && amt.signum() != qty.signum())
|
if (amt.signum() != 0 && qty.signum() != 0 && amt.signum() != qty.signum())
|
||||||
{
|
{
|
||||||
amt = amt.multiply(BigDecimal.valueOf(-1.00d));
|
amt = amt.negate();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (getCurrentQty().add(qty).signum() < 0)
|
if (getCurrentQty().add(qty).signum() < 0)
|
||||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
import org.compiere.acct.Doc;
|
||||||
import org.compiere.model.X_M_CostHistory;
|
import org.compiere.model.X_M_CostHistory;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
@ -51,6 +52,12 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -448632684360931078L;
|
private static final long serialVersionUID = -448632684360931078L;
|
||||||
|
|
||||||
|
private static final String INOUTLINE_DOCBASETYPE_SQL =
|
||||||
|
"SELECT c.DocBaseType From M_InOut io " +
|
||||||
|
"INNER JOIN M_InOutLine iol ON io.M_InOut_ID=iol.M_InOut_ID " +
|
||||||
|
"INNER JOIN C_DocType c ON io.C_DocType_ID=c.C_DocType_ID " +
|
||||||
|
"WHERE iol.M_InOutLine_ID=?";
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create New Order Cost Detail for Purchase Orders.
|
* Create New Order Cost Detail for Purchase Orders.
|
||||||
* Called from Doc_MatchPO
|
* Called from Doc_MatchPO
|
||||||
|
@ -677,6 +684,20 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
return isSOTrx() && getM_InOutLine_ID() != 0;
|
return isSOTrx() && getM_InOutLine_ID() != 0;
|
||||||
} // isShipment
|
} // isShipment
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if return to vendor
|
||||||
|
*/
|
||||||
|
public boolean isVendorRMA()
|
||||||
|
{
|
||||||
|
if (!isSOTrx() && getM_InOutLine_ID() > 0)
|
||||||
|
{
|
||||||
|
String docBaseType = DB.getSQLValueString((String)null,
|
||||||
|
INOUTLINE_DOCBASETYPE_SQL, getM_InOutLine_ID());
|
||||||
|
return Doc.DOCTYPE_MatShipment.equals(docBaseType);
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is this a Delta Record (previously processed)?
|
* Is this a Delta Record (previously processed)?
|
||||||
* @return true if delta is not null
|
* @return true if delta is not null
|
||||||
|
@ -1036,8 +1057,11 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
|| getPP_Cost_Collector_ID() != 0)
|
|| getPP_Cost_Collector_ID() != 0)
|
||||||
{
|
{
|
||||||
boolean addition = qty.signum() > 0;
|
boolean addition = qty.signum() > 0;
|
||||||
|
boolean isVendorRMA = isVendorRMA();
|
||||||
//
|
//
|
||||||
if (ce.isAverageInvoice())
|
if (ce.isAverageInvoice())
|
||||||
|
{
|
||||||
|
if (!isVendorRMA)
|
||||||
{
|
{
|
||||||
if (addition)
|
if (addition)
|
||||||
{
|
{
|
||||||
|
@ -1053,23 +1077,35 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - AverageInv - " + cost);
|
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - AverageInv - " + cost);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
else if (ce.isAveragePO())
|
else if (ce.isAveragePO())
|
||||||
{
|
{
|
||||||
if (addition)
|
if (addition)
|
||||||
{
|
{
|
||||||
cost.setWeightedAverage(amt, qty);
|
cost.setWeightedAverage(amt, qty);
|
||||||
//shouldn't accumulate reversal of customer shipment qty and amt
|
//shouldn't accumulate reversal of customer shipment qty and amt
|
||||||
if (isShipment())
|
if (isShipment() && !isVendorRMA())
|
||||||
{
|
{
|
||||||
cost.setCumulatedQty(history.getOldCQty());
|
cost.setCumulatedQty(history.getOldCQty());
|
||||||
cost.setCumulatedAmt(history.getOldCAmt());
|
cost.setCumulatedAmt(history.getOldCAmt());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
if (isVendorRMA)
|
||||||
|
{
|
||||||
|
cost.setWeightedAverage(amt, qty);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||||
|
}
|
||||||
|
}
|
||||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - AveragePO - " + cost);
|
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - AveragePO - " + cost);
|
||||||
}
|
}
|
||||||
else if (ce.isFifo() || ce.isLifo())
|
else if (ce.isFifo() || ce.isLifo())
|
||||||
|
{
|
||||||
|
if (!isVendorRMA)
|
||||||
{
|
{
|
||||||
if (addition)
|
if (addition)
|
||||||
{
|
{
|
||||||
|
@ -1093,17 +1129,18 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - FiFo/Lifo - " + cost);
|
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - FiFo/Lifo - " + cost);
|
||||||
}
|
}
|
||||||
else if (ce.isLastInvoice())
|
}
|
||||||
|
else if (ce.isLastInvoice() && !isVendorRMA)
|
||||||
{
|
{
|
||||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - LastInv - " + cost);
|
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - LastInv - " + cost);
|
||||||
}
|
}
|
||||||
else if (ce.isLastPOPrice())
|
else if (ce.isLastPOPrice() && !isVendorRMA)
|
||||||
{
|
{
|
||||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - LastPO - " + cost);
|
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - LastPO - " + cost);
|
||||||
}
|
}
|
||||||
else if (ce.isStandardCosting())
|
else if (ce.isStandardCosting() && !isVendorRMA)
|
||||||
{
|
{
|
||||||
if (addition)
|
if (addition)
|
||||||
{
|
{
|
||||||
|
@ -1123,7 +1160,7 @@ public class MCostDetail extends X_M_CostDetail
|
||||||
}
|
}
|
||||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - Standard - " + cost);
|
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - Standard - " + cost);
|
||||||
}
|
}
|
||||||
else if (ce.isUserDefined())
|
else if (ce.isUserDefined() && !isVendorRMA)
|
||||||
{
|
{
|
||||||
// Interface
|
// Interface
|
||||||
if (addition)
|
if (addition)
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 3136835982476528825L;
|
private static final long serialVersionUID = 8722189788479132158L;
|
||||||
|
|
||||||
public MPaymentTransaction(Properties ctx, int C_PaymentTransaction_ID, String trxName) {
|
public MPaymentTransaction(Properties ctx, int C_PaymentTransaction_ID, String trxName) {
|
||||||
super(ctx, C_PaymentTransaction_ID, trxName);
|
super(ctx, C_PaymentTransaction_ID, trxName);
|
||||||
|
@ -656,4 +656,17 @@ public class MPaymentTransaction extends X_C_PaymentTransaction implements Proce
|
||||||
|
|
||||||
return MPaymentTransaction.getAllIDs(Table_Name, whereClause.toString(), trxName);
|
return MPaymentTransaction.getAllIDs(Table_Name, whereClause.toString(), trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* String Representation
|
||||||
|
* @return info
|
||||||
|
*/
|
||||||
|
public String toString ()
|
||||||
|
{
|
||||||
|
StringBuilder sb = new StringBuilder ("MPaymentTransaction[");
|
||||||
|
sb.append(get_ID()).append("-")
|
||||||
|
.append(",Receipt=").append(isReceipt())
|
||||||
|
.append(",PayAmt=").append(getPayAmt());
|
||||||
|
return sb.toString ();
|
||||||
|
} // toString
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
public class MQualityTestResult extends X_M_QualityTestResult {
|
public class MQualityTestResult extends X_M_QualityTestResult {
|
||||||
|
@ -7,11 +8,16 @@ public class MQualityTestResult extends X_M_QualityTestResult {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4253026765149175778L;
|
private static final long serialVersionUID = -5529865718027582930L;
|
||||||
|
|
||||||
public MQualityTestResult(Properties ctx, int M_QualityTestResult_ID,
|
public MQualityTestResult(Properties ctx, int M_QualityTestResult_ID,
|
||||||
String trxName) {
|
String trxName) {
|
||||||
super(ctx, M_QualityTestResult_ID, trxName);
|
super(ctx, M_QualityTestResult_ID, trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MQualityTestResult(Properties ctx, ResultSet rs,
|
||||||
|
String trxName) {
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ public class MReplication extends X_AD_Replication
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -7363193371925559167L;
|
private static final long serialVersionUID = -562186299848949607L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Load Constructor
|
* Load Constructor
|
||||||
|
@ -42,6 +43,11 @@ public class MReplication extends X_AD_Replication
|
||||||
super (ctx, AD_Replication_ID, trxName);
|
super (ctx, AD_Replication_ID, trxName);
|
||||||
} // MReplication
|
} // MReplication
|
||||||
|
|
||||||
|
public MReplication (Properties ctx, ResultSet rs, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Public Access
|
* Public Access
|
||||||
* @param DateLastRun date last run
|
* @param DateLastRun date last run
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -30,7 +31,7 @@ public class MReplicationLog extends X_AD_Replication_Log
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -5188563816312329819L;
|
private static final long serialVersionUID = -8815834636981996509L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new Log
|
* Create new Log
|
||||||
|
@ -48,4 +49,9 @@ public class MReplicationLog extends X_AD_Replication_Log
|
||||||
setP_Msg(P_Msg);
|
setP_Msg(P_Msg);
|
||||||
} // MReplicationLog
|
} // MReplicationLog
|
||||||
|
|
||||||
|
public MReplicationLog(Properties ctx, ResultSet rs, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
} // MReplicationLog
|
} // MReplicationLog
|
||||||
|
|
|
@ -16,6 +16,7 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.sql.Timestamp;
|
import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -30,7 +31,7 @@ public class MReplicationRun extends X_AD_Replication_Run
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 2619966943083677072L;
|
private static final long serialVersionUID = 7609847179225634980L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new Run
|
* Create new Run
|
||||||
|
@ -46,6 +47,11 @@ public class MReplicationRun extends X_AD_Replication_Run
|
||||||
super.setIsReplicated (false);
|
super.setIsReplicated (false);
|
||||||
} // MReplicationRun
|
} // MReplicationRun
|
||||||
|
|
||||||
|
public MReplicationRun (Properties ctx, ResultSet rs, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set Replication Flag
|
* Set Replication Flag
|
||||||
* @param IsReplicated replicated
|
* @param IsReplicated replicated
|
||||||
|
|
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ public class MReplicationStrategy extends X_AD_ReplicationStrategy {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -3017484140206284805L;
|
private static final long serialVersionUID = 7231926756021012730L;
|
||||||
public static final int REPLICATION_TABLE =0;
|
public static final int REPLICATION_TABLE =0;
|
||||||
public static final int REPLICATION_DOCUMENT =1;
|
public static final int REPLICATION_DOCUMENT =1;
|
||||||
|
|
||||||
|
@ -57,6 +58,10 @@ public class MReplicationStrategy extends X_AD_ReplicationStrategy {
|
||||||
super(ctx, AD_ReplicationStrategy_ID, trxName);
|
super(ctx, AD_ReplicationStrategy_ID, trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MReplicationStrategy(Properties ctx, ResultSet rs, String trxName) {
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the list the X_AD_ReplicationTable
|
* @return the list the X_AD_ReplicationTable
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class MSearchDefinition extends X_AD_SearchDefinition {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 2448668218372939766L;
|
private static final long serialVersionUID = -5366274782950561962L;
|
||||||
/** Constant for the searchtype table */
|
/** Constant for the searchtype table */
|
||||||
public static final String SEARCHTYPE_TABLE = "T";
|
public static final String SEARCHTYPE_TABLE = "T";
|
||||||
/** Constant for the searchtype query */
|
/** Constant for the searchtype query */
|
||||||
|
@ -67,6 +67,10 @@ public class MSearchDefinition extends X_AD_SearchDefinition {
|
||||||
super(ctx, AD_SearchDefinition_ID, trxName);
|
super(ctx, AD_SearchDefinition_ID, trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public MSearchDefinition(Properties ctx, ResultSet rs, String trxName) {
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns all SearchDefinition objects with the given transaction code
|
* Returns all SearchDefinition objects with the given transaction code
|
||||||
*
|
*
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.compiere.print;
|
||||||
|
|
||||||
import java.awt.Color;
|
import java.awt.Color;
|
||||||
import java.awt.SystemColor;
|
import java.awt.SystemColor;
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -36,11 +37,10 @@ import org.compiere.util.Util;
|
||||||
*/
|
*/
|
||||||
public class MPrintColor extends X_AD_PrintColor
|
public class MPrintColor extends X_AD_PrintColor
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 8352503254165120016L;
|
private static final long serialVersionUID = -5611659311562283304L;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Create Color in Database and save
|
* Create Color in Database and save
|
||||||
|
@ -139,6 +139,11 @@ public class MPrintColor extends X_AD_PrintColor
|
||||||
setIsDefault(false);
|
setIsDefault(false);
|
||||||
} // MPrintColor
|
} // MPrintColor
|
||||||
|
|
||||||
|
public MPrintColor(Properties ctx, ResultSet rs, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/** Color cached */
|
/** Color cached */
|
||||||
private Color m_cacheColor = null;
|
private Color m_cacheColor = null;
|
||||||
|
|
||||||
|
|
|
@ -18,6 +18,7 @@ package org.compiere.print;
|
||||||
|
|
||||||
import java.awt.Font;
|
import java.awt.Font;
|
||||||
import java.awt.GraphicsEnvironment;
|
import java.awt.GraphicsEnvironment;
|
||||||
|
import java.sql.ResultSet;
|
||||||
import java.util.Iterator;
|
import java.util.Iterator;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
@ -39,7 +40,7 @@ public class MPrintFont extends X_AD_PrintFont
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -4721840631004326810L;
|
private static final long serialVersionUID = -2986160498367260541L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -54,6 +55,11 @@ public class MPrintFont extends X_AD_PrintFont
|
||||||
setIsDefault(false);
|
setIsDefault(false);
|
||||||
} // MPrintFont
|
} // MPrintFont
|
||||||
|
|
||||||
|
public MPrintFont(Properties ctx, ResultSet rs, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/** Font cached */
|
/** Font cached */
|
||||||
private Font m_cacheFont = null;
|
private Font m_cacheFont = null;
|
||||||
|
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.compiere.model.PO;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Util;
|
||||||
import org.eevolution.model.I_DD_Order;
|
import org.eevolution.model.I_DD_Order;
|
||||||
import org.eevolution.model.I_HR_Process;
|
import org.eevolution.model.I_HR_Process;
|
||||||
import org.eevolution.model.I_PP_Cost_Collector;
|
import org.eevolution.model.I_PP_Cost_Collector;
|
||||||
|
@ -489,6 +490,12 @@ public class DocumentEngine implements DocAction
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
String error = DocumentEngine.postImmediate(Env.getCtx(), m_document.getAD_Client_ID(), m_document.get_Table_ID(), m_document.get_ID(), true, m_document.get_TrxName());
|
String error = DocumentEngine.postImmediate(Env.getCtx(), m_document.getAD_Client_ID(), m_document.get_Table_ID(), m_document.get_ID(), true, m_document.get_TrxName());
|
||||||
|
if (ACTION_Post.equals(m_action)) {
|
||||||
|
// forced post via process - throw exception to inform the caller about the error
|
||||||
|
if (! Util.isEmpty(error)) {
|
||||||
|
throw new AdempiereException(error);
|
||||||
|
}
|
||||||
|
}
|
||||||
return (error == null);
|
return (error == null);
|
||||||
} // postIt
|
} // postIt
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class MReportColumnSet extends X_PA_ReportColumnSet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 8636368829160472883L;
|
private static final long serialVersionUID = -3496781398287709753L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -55,6 +55,11 @@ public class MReportColumnSet extends X_PA_ReportColumnSet
|
||||||
loadColumns();
|
loadColumns();
|
||||||
} // MReportColumnSet
|
} // MReportColumnSet
|
||||||
|
|
||||||
|
public MReportColumnSet (Properties ctx, ResultSet rs, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/** Contained Columns */
|
/** Contained Columns */
|
||||||
private MReportColumn[] m_columns = null;
|
private MReportColumn[] m_columns = null;
|
||||||
|
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class MReportLineSet extends X_PA_ReportLineSet
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = -2540937629148624046L;
|
private static final long serialVersionUID = 6882950634644885097L;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
|
@ -55,6 +55,11 @@ public class MReportLineSet extends X_PA_ReportLineSet
|
||||||
loadLines();
|
loadLines();
|
||||||
} // MReportLineSet
|
} // MReportLineSet
|
||||||
|
|
||||||
|
public MReportLineSet (Properties ctx, ResultSet rs, String trxName)
|
||||||
|
{
|
||||||
|
super (ctx, rs, trxName);
|
||||||
|
}
|
||||||
|
|
||||||
/** Contained Lines */
|
/** Contained Lines */
|
||||||
private MReportLine[] m_lines = null;
|
private MReportLine[] m_lines = null;
|
||||||
|
|
||||||
|
|
|
@ -22,10 +22,10 @@ import java.sql.Savepoint;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
import java.util.concurrent.ConcurrentHashMap;
|
||||||
import java.util.concurrent.TimeUnit;
|
import java.util.concurrent.TimeUnit;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
|
@ -63,16 +63,11 @@ public class Trx
|
||||||
* @param createNew if false, null is returned if not found
|
* @param createNew if false, null is returned if not found
|
||||||
* @return Transaction or null
|
* @return Transaction or null
|
||||||
*/
|
*/
|
||||||
public static synchronized Trx get (String trxName, boolean createNew)
|
public static Trx get (String trxName, boolean createNew)
|
||||||
{
|
{
|
||||||
if (trxName == null || trxName.length() == 0)
|
if (trxName == null || trxName.length() == 0)
|
||||||
throw new IllegalArgumentException ("No Transaction Name");
|
throw new IllegalArgumentException ("No Transaction Name");
|
||||||
|
|
||||||
if (s_cache == null)
|
|
||||||
{
|
|
||||||
s_cache = new HashMap<String,Trx>(10);
|
|
||||||
}
|
|
||||||
|
|
||||||
Trx retValue = (Trx)s_cache.get(trxName);
|
Trx retValue = (Trx)s_cache.get(trxName);
|
||||||
if (retValue == null && createNew)
|
if (retValue == null && createNew)
|
||||||
{
|
{
|
||||||
|
@ -83,9 +78,9 @@ public class Trx
|
||||||
} // get
|
} // get
|
||||||
|
|
||||||
/** Transaction Cache */
|
/** Transaction Cache */
|
||||||
private static Map<String,Trx> s_cache = null; // create change listener
|
private static final Map<String,Trx> s_cache = new ConcurrentHashMap<String, Trx>();
|
||||||
|
|
||||||
private static Trx.TrxMonitor s_monitor = new Trx.TrxMonitor();
|
private static final Trx.TrxMonitor s_monitor = new Trx.TrxMonitor();
|
||||||
|
|
||||||
private List<TrxEventListener> listeners = new ArrayList<TrxEventListener>();
|
private List<TrxEventListener> listeners = new ArrayList<TrxEventListener>();
|
||||||
|
|
||||||
|
@ -171,7 +166,7 @@ public class Trx
|
||||||
* @param createNew if true, create new connection if the trx does not have one created yet
|
* @param createNew if true, create new connection if the trx does not have one created yet
|
||||||
* @return connection
|
* @return connection
|
||||||
*/
|
*/
|
||||||
public Connection getConnection(boolean createNew)
|
public synchronized Connection getConnection(boolean createNew)
|
||||||
{
|
{
|
||||||
if (log.isLoggable(Level.ALL))log.log(Level.ALL, "Active=" + isActive() + ", Connection=" + m_connection);
|
if (log.isLoggable(Level.ALL))log.log(Level.ALL, "Active=" + isActive() + ", Connection=" + m_connection);
|
||||||
|
|
||||||
|
@ -179,7 +174,7 @@ public class Trx
|
||||||
{
|
{
|
||||||
if (createNew)
|
if (createNew)
|
||||||
{
|
{
|
||||||
if (s_cache == null || !s_cache.containsKey(m_trxName))
|
if (!s_cache.containsKey(m_trxName))
|
||||||
{
|
{
|
||||||
new Exception("Illegal to getConnection for Trx that is not register.").printStackTrace();
|
new Exception("Illegal to getConnection for Trx that is not register.").printStackTrace();
|
||||||
return null;
|
return null;
|
||||||
|
@ -272,7 +267,7 @@ public class Trx
|
||||||
* @param throwException if true, re-throws exception
|
* @param throwException if true, re-throws exception
|
||||||
* @return true if success, false if failed or transaction already rollback
|
* @return true if success, false if failed or transaction already rollback
|
||||||
*/
|
*/
|
||||||
public boolean rollback(boolean throwException) throws SQLException
|
public synchronized boolean rollback(boolean throwException) throws SQLException
|
||||||
{
|
{
|
||||||
//local
|
//local
|
||||||
try
|
try
|
||||||
|
@ -351,7 +346,7 @@ public class Trx
|
||||||
* @param throwException if true, re-throws exception
|
* @param throwException if true, re-throws exception
|
||||||
* @return true if success
|
* @return true if success
|
||||||
**/
|
**/
|
||||||
public boolean commit(boolean throwException) throws SQLException
|
public synchronized boolean commit(boolean throwException) throws SQLException
|
||||||
{
|
{
|
||||||
//local
|
//local
|
||||||
try
|
try
|
||||||
|
@ -410,7 +405,6 @@ public class Trx
|
||||||
*/
|
*/
|
||||||
public synchronized boolean close()
|
public synchronized boolean close()
|
||||||
{
|
{
|
||||||
if (s_cache != null)
|
|
||||||
s_cache.remove(getTrxName());
|
s_cache.remove(getTrxName());
|
||||||
|
|
||||||
//local
|
//local
|
||||||
|
@ -459,7 +453,7 @@ public class Trx
|
||||||
* @return Savepoint
|
* @return Savepoint
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
*/
|
*/
|
||||||
public Savepoint setSavepoint(String name) throws SQLException {
|
public synchronized Savepoint setSavepoint(String name) throws SQLException {
|
||||||
if (m_connection == null)
|
if (m_connection == null)
|
||||||
getConnection();
|
getConnection();
|
||||||
|
|
||||||
|
@ -479,7 +473,7 @@ public class Trx
|
||||||
* @throws SQLException
|
* @throws SQLException
|
||||||
* @see {@link Connection#releaseSavepoint(Savepoint)}
|
* @see {@link Connection#releaseSavepoint(Savepoint)}
|
||||||
*/
|
*/
|
||||||
public void releaseSavepoint(Savepoint savepoint) throws SQLException
|
public synchronized void releaseSavepoint(Savepoint savepoint) throws SQLException
|
||||||
{
|
{
|
||||||
if (DB.isOracle())
|
if (DB.isOracle())
|
||||||
{
|
{
|
||||||
|
@ -519,9 +513,6 @@ public class Trx
|
||||||
*/
|
*/
|
||||||
public static Trx[] getActiveTransactions()
|
public static Trx[] getActiveTransactions()
|
||||||
{
|
{
|
||||||
if (s_cache == null)
|
|
||||||
return new Trx[0];
|
|
||||||
|
|
||||||
Collection<Trx> collections = s_cache.values();
|
Collection<Trx> collections = s_cache.values();
|
||||||
Trx[] trxs = new Trx[collections.size()];
|
Trx[] trxs = new Trx[collections.size()];
|
||||||
collections.toArray(trxs);
|
collections.toArray(trxs);
|
||||||
|
@ -626,19 +617,23 @@ public class Trx
|
||||||
* @param listener
|
* @param listener
|
||||||
*/
|
*/
|
||||||
public void addTrxEventListener(TrxEventListener listener) {
|
public void addTrxEventListener(TrxEventListener listener) {
|
||||||
|
synchronized (listeners) {
|
||||||
listeners.add(listener);
|
listeners.add(listener);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public boolean removeTrxEventListener(TrxEventListener listener) {
|
public boolean removeTrxEventListener(TrxEventListener listener) {
|
||||||
|
synchronized (listeners) {
|
||||||
return listeners.remove(listener);
|
return listeners.remove(listener);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
static class TrxMonitor implements Runnable
|
static class TrxMonitor implements Runnable
|
||||||
{
|
{
|
||||||
|
|
||||||
public void run()
|
public void run()
|
||||||
{
|
{
|
||||||
if (Trx.s_cache != null && !Trx.s_cache.isEmpty())
|
if (!Trx.s_cache.isEmpty())
|
||||||
{
|
{
|
||||||
Trx[] trxs = Trx.s_cache.values().toArray(new Trx[0]);
|
Trx[] trxs = Trx.s_cache.values().toArray(new Trx[0]);
|
||||||
for(int i = 0; i < trxs.length; i++)
|
for(int i = 0; i < trxs.length; i++)
|
||||||
|
|
|
@ -56,7 +56,10 @@ public class AdElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
M_Element mElement = findPO(ctx, element);
|
M_Element mElement = findPO(ctx, element);
|
||||||
if (mElement == null) {
|
if (mElement == null) {
|
||||||
int id = findIdByColumn(ctx, X_AD_Element.Table_Name, X_AD_Element.COLUMNNAME_ColumnName, ColumnName, /*ignorecase=*/true);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_Element.Table_Name, X_AD_Element.COLUMNNAME_ColumnName, ColumnName, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
mElement = new M_Element(ctx.ctx, id, getTrxName(ctx));
|
mElement = new M_Element(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
List<String> excludes = defaultExcludeList(X_AD_Element.Table_Name);
|
List<String> excludes = defaultExcludeList(X_AD_Element.Table_Name);
|
||||||
|
|
|
@ -64,7 +64,10 @@ public class AttachmentElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), "SELECT AD_Attachment_ID FROM AD_Attachment WHERE Record_ID="+Record_ID+" AND AD_Table_ID="+AD_Table_ID);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
DB.getSQLValue(getTrxName(ctx), "SELECT AD_Attachment_ID FROM AD_Attachment WHERE Record_ID="+Record_ID+" AND AD_Table_ID="+AD_Table_ID);
|
||||||
|
}
|
||||||
mAttachment = new MAttachment(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mAttachment = new MAttachment(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
if (mAttachment.is_new()) {
|
if (mAttachment.is_new()) {
|
||||||
mAttachment.setAD_Table_ID(AD_Table_ID);
|
mAttachment.setAD_Table_ID(AD_Table_ID);
|
||||||
|
|
|
@ -73,7 +73,10 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
||||||
filler.setTableReference("AD_Table_ID");
|
filler.setTableReference("AD_Table_ID");
|
||||||
tableid = mColumn.getAD_Table_ID();
|
tableid = mColumn.getAD_Table_ID();
|
||||||
}
|
}
|
||||||
int AD_Column_ID = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnName, "AD_Table", tableid, /*ignorecase=*/true);
|
int AD_Column_ID = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
AD_Column_ID = findIdByColumnAndParentId(ctx, "AD_Column", "ColumnName", columnName, "AD_Table", tableid, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
mColumn = new MColumn(ctx.ctx, AD_Column_ID > 0 ? AD_Column_ID : 0, getTrxName(ctx));
|
mColumn = new MColumn(ctx.ctx, AD_Column_ID > 0 ? AD_Column_ID : 0, getTrxName(ctx));
|
||||||
if (mColumn.getAD_Column_ID() == 0 && isOfficialId(element, "AD_Column_ID")) {
|
if (mColumn.getAD_Column_ID() == 0 && isOfficialId(element, "AD_Column_ID")) {
|
||||||
mColumn.setAD_Column_ID(getIntValue(element, "AD_Column_ID"));
|
mColumn.setAD_Column_ID(getIntValue(element, "AD_Column_ID"));
|
||||||
|
|
|
@ -48,7 +48,10 @@ public class DynValRuleElementHandler extends AbstractElementHandler {
|
||||||
X_AD_Val_Rule mValRule = findPO(ctx, element);
|
X_AD_Val_Rule mValRule = findPO(ctx, element);
|
||||||
if (mValRule == null)
|
if (mValRule == null)
|
||||||
{
|
{
|
||||||
int id = findIdByColumn(ctx, "AD_Val_Rule", "Name", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, "AD_Val_Rule", "Name", name);
|
||||||
|
}
|
||||||
mValRule = new X_AD_Val_Rule(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mValRule = new X_AD_Val_Rule(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
if (mValRule.getAD_Val_Rule_ID() == 0 && isOfficialId(element, "AD_Val_Rule_ID"))
|
if (mValRule.getAD_Val_Rule_ID() == 0 && isOfficialId(element, "AD_Val_Rule_ID"))
|
||||||
|
|
|
@ -61,7 +61,10 @@ public class EntityTypeElementHandler extends AbstractElementHandler{
|
||||||
X_AD_EntityType m_EntityType = findPO(ctx, element);
|
X_AD_EntityType m_EntityType = findPO(ctx, element);
|
||||||
|
|
||||||
if (m_EntityType == null) {
|
if (m_EntityType == null) {
|
||||||
int id = findIdByColumn(ctx, X_AD_EntityType.Table_Name, X_AD_EntityType.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_EntityType.Table_Name, X_AD_EntityType.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
m_EntityType = new X_AD_EntityType(ctx.ctx, id, getTrxName(ctx));
|
m_EntityType = new X_AD_EntityType(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,11 +100,14 @@ public class FieldElementHandler extends AbstractElementHandler {
|
||||||
MField mField = findPO(ctx, element);
|
MField mField = findPO(ctx, element);
|
||||||
if (mField == null)
|
if (mField == null)
|
||||||
{
|
{
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
StringBuffer sqlB = new StringBuffer(
|
StringBuffer sqlB = new StringBuffer(
|
||||||
"select AD_Field_ID from AD_Field where AD_Column_ID = ")
|
"select AD_Field_ID from AD_Field where AD_Column_ID = ")
|
||||||
.append(AD_Column_ID)
|
.append(AD_Column_ID)
|
||||||
.append(" and AD_Tab_ID = ?");
|
.append(" and AD_Tab_ID = ?");
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), tabid);
|
id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), tabid);
|
||||||
|
}
|
||||||
mField = new MField(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mField = new MField(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
if (mField.is_new()) {
|
if (mField.is_new()) {
|
||||||
mField.setAD_Column_ID(AD_Column_ID);
|
mField.setAD_Column_ID(AD_Column_ID);
|
||||||
|
|
|
@ -58,7 +58,10 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
||||||
X_AD_FieldGroup fieldGroup = findPO(ctx, element);
|
X_AD_FieldGroup fieldGroup = findPO(ctx, element);
|
||||||
if (fieldGroup == null)
|
if (fieldGroup == null)
|
||||||
{
|
{
|
||||||
int id = findIdByColumn(ctx, X_AD_FieldGroup.Table_Name, X_AD_FieldGroup.COLUMNNAME_Name, name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_FieldGroup.Table_Name, X_AD_FieldGroup.COLUMNNAME_Name, name);
|
||||||
|
}
|
||||||
fieldGroup = new X_AD_FieldGroup(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
fieldGroup = new X_AD_FieldGroup(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller pf = new PoFiller(ctx, fieldGroup, element, this);
|
PoFiller pf = new PoFiller(ctx, fieldGroup, element, this);
|
||||||
|
|
|
@ -66,10 +66,12 @@ public class FormAccessElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
Query query = new Query(ctx.ctx, "AD_Form_Access", "AD_Form_ID = ? AND AD_Role_ID = ?", getTrxName(ctx));
|
Query query = new Query(ctx.ctx, "AD_Form_Access", "AD_Form_ID = ? AND AD_Role_ID = ?", getTrxName(ctx));
|
||||||
po = query.setParameters(new Object[]{AD_Form_ID, AD_Role_ID})
|
po = query.setParameters(new Object[]{AD_Form_ID, AD_Role_ID})
|
||||||
.setClient_ID()
|
.setClient_ID()
|
||||||
.<MFormAccess>first();
|
.<MFormAccess>first();
|
||||||
|
}
|
||||||
if (po == null)
|
if (po == null)
|
||||||
{
|
{
|
||||||
po = new MFormAccess(ctx.ctx, 0, getTrxName(ctx));
|
po = new MFormAccess(ctx.ctx, 0, getTrxName(ctx));
|
||||||
|
|
|
@ -50,7 +50,10 @@ public class FormElementHandler extends AbstractElementHandler {
|
||||||
MForm mForm = findPO(ctx, element);
|
MForm mForm = findPO(ctx, element);
|
||||||
if (mForm == null) {
|
if (mForm == null) {
|
||||||
String name = getStringValue(element, "Name");
|
String name = getStringValue(element, "Name");
|
||||||
int id = findIdByName(ctx, "AD_Form", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_Form", name);
|
||||||
|
}
|
||||||
mForm = new MForm(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mForm = new MForm(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mForm, element, this);
|
PoFiller filler = new PoFiller(ctx, mForm, element, this);
|
||||||
|
|
|
@ -56,7 +56,10 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_ImpFormat mImpFormat = findPO(ctx, element);
|
X_AD_ImpFormat mImpFormat = findPO(ctx, element);
|
||||||
if (mImpFormat == null) {
|
if (mImpFormat == null) {
|
||||||
int id = findIdByName(ctx, "AD_ImpFormat", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_ImpFormat", name);
|
||||||
|
}
|
||||||
mImpFormat = new X_AD_ImpFormat(ctx.ctx, id > 0 ? id : 0,
|
mImpFormat = new X_AD_ImpFormat(ctx.ctx, id > 0 ? id : 0,
|
||||||
getTrxName(ctx));
|
getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
|
@ -102,8 +102,11 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
StringBuilder sqlB = new StringBuilder ("SELECT AD_ImpFormat_Row_ID FROM AD_ImpFormat_Row WHERE AD_Column_ID=? AND AD_ImpFormat_ID=?");
|
StringBuilder sqlB = new StringBuilder ("SELECT AD_ImpFormat_Row_ID FROM AD_ImpFormat_Row WHERE AD_Column_ID=? AND AD_ImpFormat_ID=?");
|
||||||
int id = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),columnId,impFormatId);
|
id = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),columnId,impFormatId);
|
||||||
|
}
|
||||||
mImpFormatRow = new X_AD_ImpFormat_Row(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mImpFormatRow = new X_AD_ImpFormat_Row(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
|
|
||||||
mImpFormatRow.setAD_Column_ID(columnId);
|
mImpFormatRow.setAD_Column_ID(columnId);
|
||||||
|
|
|
@ -59,8 +59,11 @@ public class MenuElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_Menu mMenu = findPO(ctx, element);
|
X_AD_Menu mMenu = findPO(ctx, element);
|
||||||
if (mMenu == null) {
|
if (mMenu == null) {
|
||||||
|
int menuId = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
String menuName = getStringValue(element, "Name");
|
String menuName = getStringValue(element, "Name");
|
||||||
int menuId = findIdByColumn(ctx, "AD_Menu", "Name", menuName);
|
menuId = findIdByColumn(ctx, "AD_Menu", "Name", menuName);
|
||||||
|
}
|
||||||
mMenu = new X_AD_Menu(ctx.ctx, menuId > 0 ? menuId : 0, getTrxName(ctx));
|
mMenu = new X_AD_Menu(ctx.ctx, menuId > 0 ? menuId : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mMenu, element, this);
|
PoFiller filler = new PoFiller(ctx, mMenu, element, this);
|
||||||
|
|
|
@ -46,9 +46,11 @@ public class MessageElementHandler extends AbstractElementHandler {
|
||||||
if (isProcessElement(ctx.ctx, entitytype)) {
|
if (isProcessElement(ctx.ctx, entitytype)) {
|
||||||
MMessage mMessage = findPO(ctx, element);
|
MMessage mMessage = findPO(ctx, element);
|
||||||
if (mMessage == null) {
|
if (mMessage == null) {
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
String value = getStringValue(element, "Value");
|
String value = getStringValue(element, "Value");
|
||||||
int id = findIdByColumn(ctx, "AD_Message", "value", value);
|
id = findIdByColumn(ctx, "AD_Message", "value", value);
|
||||||
|
}
|
||||||
mMessage = new MMessage(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mMessage = new MMessage(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mMessage, element, this);
|
PoFiller filler = new PoFiller(ctx, mMessage, element, this);
|
||||||
|
|
|
@ -37,7 +37,10 @@ public class ModelValidatorElementHandler extends AbstractElementHandler{
|
||||||
|
|
||||||
X_AD_ModelValidator validator = findPO(ctx, element);
|
X_AD_ModelValidator validator = findPO(ctx, element);
|
||||||
if (validator == null) {
|
if (validator == null) {
|
||||||
int id = findIdByColumn(ctx, X_AD_ModelValidator.Table_Name, X_AD_ModelValidator.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_ModelValidator.Table_Name, X_AD_ModelValidator.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
validator = new X_AD_ModelValidator(ctx.ctx, id, getTrxName(ctx));
|
validator = new X_AD_ModelValidator(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
List<String> excludes = defaultExcludeList(X_AD_ModelValidator.Table_Name);
|
List<String> excludes = defaultExcludeList(X_AD_ModelValidator.Table_Name);
|
||||||
|
|
|
@ -52,7 +52,10 @@ public class ModificationElementHandler extends AbstractElementHandler{
|
||||||
|
|
||||||
X_AD_Modification modification = findPO(ctx, element);
|
X_AD_Modification modification = findPO(ctx, element);
|
||||||
if (modification == null) {
|
if (modification == null) {
|
||||||
int id = findIdByColumn(ctx, X_AD_Modification.Table_Name, X_AD_Modification.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, X_AD_Modification.Table_Name, X_AD_Modification.COLUMNNAME_Name, name, /*ignorecase=*/true);
|
||||||
|
}
|
||||||
modification = new X_AD_Modification(ctx.ctx, id, getTrxName(ctx));
|
modification = new X_AD_Modification(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
List<String> excludes = defaultExcludeList(X_AD_Modification.Table_Name);
|
List<String> excludes = defaultExcludeList(X_AD_Modification.Table_Name);
|
||||||
|
|
|
@ -60,10 +60,12 @@ public class OrgRoleElementHandler extends AbstractElementHandler {
|
||||||
Element orgElement = element.properties.get("AD_Org_ID");
|
Element orgElement = element.properties.get("AD_Org_ID");
|
||||||
int orgId = ReferenceUtils.resolveReference(ctx.ctx, orgElement, getTrxName(ctx));
|
int orgId = ReferenceUtils.resolveReference(ctx.ctx, orgElement, getTrxName(ctx));
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
Query query = new Query(ctx.ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx));
|
Query query = new Query(ctx.ctx, "AD_Role_OrgAccess", "AD_Role_ID=? and AD_Org_ID=?", getTrxName(ctx));
|
||||||
po = query.setParameters(new Object[]{roleId, orgId})
|
po = query.setParameters(new Object[]{roleId, orgId})
|
||||||
.setClient_ID()
|
.setClient_ID()
|
||||||
.<X_AD_Role_OrgAccess>first();
|
.<X_AD_Role_OrgAccess>first();
|
||||||
|
}
|
||||||
|
|
||||||
if (po == null) {
|
if (po == null) {
|
||||||
po = new X_AD_Role_OrgAccess(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_Role_OrgAccess(ctx.ctx, 0, getTrxName(ctx));
|
||||||
|
|
|
@ -55,8 +55,11 @@ public class PrintFormatElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_PrintFormat mPrintFormat = findPO(ctx, element);
|
X_AD_PrintFormat mPrintFormat = findPO(ctx, element);
|
||||||
if (mPrintFormat == null) {
|
if (mPrintFormat == null) {
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
String name = getStringValue(element, "Name");
|
String name = getStringValue(element, "Name");
|
||||||
int id = findIdByColumn(ctx, "AD_PrintFormat", "Name", name);
|
id = findIdByColumn(ctx, "AD_PrintFormat", "Name", name);
|
||||||
|
}
|
||||||
mPrintFormat = new X_AD_PrintFormat(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mPrintFormat = new X_AD_PrintFormat(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mPrintFormat, element, this);
|
PoFiller filler = new PoFiller(ctx, mPrintFormat, element, this);
|
||||||
|
|
|
@ -64,8 +64,11 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
String name = getStringValue(element, "Name");
|
String name = getStringValue(element, "Name");
|
||||||
int id = findIdByNameAndParentId(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", parentId);
|
id = findIdByNameAndParentId(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", parentId);
|
||||||
|
}
|
||||||
mPrintFormatItem = new X_AD_PrintFormatItem(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mPrintFormatItem = new X_AD_PrintFormatItem(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mPrintFormatItem.setAD_PrintFormat_ID(parentId);
|
mPrintFormatItem.setAD_PrintFormat_ID(parentId);
|
||||||
excludes.add(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormat_ID);
|
excludes.add(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormat_ID);
|
||||||
|
|
|
@ -46,9 +46,12 @@ public class PrintPaperElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
if (printPaper == null) {
|
if (printPaper == null) {
|
||||||
String printPaperName = getStringValue(element, "Name", excludes);
|
String printPaperName = getStringValue(element, "Name", excludes);
|
||||||
int id = findIdByName(ctx, "AD_PrintPaper", printPaperName);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_PrintPaper", printPaperName);
|
||||||
|
}
|
||||||
printPaper = new X_AD_PrintPaper(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
printPaper = new X_AD_PrintPaper(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
|
printPaper.setName(printPaperName);
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, printPaper, element, this);
|
PoFiller filler = new PoFiller(ctx, printPaper, element, this);
|
||||||
|
|
||||||
|
|
|
@ -67,8 +67,10 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
Query query = new Query(ctx.ctx, "AD_Process_Access", "AD_Role_ID=? and AD_Process_ID=?", getTrxName(ctx));
|
Query query = new Query(ctx.ctx, "AD_Process_Access", "AD_Role_ID=? and AD_Process_ID=?", getTrxName(ctx));
|
||||||
po = query.setParameters(new Object[]{roleid, processid}).first();
|
po = query.setParameters(new Object[]{roleid, processid}).first();
|
||||||
|
}
|
||||||
if (po == null)
|
if (po == null)
|
||||||
{
|
{
|
||||||
po = new X_AD_Process_Access(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_Process_Access(ctx.ctx, 0, getTrxName(ctx));
|
||||||
|
|
|
@ -62,7 +62,10 @@ public class ProcessElementHandler extends AbstractElementHandler {
|
||||||
String value = getStringValue(element, "Value");
|
String value = getStringValue(element, "Value");
|
||||||
|
|
||||||
// Get New process.
|
// Get New process.
|
||||||
int id = findIdByColumn(ctx, "AD_Process", "Value", value);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, "AD_Process", "Value", value);
|
||||||
|
}
|
||||||
mProcess = new X_AD_Process(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mProcess = new X_AD_Process(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -69,7 +69,9 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
id = findIdByColumnAndParentId(ctx, "AD_Process_Para", "ColumnName", name, "AD_Process", masterId);
|
id = findIdByColumnAndParentId(ctx, "AD_Process_Para", "ColumnName", name, "AD_Process", masterId);
|
||||||
|
}
|
||||||
mProcessPara = new X_AD_Process_Para(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mProcessPara = new X_AD_Process_Para(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mProcessPara.setAD_Process_ID(masterId);
|
mProcessPara.setAD_Process_ID(masterId);
|
||||||
excludes.add(I_AD_Process_Para.COLUMNNAME_AD_Process_ID);
|
excludes.add(I_AD_Process_Para.COLUMNNAME_AD_Process_ID);
|
||||||
|
|
|
@ -60,7 +60,10 @@ public class ReferenceElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_Reference mReference = findPO(ctx, element);
|
X_AD_Reference mReference = findPO(ctx, element);
|
||||||
if (mReference == null) {
|
if (mReference == null) {
|
||||||
int id = findIdByName(ctx, "AD_Reference", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_Reference", name);
|
||||||
|
}
|
||||||
mReference = new X_AD_Reference(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mReference = new X_AD_Reference(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
List<String> excludes = defaultExcludeList(X_AD_Reference.Table_Name);
|
List<String> excludes = defaultExcludeList(X_AD_Reference.Table_Name);
|
||||||
|
|
|
@ -59,7 +59,10 @@ public class ReferenceListElementHandler extends AbstractElementHandler {
|
||||||
AD_Reference_ID = ReferenceUtils.resolveReference(ctx.ctx, referenceElement, getTrxName(ctx));
|
AD_Reference_ID = ReferenceUtils.resolveReference(ctx.ctx, referenceElement, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
int AD_Ref_List_ID = findIdByColumnAndParentId(ctx, "AD_Ref_List", "Value", value, "AD_Reference", AD_Reference_ID);
|
int AD_Ref_List_ID = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
AD_Ref_List_ID = findIdByColumnAndParentId(ctx, "AD_Ref_List", "Value", value, "AD_Reference", AD_Reference_ID);
|
||||||
|
}
|
||||||
mRefList = new X_AD_Ref_List(ctx.ctx, AD_Ref_List_ID, getTrxName(ctx));
|
mRefList = new X_AD_Ref_List(ctx.ctx, AD_Ref_List_ID, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,7 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
if (AD_Reference_ID <= 0 && isOfficialId(element, "AD_Reference_ID"))
|
if (AD_Reference_ID <= 0 && isOfficialId(element, "AD_Reference_ID"))
|
||||||
AD_Reference_ID = getIntValue(element, "AD_Reference_ID");
|
AD_Reference_ID = getIntValue(element, "AD_Reference_ID");
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
String sql = "SELECT * FROM AD_Ref_Table WHERE AD_Reference_ID = ?";
|
String sql = "SELECT * FROM AD_Ref_Table WHERE AD_Reference_ID = ?";
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
|
@ -84,6 +85,9 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
||||||
} finally {
|
} finally {
|
||||||
DB.close(rs, pstmt);
|
DB.close(rs, pstmt);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
refTable = new X_AD_Ref_Table(ctx.ctx, 0, getTrxName(ctx));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
String action = refTable.is_new() ? "New" : "Update";
|
String action = refTable.is_new() ? "New" : "Update";
|
||||||
PoFiller filler = new PoFiller(ctx, refTable, element, this);
|
PoFiller filler = new PoFiller(ctx, refTable, element, this);
|
||||||
|
|
|
@ -90,7 +90,10 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
||||||
sql.append(" AND FunctionColumn = ?");
|
sql.append(" AND FunctionColumn = ?");
|
||||||
sql.append(" AND AD_ReportView_ID = ?");
|
sql.append(" AND AD_ReportView_ID = ?");
|
||||||
|
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sql.toString(), functionColumn, AD_ReportView_ID);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = DB.getSQLValue(getTrxName(ctx), sql.toString(), functionColumn, AD_ReportView_ID);
|
||||||
|
}
|
||||||
mReportviewCol = new X_AD_ReportView_Col(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mReportviewCol = new X_AD_ReportView_Col(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mReportviewCol.setAD_ReportView_ID(AD_ReportView_ID);
|
mReportviewCol.setAD_ReportView_ID(AD_ReportView_ID);
|
||||||
if (AD_Column_ID > 0) {
|
if (AD_Column_ID > 0) {
|
||||||
|
|
|
@ -57,8 +57,11 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
X_AD_ReportView mReportview = findPO(ctx, element);
|
X_AD_ReportView mReportview = findPO(ctx, element);
|
||||||
if (mReportview == null) {
|
if (mReportview == null) {
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
String name = getStringValue(element, "Name");
|
String name = getStringValue(element, "Name");
|
||||||
int id = findIdByName(ctx, "AD_ReportView", name);
|
id = findIdByName(ctx, "AD_ReportView", name);
|
||||||
|
}
|
||||||
mReportview = new X_AD_ReportView(ctx.ctx, id, getTrxName(ctx));
|
mReportview = new X_AD_ReportView(ctx.ctx, id, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
PoFiller filler = new PoFiller(ctx, mReportview, element, this);
|
PoFiller filler = new PoFiller(ctx, mReportview, element, this);
|
||||||
|
|
|
@ -69,7 +69,10 @@ public class RoleElementHandler extends AbstractElementHandler {
|
||||||
MRole mRole = findPO(ctx, element);
|
MRole mRole = findPO(ctx, element);
|
||||||
if (mRole == null) {
|
if (mRole == null) {
|
||||||
String name = getStringValue(element, "Name", excludes);
|
String name = getStringValue(element, "Name", excludes);
|
||||||
int id = findIdByName(ctx, "AD_Role", name);
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_Role", name);
|
||||||
|
}
|
||||||
mRole = new MRole(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mRole = new MRole(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mRole.setName(name);
|
mRole.setName(name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -85,11 +85,14 @@ public class TabElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
String sql = "SELECT AD_Tab_ID FROM AD_Tab where AD_Window_ID = ? "
|
String sql = "SELECT AD_Tab_ID FROM AD_Tab where AD_Window_ID = ? "
|
||||||
+ " AND Name = ?"
|
+ " AND Name = ?"
|
||||||
+ " AND AD_Table_ID = ?";
|
+ " AND AD_Table_ID = ?";
|
||||||
|
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sql, windowId, name, tableId);
|
id = DB.getSQLValue(getTrxName(ctx), sql, windowId, name, tableId);
|
||||||
|
}
|
||||||
mTab = new MTab(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mTab = new MTab(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mTab.setAD_Table_ID(tableId);
|
mTab.setAD_Table_ID(tableId);
|
||||||
mTab.setName(name);
|
mTab.setName(name);
|
||||||
|
|
|
@ -58,9 +58,10 @@ public class TableElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
MTable mTable = findPO(ctx, element);
|
MTable mTable = findPO(ctx, element);
|
||||||
if (mTable == null) {
|
if (mTable == null) {
|
||||||
|
int id = 0;
|
||||||
String tableName = getStringValue(element, "TableName", excludes);
|
String tableName = getStringValue(element, "TableName", excludes);
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
int id = packIn.getTableId(tableName);
|
id = packIn.getTableId(tableName);
|
||||||
if (id <= 0) {
|
if (id <= 0) {
|
||||||
id = findIdByColumn(ctx, "AD_Table", "TableName", tableName);
|
id = findIdByColumn(ctx, "AD_Table", "TableName", tableName);
|
||||||
if (id > 0)
|
if (id > 0)
|
||||||
|
@ -69,6 +70,7 @@ public class TableElementHandler extends AbstractElementHandler {
|
||||||
if (id > 0 && isTableProcess(ctx, id)) {
|
if (id > 0 && isTableProcess(ctx, id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mTable = new MTable(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mTable = new MTable(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mTable.setTableName(tableName);
|
mTable.setTableName(tableName);
|
||||||
|
|
|
@ -67,8 +67,10 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
Query query = new Query(ctx.ctx, "AD_Task_Access", "AD_Role_ID=? and AD_Task_ID=?", getTrxName(ctx));
|
Query query = new Query(ctx.ctx, "AD_Task_Access", "AD_Role_ID=? and AD_Task_ID=?", getTrxName(ctx));
|
||||||
po = query.setParameters(new Object[]{roleid, taskid}).first();
|
po = query.setParameters(new Object[]{roleid, taskid}).first();
|
||||||
|
}
|
||||||
if (po == null){
|
if (po == null){
|
||||||
po = new X_AD_Task_Access(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_Task_Access(ctx.ctx, 0, getTrxName(ctx));
|
||||||
po.setAD_Role_ID(roleid);
|
po.setAD_Role_ID(roleid);
|
||||||
|
|
|
@ -50,8 +50,11 @@ public class TaskElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
MTask mTask = findPO(ctx, element);
|
MTask mTask = findPO(ctx, element);
|
||||||
if (mTask == null) {
|
if (mTask == null) {
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
String name = getStringValue(element, "Name");
|
String name = getStringValue(element, "Name");
|
||||||
int id = findIdByName(ctx, "AD_Task", name);
|
id = findIdByName(ctx, "AD_Task", name);
|
||||||
|
}
|
||||||
mTask = new MTask(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mTask = new MTask(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -73,8 +73,10 @@ public class UserRoleElementHandler extends AbstractElementHandler {
|
||||||
Element orgElement = element.properties.get(I_AD_User_Roles.COLUMNNAME_AD_Org_ID);
|
Element orgElement = element.properties.get(I_AD_User_Roles.COLUMNNAME_AD_Org_ID);
|
||||||
orgid = ReferenceUtils.resolveReference(ctx.ctx, orgElement, getTrxName(ctx));
|
orgid = ReferenceUtils.resolveReference(ctx.ctx, orgElement, getTrxName(ctx));
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
Query query = new Query(ctx.ctx, "AD_User_Roles", "AD_User_ID = ? AND AD_Role_ID = ? AND AD_Org_ID = ?", getTrxName(ctx));
|
Query query = new Query(ctx.ctx, "AD_User_Roles", "AD_User_ID = ? AND AD_Role_ID = ? AND AD_Org_ID = ?", getTrxName(ctx));
|
||||||
po = query.setParameters(new Object[]{userid, roleid, orgid}).first();
|
po = query.setParameters(new Object[]{userid, roleid, orgid}).first();
|
||||||
|
}
|
||||||
if (po == null) {
|
if (po == null) {
|
||||||
po = new X_AD_User_Roles(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_User_Roles(ctx.ctx, 0, getTrxName(ctx));
|
||||||
po.setAD_Org_ID(orgid);
|
po.setAD_Org_ID(orgid);
|
||||||
|
|
|
@ -66,8 +66,10 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
Query query = new Query(ctx.ctx, "AD_Window_Access", "AD_Role_ID=? and AD_Window_ID=?", getTrxName(ctx));
|
Query query = new Query(ctx.ctx, "AD_Window_Access", "AD_Role_ID=? and AD_Window_ID=?", getTrxName(ctx));
|
||||||
po = query.setParameters(new Object[]{roleid, windowid}).first();
|
po = query.setParameters(new Object[]{roleid, windowid}).first();
|
||||||
|
}
|
||||||
if (po == null) {
|
if (po == null) {
|
||||||
po = new X_AD_Window_Access(ctx.ctx, 0, getTrxName(ctx));
|
po = new X_AD_Window_Access(ctx.ctx, 0, getTrxName(ctx));
|
||||||
po.setAD_Role_ID(roleid);
|
po.setAD_Role_ID(roleid);
|
||||||
|
|
|
@ -63,12 +63,14 @@ public class WindowElementHandler extends AbstractElementHandler {
|
||||||
if (isProcessElement(ctx.ctx, entitytype)) {
|
if (isProcessElement(ctx.ctx, entitytype)) {
|
||||||
MWindow mWindow = findPO(ctx, element);
|
MWindow mWindow = findPO(ctx, element);
|
||||||
if (mWindow == null) {
|
if (mWindow == null) {
|
||||||
|
int id = 0;
|
||||||
String name = getStringValue(element, "Name", excludes);
|
String name = getStringValue(element, "Name", excludes);
|
||||||
int id = findIdByName(ctx, "AD_Window", name);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByName(ctx, "AD_Window", name);
|
||||||
if (id > 0 && windows.contains(id)) {
|
if (id > 0 && windows.contains(id)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
mWindow = new MWindow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mWindow = new MWindow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mWindow.setName(name);
|
mWindow.setName(name);
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -67,8 +67,10 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
|
||||||
element.unresolved = "AD_Workflow_ID";
|
element.unresolved = "AD_Workflow_ID";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
Query query = new Query(ctx.ctx, "AD_Workflow_Access", "AD_Role_ID=? and AD_Workflow_ID=?", getTrxName(ctx));
|
Query query = new Query(ctx.ctx, "AD_Workflow_Access", "AD_Role_ID=? and AD_Workflow_ID=?", getTrxName(ctx));
|
||||||
po = query.setParameters(new Object[]{roleid, workflowid}).first();
|
po = query.setParameters(new Object[]{roleid, workflowid}).first();
|
||||||
|
}
|
||||||
if (po == null) {
|
if (po == null) {
|
||||||
po = new MWorkflowAccess(ctx.ctx, 0, getTrxName(ctx));
|
po = new MWorkflowAccess(ctx.ctx, 0, getTrxName(ctx));
|
||||||
po.setAD_Role_ID(roleid);
|
po.setAD_Role_ID(roleid);
|
||||||
|
|
|
@ -63,12 +63,15 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
||||||
|
|
||||||
MWorkflow mWorkflow = findPO(ctx, element);
|
MWorkflow mWorkflow = findPO(ctx, element);
|
||||||
if (mWorkflow == null) {
|
if (mWorkflow == null) {
|
||||||
|
int id = 0;
|
||||||
String workflowValue = getStringValue(element, "Value", excludes);
|
String workflowValue = getStringValue(element, "Value", excludes);
|
||||||
int id = findIdByColumn(ctx, "AD_Workflow", "Value", workflowValue);
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
id = findIdByColumn(ctx, "AD_Workflow", "Value", workflowValue);
|
||||||
if (id > 0 && workflows.contains(id)) {
|
if (id > 0 && workflows.contains(id)) {
|
||||||
element.skip = true;
|
element.skip = true;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
mWorkflow = new MWorkflow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mWorkflow = new MWorkflow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mWorkflow.setValue(workflowValue);
|
mWorkflow.setValue(workflowValue);
|
||||||
|
|
|
@ -74,10 +74,12 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
String workflowNodeValue = getStringValue(element, "Value", excludes);
|
String workflowNodeValue = getStringValue(element, "Value", excludes);
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
StringBuilder sqlB = new StringBuilder(
|
StringBuilder sqlB = new StringBuilder(
|
||||||
"SELECT AD_WF_Node_ID FROM AD_WF_Node WHERE AD_Workflow_ID=? and Value =?");
|
"SELECT AD_WF_Node_ID FROM AD_WF_Node WHERE AD_Workflow_ID=? and Value =?");
|
||||||
|
id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeValue);
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeValue);
|
}
|
||||||
mWFNode = new MWFNode(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mWFNode = new MWFNode(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mWFNode.setValue(workflowNodeValue);
|
mWFNode.setValue(workflowNodeValue);
|
||||||
mWFNode.setAD_Workflow_ID(workflowId);
|
mWFNode.setAD_Workflow_ID(workflowId);
|
||||||
|
|
|
@ -78,9 +78,12 @@ public class WorkflowNodeNextConditionElementHandler extends
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int id = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
int seqNo = getIntValue(element, "SeqNo");
|
int seqNo = getIntValue(element, "SeqNo");
|
||||||
String sql = "SELECT AD_WF_NextCondition_ID FROM AD_WF_NextCondition WHERE AD_WF_NodeNext_ID =? AND SeqNo=?";
|
String sql = "SELECT AD_WF_NextCondition_ID FROM AD_WF_NextCondition WHERE AD_WF_NodeNext_ID =? AND SeqNo=?";
|
||||||
int id = DB.getSQLValue(getTrxName(ctx), sql, new Object[] {wfNodeNextId, seqNo});
|
id = DB.getSQLValue(getTrxName(ctx), sql, new Object[] {wfNodeNextId, seqNo});
|
||||||
|
}
|
||||||
|
|
||||||
mWFNodeNextCondition = new MWFNextCondition(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
mWFNodeNextCondition = new MWFNextCondition(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||||
mWFNodeNextCondition.setAD_WF_NodeNext_ID(wfNodeNextId);
|
mWFNodeNextCondition.setAD_WF_NodeNext_ID(wfNodeNextId);
|
||||||
|
|
|
@ -94,7 +94,10 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
int AD_WF_NodeNext_ID = DB.getSQLValue(getTrxName(ctx), "SELECT AD_WF_NodeNext_ID FROM AD_WF_NodeNext WHERE AD_WF_Node_ID=? and AD_WF_NEXT_ID =?", wfNodeId, AD_WF_Next_ID);
|
int AD_WF_NodeNext_ID = 0;
|
||||||
|
if (!hasUUIDKey(ctx, element)) {
|
||||||
|
AD_WF_NodeNext_ID = DB.getSQLValue(getTrxName(ctx), "SELECT AD_WF_NodeNext_ID FROM AD_WF_NodeNext WHERE AD_WF_Node_ID=? and AD_WF_NEXT_ID =?", wfNodeId, AD_WF_Next_ID);
|
||||||
|
}
|
||||||
|
|
||||||
mWFNodeNext = new MWFNodeNext(ctx.ctx, AD_WF_NodeNext_ID, getTrxName(ctx));
|
mWFNodeNext = new MWFNodeNext(ctx.ctx, AD_WF_NodeNext_ID, getTrxName(ctx));
|
||||||
mWFNodeNext.setAD_WF_Node_ID(wfNodeId);
|
mWFNodeNext.setAD_WF_Node_ID(wfNodeId);
|
||||||
|
|
|
@ -575,6 +575,24 @@ public abstract class AbstractElementHandler implements ElementHandler {
|
||||||
return po;
|
return po;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected boolean hasUUIDKey(PIPOContext ctx, Element element) {
|
||||||
|
String tableName = element.getElementValue();
|
||||||
|
String uuidColumn = PO.getUUIDColumnName(tableName);
|
||||||
|
String uuid = element.properties.get(uuidColumn).contents.toString();
|
||||||
|
return (uuid != null && uuid.trim().length() == 36);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected String getUUIDKey(PIPOContext ctx, Element element) {
|
||||||
|
String tableName = element.getElementValue();
|
||||||
|
String uuidColumn = PO.getUUIDColumnName(tableName);
|
||||||
|
if (element.properties.containsKey(uuidColumn)) {
|
||||||
|
String uuid = element.properties.get(uuidColumn).contents.toString();
|
||||||
|
if (uuid != null && uuid.trim().length() == 36)
|
||||||
|
return uuid.trim();
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @param atts
|
* @param atts
|
||||||
|
|
|
@ -81,7 +81,7 @@ public class AdempiereActivator implements BundleActivator, ServiceTrackerCustom
|
||||||
|
|
||||||
String where = "Name=? AND PK_Version LIKE ?";
|
String where = "Name=? AND PK_Version LIKE ?";
|
||||||
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
||||||
where.toString(), trxName);
|
where.toString(), null);
|
||||||
q.setParameters(new Object[] { getName(), version + "%" });
|
q.setParameters(new Object[] { getName(), version + "%" });
|
||||||
X_AD_Package_Imp pkg = q.first();
|
X_AD_Package_Imp pkg = q.first();
|
||||||
if (pkg == null) {
|
if (pkg == null) {
|
||||||
|
|
|
@ -9,14 +9,13 @@ import java.util.Properties;
|
||||||
|
|
||||||
import org.adempiere.server.IServerFactory;
|
import org.adempiere.server.IServerFactory;
|
||||||
import org.compiere.model.MIMPProcessor;
|
import org.compiere.model.MIMPProcessor;
|
||||||
import org.compiere.server.AdempiereServer;
|
|
||||||
import org.compiere.server.ReplicationProcessor;
|
import org.compiere.server.ReplicationProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public class ReplicationServerFactory implements IServerFactory {
|
public class ReplicationServerFactory implements IServerFactory<ReplicationProcessor, MIMPProcessor> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* default constructor
|
* default constructor
|
||||||
|
@ -28,17 +27,21 @@ public class ReplicationServerFactory implements IServerFactory {
|
||||||
* @see org.adempiere.server.IServerFactory#create()
|
* @see org.adempiere.server.IServerFactory#create()
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public AdempiereServer[] create(Properties ctx) {
|
public ReplicationProcessor[] create(Properties ctx) {
|
||||||
List<AdempiereServer> list = new ArrayList<AdempiereServer>();
|
List<ReplicationProcessor> list = new ArrayList<ReplicationProcessor>();
|
||||||
MIMPProcessor[] importModels = MIMPProcessor.getActive(ctx);
|
MIMPProcessor[] importModels = MIMPProcessor.getActive(ctx);
|
||||||
for (int i = 0; i < importModels.length; i++)
|
for (MIMPProcessor lp : importModels)
|
||||||
{
|
{
|
||||||
MIMPProcessor lp = importModels[i];
|
ReplicationProcessor server = new ReplicationProcessor(lp);
|
||||||
AdempiereServer server = new ReplicationProcessor(lp);
|
|
||||||
list.add(server);
|
list.add(server);
|
||||||
}
|
}
|
||||||
AdempiereServer[] servers = list.toArray(new AdempiereServer[0]);
|
ReplicationProcessor[] servers = list.toArray(new ReplicationProcessor[0]);
|
||||||
return servers;
|
return servers;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MIMPProcessor> getProcessorClass() {
|
||||||
|
return MIMPProcessor.class;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,18 +48,17 @@ import org.compiere.model.MIMPProcessorLog;
|
||||||
public class ReplicationProcessor extends AdempiereServer {
|
public class ReplicationProcessor extends AdempiereServer {
|
||||||
|
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
|
|
||||||
/** Client info */
|
/** Client info */
|
||||||
@SuppressWarnings("unused")
|
protected MClient m_client = null;
|
||||||
private MClient m_client = null;
|
|
||||||
|
|
||||||
private MIMPProcessor mImportProcessor = null;
|
protected MIMPProcessor mImportProcessor = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* flag showing if process is working!
|
* flag showing if process is working!
|
||||||
*/
|
*/
|
||||||
private boolean isProcessRunning = false;
|
protected boolean isProcessRunning = false;
|
||||||
|
|
||||||
|
|
||||||
/*protected ReplicationProcessor(MIMPProcessor model, int initialNap) {
|
/*protected ReplicationProcessor(MIMPProcessor model, int initialNap) {
|
||||||
|
@ -78,7 +77,7 @@ public class ReplicationProcessor extends AdempiereServer {
|
||||||
super (model, initialNap);
|
super (model, initialNap);
|
||||||
mImportProcessor = (MIMPProcessor)model;
|
mImportProcessor = (MIMPProcessor)model;
|
||||||
m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID());
|
m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID());
|
||||||
}
|
}
|
||||||
public ReplicationProcessor(AdempiereProcessor model) {
|
public ReplicationProcessor(AdempiereProcessor model) {
|
||||||
super (model, 30);
|
super (model, 30);
|
||||||
mImportProcessor =(MIMPProcessor)model;
|
mImportProcessor =(MIMPProcessor)model;
|
||||||
|
|
|
@ -20,6 +20,11 @@
|
||||||
<arguments>
|
<arguments>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
<buildCommand>
|
||||||
|
<name>org.eclipse.pde.ds.core.builder</name>
|
||||||
|
<arguments>
|
||||||
|
</arguments>
|
||||||
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
|
|
@ -32,4 +32,8 @@ Import-Package: javax.jms;version="1.1.0",
|
||||||
org.restlet.service,
|
org.restlet.service,
|
||||||
org.restlet.util
|
org.restlet.util
|
||||||
Export-Package: org.adempiere.server,
|
Export-Package: org.adempiere.server,
|
||||||
org.compiere.server
|
org.compiere.ldap,
|
||||||
|
org.compiere.server,
|
||||||
|
org.idempiere.server.factory
|
||||||
|
Bundle-ActivationPolicy: lazy
|
||||||
|
Service-Component: OSGI-INF/acctprocessorfactory.xml, OSGI-INF/alertprocessorfactory.xml, OSGI-INF/ldapprocessorfactory.xml, OSGI-INF/requestprocessorfactory.xml, OSGI-INF/schedulerfactory.xml, OSGI-INF/workflowprocessorfactory.xml
|
||||||
|
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultacctprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultAcctProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultalertprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultAlertProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultldapprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultLDAPProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultrequestprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultRequestProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultscheduler">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultSchedulerFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -0,0 +1,8 @@
|
||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.server.factory.defaultworkflowprocessor">
|
||||||
|
<implementation class="org.idempiere.server.factory.DefaultWorkflowProcessorFactory"/>
|
||||||
|
<property name="service.ranking" type="Integer" value="0"/>
|
||||||
|
<service>
|
||||||
|
<provide interface="org.adempiere.server.IServerFactory"/>
|
||||||
|
</service>
|
||||||
|
</scr:component>
|
|
@ -20,12 +20,19 @@ bin.includes = META-INF/,\
|
||||||
standard.css,\
|
standard.css,\
|
||||||
webstart.jpg,\
|
webstart.jpg,\
|
||||||
zip.gif,\
|
zip.gif,\
|
||||||
plugin.xml
|
plugin.xml,\
|
||||||
|
OSGI-INF/acctprocessorfactory.xml,\
|
||||||
|
OSGI-INF/alertprocessorfactory.xml,\
|
||||||
|
OSGI-INF/ldapprocessorfactory.xml,\
|
||||||
|
OSGI-INF/requestprocessorfactory.xml,\
|
||||||
|
OSGI-INF/schedulerfactory.xml,\
|
||||||
|
OSGI-INF/workflowprocessorfactory.xml,\
|
||||||
|
OSGI-INF/
|
||||||
|
output.. = build/classes/
|
||||||
|
source.. = src/main/server/,\
|
||||||
|
src/main/servlet/
|
||||||
bin.excludes = src/**,\
|
bin.excludes = src/**,\
|
||||||
.settings/**,\
|
.settings/**,\
|
||||||
.classpath,\
|
.classpath,\
|
||||||
.project,\
|
.project,\
|
||||||
build.properties
|
build.properties
|
||||||
source.. = src/main/server/,\
|
|
||||||
src/main/servlet/
|
|
||||||
output.. = build/classes/
|
|
||||||
|
|
|
@ -15,6 +15,7 @@ package org.adempiere.server;
|
||||||
|
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.compiere.model.AdempiereProcessor;
|
||||||
import org.compiere.server.AdempiereServer;
|
import org.compiere.server.AdempiereServer;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -22,8 +23,18 @@ import org.compiere.server.AdempiereServer;
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IServerFactory {
|
public interface IServerFactory<S extends AdempiereServer, M extends AdempiereProcessor> {
|
||||||
|
|
||||||
// Class implementing this method must take into account if the server can be ran on this IP
|
/**
|
||||||
public AdempiereServer[] create (Properties ctx);
|
* @param ctx
|
||||||
|
* @return list of AdempiereServer
|
||||||
|
*/
|
||||||
|
public S[] create (Properties ctx);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* The Adempiere Server Manager will used this to avoid running duplicate server for the same
|
||||||
|
* AdempiereProcessor model.
|
||||||
|
* @return Fully qualified AdempiereProcessor model class name
|
||||||
|
*/
|
||||||
|
public Class<M> getProcessorClass();
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,13 +46,13 @@ public class LdapProcessor extends AdempiereServer
|
||||||
} // LdapProcessor
|
} // LdapProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MLdapProcessor m_model = null;
|
protected MLdapProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Server Socket */
|
/** Server Socket */
|
||||||
private ServerSocket m_serverSocket = null;
|
protected ServerSocket m_serverSocket = null;
|
||||||
/** Counter */
|
/** Counter */
|
||||||
private int m_counter = 0;
|
protected int m_counter = 0;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -56,13 +56,13 @@ public class AcctProcessor extends AdempiereServer
|
||||||
} // AcctProcessor
|
} // AcctProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MAcctProcessor m_model = null;
|
protected MAcctProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Client onfo */
|
/** Client onfo */
|
||||||
private MClient m_client = null;
|
protected MClient m_client = null;
|
||||||
/** Accounting Schemata */
|
/** Accounting Schemata */
|
||||||
private MAcctSchema[] m_ass = null;
|
protected MAcctSchema[] m_ass = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work
|
* Work
|
||||||
|
|
|
@ -20,22 +20,15 @@ import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.ldap.LdapProcessor;
|
|
||||||
import org.compiere.model.AdempiereProcessor;
|
import org.compiere.model.AdempiereProcessor;
|
||||||
import org.compiere.model.AdempiereProcessor2;
|
import org.compiere.model.AdempiereProcessor2;
|
||||||
import org.compiere.model.AdempiereProcessorLog;
|
import org.compiere.model.AdempiereProcessorLog;
|
||||||
import org.compiere.model.MAcctProcessor;
|
|
||||||
import org.compiere.model.MAlertProcessor;
|
|
||||||
import org.compiere.model.MClient;
|
import org.compiere.model.MClient;
|
||||||
import org.compiere.model.MLdapProcessor;
|
|
||||||
import org.compiere.model.MRequestProcessor;
|
|
||||||
import org.compiere.model.MSchedule;
|
import org.compiere.model.MSchedule;
|
||||||
import org.compiere.model.MScheduler;
|
|
||||||
import org.compiere.model.MSystem;
|
import org.compiere.model.MSystem;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.TimeUtil;
|
import org.compiere.util.TimeUtil;
|
||||||
import org.compiere.wf.MWorkflowProcessor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adempiere Server Base
|
* Adempiere Server Base
|
||||||
|
@ -45,31 +38,6 @@ import org.compiere.wf.MWorkflowProcessor;
|
||||||
*/
|
*/
|
||||||
public abstract class AdempiereServer implements Runnable
|
public abstract class AdempiereServer implements Runnable
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Create New Server Thead
|
|
||||||
* @param model model
|
|
||||||
* @return server tread or null
|
|
||||||
*/
|
|
||||||
public static AdempiereServer create (AdempiereProcessor model)
|
|
||||||
{
|
|
||||||
if (! isOKtoRunOnIP(model))
|
|
||||||
return null;
|
|
||||||
if (model instanceof MRequestProcessor)
|
|
||||||
return new RequestProcessor ((MRequestProcessor)model);
|
|
||||||
if (model instanceof MWorkflowProcessor)
|
|
||||||
return new WorkflowProcessor ((MWorkflowProcessor)model);
|
|
||||||
if (model instanceof MAcctProcessor)
|
|
||||||
return new AcctProcessor ((MAcctProcessor)model);
|
|
||||||
if (model instanceof MAlertProcessor)
|
|
||||||
return new AlertProcessor ((MAlertProcessor)model);
|
|
||||||
if (model instanceof MScheduler)
|
|
||||||
return new Scheduler ((MScheduler)model);
|
|
||||||
if (model instanceof MLdapProcessor)
|
|
||||||
return new LdapProcessor((MLdapProcessor)model);
|
|
||||||
//
|
|
||||||
throw new IllegalArgumentException("Unknown Processor");
|
|
||||||
} // create
|
|
||||||
|
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Server Base Class
|
* Server Base Class
|
||||||
|
|
|
@ -27,15 +27,10 @@ import java.util.logging.Level;
|
||||||
import org.adempiere.base.Service;
|
import org.adempiere.base.Service;
|
||||||
import org.adempiere.server.IServerFactory;
|
import org.adempiere.server.IServerFactory;
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.model.MAcctProcessor;
|
import org.compiere.model.AdempiereProcessor;
|
||||||
import org.compiere.model.MAlertProcessor;
|
|
||||||
import org.compiere.model.MLdapProcessor;
|
|
||||||
import org.compiere.model.MRequestProcessor;
|
|
||||||
import org.compiere.model.MScheduler;
|
|
||||||
import org.compiere.model.MSession;
|
import org.compiere.model.MSession;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.wf.MWorkflowProcessor;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Adempiere Server Manager
|
* Adempiere Server Manager
|
||||||
|
@ -105,102 +100,38 @@ public class AdempiereServerMgr
|
||||||
* Start Environment
|
* Start Environment
|
||||||
* @return true if started
|
* @return true if started
|
||||||
*/
|
*/
|
||||||
|
@SuppressWarnings("rawtypes")
|
||||||
public boolean startServers()
|
public boolean startServers()
|
||||||
{
|
{
|
||||||
log.info("");
|
log.info("");
|
||||||
int noServers = 0;
|
int noServers = 0;
|
||||||
m_servers=new ArrayList<ServerWrapper>();
|
m_servers=new ArrayList<ServerWrapper>();
|
||||||
// Accounting
|
|
||||||
MAcctProcessor[] acctModels = MAcctProcessor.getActive(m_ctx);
|
|
||||||
for (int i = 0; i < acctModels.length; i++)
|
|
||||||
{
|
|
||||||
MAcctProcessor pModel = acctModels[i];
|
|
||||||
AdempiereServer server = AdempiereServer.create(pModel);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Request
|
|
||||||
MRequestProcessor[] requestModels = MRequestProcessor.getActive(m_ctx);
|
|
||||||
for (int i = 0; i < requestModels.length; i++)
|
|
||||||
{
|
|
||||||
MRequestProcessor pModel = requestModels[i];
|
|
||||||
AdempiereServer server = AdempiereServer.create(pModel);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Workflow
|
|
||||||
MWorkflowProcessor[] workflowModels = MWorkflowProcessor.getActive(m_ctx);
|
|
||||||
for (int i = 0; i < workflowModels.length; i++)
|
|
||||||
{
|
|
||||||
MWorkflowProcessor pModel = workflowModels[i];
|
|
||||||
AdempiereServer server = AdempiereServer.create(pModel);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Alert
|
|
||||||
MAlertProcessor[] alertModels = MAlertProcessor.getActive(m_ctx);
|
|
||||||
for (int i = 0; i < alertModels.length; i++)
|
|
||||||
{
|
|
||||||
MAlertProcessor pModel = alertModels[i];
|
|
||||||
AdempiereServer server = AdempiereServer.create(pModel);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// Scheduler
|
|
||||||
MScheduler[] schedulerModels = MScheduler.getActive(m_ctx);
|
|
||||||
for (int i = 0; i < schedulerModels.length; i++)
|
|
||||||
{
|
|
||||||
MScheduler pModel = schedulerModels[i];
|
|
||||||
AdempiereServer server = AdempiereServer.create(pModel);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-2);
|
|
||||||
m_servers.add(new ServerWrapper(server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// LDAP
|
|
||||||
MLdapProcessor[] ldapModels = MLdapProcessor.getActive(m_ctx);
|
|
||||||
for (int i = 0; i < ldapModels.length; i++)
|
|
||||||
{
|
|
||||||
MLdapProcessor lp = ldapModels[i];
|
|
||||||
AdempiereServer server = AdempiereServer.create(lp);
|
|
||||||
if (server != null) {
|
|
||||||
// server.start();
|
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-1);
|
|
||||||
m_servers.add(new ServerWrapper(server));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//osgi server
|
//osgi server
|
||||||
List<IServerFactory> serverFactoryList = Service.locator().list(IServerFactory.class).getServices();
|
List<IServerFactory> serverFactoryList = Service.locator().list(IServerFactory.class).getServices();
|
||||||
if (serverFactoryList != null && !serverFactoryList.isEmpty())
|
if (serverFactoryList != null && !serverFactoryList.isEmpty())
|
||||||
{
|
{
|
||||||
|
List<String> processed = new ArrayList<String>();
|
||||||
for(IServerFactory factory : serverFactoryList )
|
for(IServerFactory factory : serverFactoryList )
|
||||||
{
|
{
|
||||||
|
String name = factory.getProcessorClass().getName();
|
||||||
|
if (!processed.contains(name))
|
||||||
|
{
|
||||||
|
processed.add(name);
|
||||||
AdempiereServer[] servers = factory.create(m_ctx);
|
AdempiereServer[] servers = factory.create(m_ctx);
|
||||||
if (servers != null && servers.length > 0)
|
if (servers != null && servers.length > 0)
|
||||||
{
|
{
|
||||||
for (AdempiereServer server : servers)
|
for (AdempiereServer server : servers)
|
||||||
{
|
{
|
||||||
// server.start();
|
AdempiereProcessor model = server.getModel();
|
||||||
// server.setPriority(Thread.NORM_PRIORITY-1);
|
if (AdempiereServer.isOKtoRunOnIP(model)) {
|
||||||
m_servers.add(new ServerWrapper(server));
|
m_servers.add(new ServerWrapper(server));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (log.isLoggable(Level.FINE)) log.fine("#" + noServers);
|
if (log.isLoggable(Level.FINE)) log.fine("#" + noServers);
|
||||||
return startAll();
|
return startAll();
|
||||||
|
|
|
@ -72,13 +72,13 @@ public class AlertProcessor extends AdempiereServer
|
||||||
} // AlertProcessor
|
} // AlertProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MAlertProcessor m_model = null;
|
protected MAlertProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Last Error Msg */
|
/** Last Error Msg */
|
||||||
private StringBuffer m_errors = new StringBuffer();
|
protected StringBuffer m_errors = new StringBuffer();
|
||||||
/** Client info */
|
/** Client info */
|
||||||
private MClient m_client = null;
|
protected MClient m_client = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work
|
* Work
|
||||||
|
@ -119,7 +119,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @param alert alert
|
* @param alert alert
|
||||||
* @return true if processed
|
* @return true if processed
|
||||||
*/
|
*/
|
||||||
private boolean processAlert (MAlert alert)
|
protected boolean processAlert (MAlert alert)
|
||||||
{
|
{
|
||||||
if (!alert.isValid())
|
if (!alert.isValid())
|
||||||
return false;
|
return false;
|
||||||
|
@ -240,7 +240,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @param attachments
|
* @param attachments
|
||||||
* @return how many email were sent
|
* @return how many email were sent
|
||||||
*/
|
*/
|
||||||
private int notifyUsers(Collection<Integer> users, String subject, String message, Collection<File> attachments)
|
protected int notifyUsers(Collection<Integer> users, String subject, String message, Collection<File> attachments)
|
||||||
{
|
{
|
||||||
int countMail = 0;
|
int countMail = 0;
|
||||||
for (int user_id : users) {
|
for (int user_id : users) {
|
||||||
|
@ -289,7 +289,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @return data
|
* @return data
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private ArrayList<ArrayList<Object>> getData (String sql, String trxName) throws Exception
|
protected ArrayList<ArrayList<Object>> getData (String sql, String trxName) throws Exception
|
||||||
{
|
{
|
||||||
ArrayList<ArrayList<Object>> data = new ArrayList<ArrayList<Object>>();
|
ArrayList<ArrayList<Object>> data = new ArrayList<ArrayList<Object>>();
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
|
@ -351,7 +351,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @return list of rows & values
|
* @return list of rows & values
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String getPlainTextReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
|
protected String getPlainTextReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
StringBuilder result = new StringBuilder();
|
StringBuilder result = new StringBuilder();
|
||||||
|
@ -407,7 +407,7 @@ public class AlertProcessor extends AdempiereServer
|
||||||
* @return summary message to be added into mail content
|
* @return summary message to be added into mail content
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String getExcelReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
|
protected String getExcelReport(MAlertRule rule, String sql, String trxName, Collection<File> attachments)
|
||||||
throws Exception
|
throws Exception
|
||||||
{
|
{
|
||||||
ArrayList<ArrayList<Object>> data = getData(sql, trxName);
|
ArrayList<ArrayList<Object>> data = getData(sql, trxName);
|
||||||
|
|
|
@ -69,30 +69,30 @@ public class EMailProcessor
|
||||||
} // EMail
|
} // EMail
|
||||||
|
|
||||||
/** EMail Host Parameter */
|
/** EMail Host Parameter */
|
||||||
private String m_host = null;
|
protected String m_host = null;
|
||||||
/** EMail User Parameter */
|
/** EMail User Parameter */
|
||||||
private String m_user = null;
|
protected String m_user = null;
|
||||||
/** Password Parameter */
|
/** Password Parameter */
|
||||||
private String m_pass = null;
|
protected String m_pass = null;
|
||||||
|
|
||||||
/** Session */
|
/** Session */
|
||||||
private Session m_session = null;
|
protected Session m_session = null;
|
||||||
/** Store */
|
/** Store */
|
||||||
private Store m_store = null;
|
protected Store m_store = null;
|
||||||
|
|
||||||
|
|
||||||
/** Logger */
|
/** Logger */
|
||||||
protected CLogger log = CLogger.getCLogger(getClass());
|
protected CLogger log = CLogger.getCLogger(getClass());
|
||||||
|
|
||||||
/** Process Error */
|
/** Process Error */
|
||||||
private static final int ERROR = 0;
|
protected static final int ERROR = 0;
|
||||||
/** Process Request */
|
/** Process Request */
|
||||||
private static final int REQUEST = 1;
|
protected static final int REQUEST = 1;
|
||||||
/** Process Workflow */
|
/** Process Workflow */
|
||||||
private static final int WORKFLOW = 2;
|
protected static final int WORKFLOW = 2;
|
||||||
|
|
||||||
/** Process Delivery Confirm */
|
/** Process Delivery Confirm */
|
||||||
private static final int DELIVERY = 9;
|
protected static final int DELIVERY = 9;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Process Messages in InBox
|
* Process Messages in InBox
|
||||||
|
@ -130,7 +130,7 @@ public class EMailProcessor
|
||||||
* @return Session
|
* @return Session
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private Session getSession() throws Exception
|
protected Session getSession() throws Exception
|
||||||
{
|
{
|
||||||
if (m_session != null)
|
if (m_session != null)
|
||||||
return m_session;
|
return m_session;
|
||||||
|
@ -155,7 +155,7 @@ public class EMailProcessor
|
||||||
* @return Store
|
* @return Store
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private Store getStore() throws Exception
|
protected Store getStore() throws Exception
|
||||||
{
|
{
|
||||||
if (m_store != null)
|
if (m_store != null)
|
||||||
return m_store;
|
return m_store;
|
||||||
|
@ -177,7 +177,7 @@ public class EMailProcessor
|
||||||
* @return number of processed
|
* @return number of processed
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private int processInBox() throws Exception
|
protected int processInBox() throws Exception
|
||||||
{
|
{
|
||||||
// Folder
|
// Folder
|
||||||
Folder folder;
|
Folder folder;
|
||||||
|
@ -276,7 +276,7 @@ public class EMailProcessor
|
||||||
* @return Type of Message
|
* @return Type of Message
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private int processMessage (Message msg) throws Exception
|
protected int processMessage (Message msg) throws Exception
|
||||||
{
|
{
|
||||||
dumpEnvelope (msg);
|
dumpEnvelope (msg);
|
||||||
dumpBody (msg);
|
dumpBody (msg);
|
||||||
|
@ -301,7 +301,7 @@ public class EMailProcessor
|
||||||
* @param msg message
|
* @param msg message
|
||||||
* @return subject or ""
|
* @return subject or ""
|
||||||
*/
|
*/
|
||||||
private String getSubject (Message msg)
|
protected String getSubject (Message msg)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -321,7 +321,7 @@ public class EMailProcessor
|
||||||
* @param msg Message
|
* @param msg Message
|
||||||
* @return message or ""
|
* @return message or ""
|
||||||
*/
|
*/
|
||||||
private String getMessage (Part msg)
|
protected String getMessage (Part msg)
|
||||||
{
|
{
|
||||||
StringBuilder sb = new StringBuilder();
|
StringBuilder sb = new StringBuilder();
|
||||||
try
|
try
|
||||||
|
@ -406,7 +406,7 @@ public class EMailProcessor
|
||||||
* @param msg message
|
* @param msg message
|
||||||
* @return delivery info or null
|
* @return delivery info or null
|
||||||
*/
|
*/
|
||||||
private String getDeliveryReport (Part msg)
|
protected String getDeliveryReport (Part msg)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -451,7 +451,7 @@ public class EMailProcessor
|
||||||
* @return info or null
|
* @return info or null
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String getDeliveredReportDetail (Part part) throws Exception
|
protected String getDeliveredReportDetail (Part part) throws Exception
|
||||||
{
|
{
|
||||||
Object content = part.getContent();
|
Object content = part.getContent();
|
||||||
if (content == null)
|
if (content == null)
|
||||||
|
@ -504,7 +504,7 @@ public class EMailProcessor
|
||||||
* @param m message
|
* @param m message
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void dumpEnvelope(Message m) throws Exception
|
protected void dumpEnvelope(Message m) throws Exception
|
||||||
{
|
{
|
||||||
printOut("-----------------------------------------------------------------");
|
printOut("-----------------------------------------------------------------");
|
||||||
Address[] a;
|
Address[] a;
|
||||||
|
@ -613,7 +613,7 @@ public class EMailProcessor
|
||||||
* @param p
|
* @param p
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private void dumpBody (Part p) throws Exception
|
protected void dumpBody (Part p) throws Exception
|
||||||
{
|
{
|
||||||
// http://www.iana.org/assignments/media-types/
|
// http://www.iana.org/assignments/media-types/
|
||||||
printOut("=================================================================");
|
printOut("=================================================================");
|
||||||
|
@ -688,7 +688,7 @@ public class EMailProcessor
|
||||||
* Print
|
* Print
|
||||||
* @param s string
|
* @param s string
|
||||||
*/
|
*/
|
||||||
private static void printOut(String s)
|
protected static void printOut(String s)
|
||||||
{
|
{
|
||||||
// System.out.print(indentStr.substring(0, level * 2));
|
// System.out.print(indentStr.substring(0, level * 2));
|
||||||
System.out.println(s);
|
System.out.println(s);
|
||||||
|
|
|
@ -57,11 +57,11 @@ public class RequestProcessor extends AdempiereServer
|
||||||
} // RequestProcessor
|
} // RequestProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MRequestProcessor m_model = null;
|
protected MRequestProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Client onfo */
|
/** Client onfo */
|
||||||
private MClient m_client = null;
|
protected MClient m_client = null;
|
||||||
|
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Do the actual Work
|
* Do the actual Work
|
||||||
|
@ -90,7 +90,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
* Process requests.
|
* Process requests.
|
||||||
* Scheduled - are they due?
|
* Scheduled - are they due?
|
||||||
*/
|
*/
|
||||||
private void processRequests ()
|
protected void processRequests ()
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* Due Requests
|
* Due Requests
|
||||||
|
@ -368,7 +368,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
* @param AD_Message message
|
* @param AD_Message message
|
||||||
* @return true if sent
|
* @return true if sent
|
||||||
*/
|
*/
|
||||||
private boolean sendEmail (MRequest request, String AD_Message)
|
protected boolean sendEmail (MRequest request, String AD_Message)
|
||||||
{
|
{
|
||||||
// Alert: Request {0} overdue
|
// Alert: Request {0} overdue
|
||||||
String subject = Msg.getMsg(m_client.getAD_Language(), AD_Message,
|
String subject = Msg.getMsg(m_client.getAD_Language(), AD_Message,
|
||||||
|
@ -382,7 +382,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
* @param request request
|
* @param request request
|
||||||
* @return true if saved
|
* @return true if saved
|
||||||
*/
|
*/
|
||||||
private boolean escalate (MRequest request)
|
protected boolean escalate (MRequest request)
|
||||||
{
|
{
|
||||||
// Get Supervisor
|
// Get Supervisor
|
||||||
MUser supervisor = request.getSalesRep(); // self
|
MUser supervisor = request.getSalesRep(); // self
|
||||||
|
@ -424,7 +424,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Process Request Status
|
* Process Request Status
|
||||||
*/
|
*/
|
||||||
private void processStatus()
|
protected void processStatus()
|
||||||
{
|
{
|
||||||
int count = 0;
|
int count = 0;
|
||||||
// Requests with status with after timeout
|
// Requests with status with after timeout
|
||||||
|
@ -482,7 +482,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
/**
|
/**
|
||||||
* Create ECR
|
* Create ECR
|
||||||
*/
|
*/
|
||||||
private void processECR()
|
protected void processECR()
|
||||||
{
|
{
|
||||||
// Get Requests with Request Type-AutoChangeRequest and Group with info
|
// Get Requests with Request Type-AutoChangeRequest and Group with info
|
||||||
String sql = "SELECT * FROM R_Request r "
|
String sql = "SELECT * FROM R_Request r "
|
||||||
|
@ -543,7 +543,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Create Reauest / Updates from EMail
|
* Create Reauest / Updates from EMail
|
||||||
*/
|
*/
|
||||||
private void processEMail ()
|
protected void processEMail ()
|
||||||
{
|
{
|
||||||
// m_summary.append("Mail #").append(count)
|
// m_summary.append("Mail #").append(count)
|
||||||
// .append(" - ");
|
// .append(" - ");
|
||||||
|
@ -553,7 +553,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
/**************************************************************************
|
/**************************************************************************
|
||||||
* Allocate Sales Rep
|
* Allocate Sales Rep
|
||||||
*/
|
*/
|
||||||
private void findSalesRep ()
|
protected void findSalesRep ()
|
||||||
{
|
{
|
||||||
int changed = 0;
|
int changed = 0;
|
||||||
int notFound = 0;
|
int notFound = 0;
|
||||||
|
@ -614,7 +614,7 @@ public class RequestProcessor extends AdempiereServer
|
||||||
* @param request request
|
* @param request request
|
||||||
* @return SalesRep_ID user
|
* @return SalesRep_ID user
|
||||||
*/
|
*/
|
||||||
private int findSalesRep (MRequest request)
|
protected int findSalesRep (MRequest request)
|
||||||
{
|
{
|
||||||
String QText = request.getSummary();
|
String QText = request.getSummary();
|
||||||
if (QText == null)
|
if (QText == null)
|
||||||
|
|
|
@ -69,14 +69,14 @@ public class Scheduler extends AdempiereServer
|
||||||
} // Scheduler
|
} // Scheduler
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MScheduler m_model = null;
|
protected MScheduler m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Transaction */
|
/** Transaction */
|
||||||
private Trx m_trx = null;
|
protected Trx m_trx = null;
|
||||||
|
|
||||||
// ctx for the report/process
|
// ctx for the report/process
|
||||||
Properties m_schedulerctx = new Properties();
|
protected Properties m_schedulerctx = new Properties();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work
|
* Work
|
||||||
|
@ -148,7 +148,7 @@ public class Scheduler extends AdempiereServer
|
||||||
* @return summary
|
* @return summary
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
private String runProcess(MProcess process) throws Exception
|
protected String runProcess(MProcess process) throws Exception
|
||||||
{
|
{
|
||||||
if (log.isLoggable(Level.INFO)) log.info(process.toString());
|
if (log.isLoggable(Level.INFO)) log.info(process.toString());
|
||||||
|
|
||||||
|
@ -278,7 +278,7 @@ public class Scheduler extends AdempiereServer
|
||||||
return pi.getSummary();
|
return pi.getSummary();
|
||||||
} // runProcess
|
} // runProcess
|
||||||
|
|
||||||
private int getAD_User_ID() {
|
protected int getAD_User_ID() {
|
||||||
int AD_User_ID;
|
int AD_User_ID;
|
||||||
if (m_model.getSupervisor_ID() > 0)
|
if (m_model.getSupervisor_ID() > 0)
|
||||||
AD_User_ID = m_model.getSupervisor_ID();
|
AD_User_ID = m_model.getSupervisor_ID();
|
||||||
|
@ -295,7 +295,7 @@ public class Scheduler extends AdempiereServer
|
||||||
* Fill Parameter
|
* Fill Parameter
|
||||||
* @param pInstance process instance
|
* @param pInstance process instance
|
||||||
*/
|
*/
|
||||||
private void fillParameter(MPInstance pInstance)
|
protected void fillParameter(MPInstance pInstance)
|
||||||
{
|
{
|
||||||
MSchedulerPara[] sParams = m_model.getParameters (false);
|
MSchedulerPara[] sParams = m_model.getParameters (false);
|
||||||
MPInstancePara[] iParams = pInstance.getParameters();
|
MPInstancePara[] iParams = pInstance.getParameters();
|
||||||
|
|
|
@ -61,11 +61,11 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
} // WorkflowProcessor
|
} // WorkflowProcessor
|
||||||
|
|
||||||
/** The Concrete Model */
|
/** The Concrete Model */
|
||||||
private MWorkflowProcessor m_model = null;
|
protected MWorkflowProcessor m_model = null;
|
||||||
/** Last Summary */
|
/** Last Summary */
|
||||||
private StringBuffer m_summary = new StringBuffer();
|
protected StringBuffer m_summary = new StringBuffer();
|
||||||
/** Client onfo */
|
/** Client onfo */
|
||||||
private MClient m_client = null;
|
protected MClient m_client = null;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Work
|
* Work
|
||||||
|
@ -90,7 +90,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
/**
|
/**
|
||||||
* Continue Workflow After Sleep
|
* Continue Workflow After Sleep
|
||||||
*/
|
*/
|
||||||
private void wakeup()
|
protected void wakeup()
|
||||||
{
|
{
|
||||||
String sql = "SELECT * "
|
String sql = "SELECT * "
|
||||||
+ "FROM AD_WF_Activity a "
|
+ "FROM AD_WF_Activity a "
|
||||||
|
@ -135,7 +135,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
/**
|
/**
|
||||||
* Set/Increase Priority dynamically
|
* Set/Increase Priority dynamically
|
||||||
*/
|
*/
|
||||||
private void dynamicPriority()
|
protected void dynamicPriority()
|
||||||
{
|
{
|
||||||
// suspened activities with dynamic priority node
|
// suspened activities with dynamic priority node
|
||||||
String sql = "SELECT * "
|
String sql = "SELECT * "
|
||||||
|
@ -184,7 +184,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
/**
|
/**
|
||||||
* Send Alerts
|
* Send Alerts
|
||||||
*/
|
*/
|
||||||
private void sendAlerts()
|
protected void sendAlerts()
|
||||||
{
|
{
|
||||||
// Alert over Priority
|
// Alert over Priority
|
||||||
if (m_model.getAlertOverPriority() > 0)
|
if (m_model.getAlertOverPriority() > 0)
|
||||||
|
@ -350,7 +350,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
* @param toSupervisor true if to Supervisor
|
* @param toSupervisor true if to Supervisor
|
||||||
* @return number of mails sent
|
* @return number of mails sent
|
||||||
*/
|
*/
|
||||||
private int sendEmail (MWFActivity activity, String AD_Message,
|
protected int sendEmail (MWFActivity activity, String AD_Message,
|
||||||
boolean toProcess, boolean toSupervisor)
|
boolean toProcess, boolean toSupervisor)
|
||||||
{
|
{
|
||||||
if (m_client == null || m_client.getAD_Client_ID() != activity.getAD_Client_ID())
|
if (m_client == null || m_client.getAD_Client_ID() != activity.getAD_Client_ID())
|
||||||
|
@ -429,7 +429,7 @@ public class WorkflowProcessor extends AdempiereServer
|
||||||
* @param pdf optional pdf
|
* @param pdf optional pdf
|
||||||
* @return number of mail sent
|
* @return number of mail sent
|
||||||
*/
|
*/
|
||||||
private int sendAlertToResponsible (MWFResponsible responsible,
|
protected int sendAlertToResponsible (MWFResponsible responsible,
|
||||||
ArrayList<Integer> list, MWFProcess process,
|
ArrayList<Integer> list, MWFProcess process,
|
||||||
String subject, String message, File pdf)
|
String subject, String message, File pdf)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. 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., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.model.MAcctProcessor;
|
||||||
|
import org.compiere.server.AcctProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultAcctProcessorFactory implements IServerFactory<AcctProcessor, MAcctProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
*/
|
||||||
|
public DefaultAcctProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.adempiere.server.IServerFactory#create(java.util.Properties)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public AcctProcessor[] create(Properties ctx) {
|
||||||
|
MAcctProcessor[] acctModels = MAcctProcessor.getActive(ctx);
|
||||||
|
List<AcctProcessor> list = new ArrayList<AcctProcessor>();
|
||||||
|
for (MAcctProcessor pModel : acctModels)
|
||||||
|
{
|
||||||
|
AcctProcessor processor = new AcctProcessor(pModel);
|
||||||
|
list.add(processor);
|
||||||
|
}
|
||||||
|
return list.toArray(new AcctProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MAcctProcessor> getProcessorClass() {
|
||||||
|
return MAcctProcessor.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,53 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. 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., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.model.MAlertProcessor;
|
||||||
|
import org.compiere.server.AlertProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultAlertProcessorFactory implements IServerFactory<AlertProcessor, MAlertProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public DefaultAlertProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public AlertProcessor[] create(Properties ctx) {
|
||||||
|
MAlertProcessor[] alertModels = MAlertProcessor.getActive(ctx);
|
||||||
|
List<AlertProcessor> list = new ArrayList<AlertProcessor>();
|
||||||
|
for (MAlertProcessor pModel : alertModels)
|
||||||
|
{
|
||||||
|
AlertProcessor server = new AlertProcessor(pModel);
|
||||||
|
list.add(server);
|
||||||
|
}
|
||||||
|
return list.toArray(new AlertProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MAlertProcessor> getProcessorClass() {
|
||||||
|
return MAlertProcessor.class;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. 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., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.ldap.LdapProcessor;
|
||||||
|
import org.compiere.model.MLdapProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultLDAPProcessorFactory implements IServerFactory<LdapProcessor, MLdapProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* default constructor
|
||||||
|
*/
|
||||||
|
public DefaultLDAPProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public LdapProcessor[] create(Properties ctx) {
|
||||||
|
MLdapProcessor[] ldapModels = MLdapProcessor.getActive(ctx);
|
||||||
|
List<LdapProcessor> list = new ArrayList<LdapProcessor>();
|
||||||
|
for (MLdapProcessor lp : ldapModels)
|
||||||
|
{
|
||||||
|
LdapProcessor server = new LdapProcessor(lp);
|
||||||
|
list.add(server);
|
||||||
|
}
|
||||||
|
return list.toArray(new LdapProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MLdapProcessor> getProcessorClass() {
|
||||||
|
return MLdapProcessor.class;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,55 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Copyright (C) 2013 Heng Sin Low *
|
||||||
|
* Copyright (C) 2013 Trek Global *
|
||||||
|
* This program is free software; you can redistribute it and/or modify it *
|
||||||
|
* under the terms version 2 of the GNU General Public License as published *
|
||||||
|
* by the Free Software Foundation. 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., *
|
||||||
|
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
|
||||||
|
*****************************************************************************/
|
||||||
|
package org.idempiere.server.factory;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Properties;
|
||||||
|
|
||||||
|
import org.adempiere.server.IServerFactory;
|
||||||
|
import org.compiere.model.MRequestProcessor;
|
||||||
|
import org.compiere.server.RequestProcessor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class DefaultRequestProcessorFactory implements IServerFactory<RequestProcessor, MRequestProcessor> {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public DefaultRequestProcessorFactory() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/* (non-Javadoc)
|
||||||
|
* @see org.adempiere.server.IServerFactory#create(java.util.Properties)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public RequestProcessor[] create(Properties ctx) {
|
||||||
|
MRequestProcessor[] requestModels = MRequestProcessor.getActive(ctx);
|
||||||
|
List<RequestProcessor> list = new ArrayList<RequestProcessor>();
|
||||||
|
for (MRequestProcessor pModel : requestModels)
|
||||||
|
{
|
||||||
|
RequestProcessor processor = new RequestProcessor(pModel);
|
||||||
|
list.add(processor);
|
||||||
|
}
|
||||||
|
return list.toArray(new RequestProcessor[0]);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Class<MRequestProcessor> getProcessorClass() {
|
||||||
|
return MRequestProcessor.class;
|
||||||
|
}
|
||||||
|
}
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue