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|
|
||||
|
||||
|
||||
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|
|
||||
|*Table* |C_bpartner |
|
||||
|*Where* |c_bpartner_id=120 |
|
||||
|*Read* | |
|
||||
|actuallifetimevalue|@SQL=SELECT @C_bpartner.actuallifetimevalue@ + @c_order.grandtotal@ FROM DUAL|
|
||||
|so_creditused |@SQL=SELECT @C_bpartner.so_creditused@ + @c_order.grandtotal@ FROM DUAL |
|
||||
|totalopenbalance |@SQL=SELECT @C_bpartner.totalopenbalance@ + @c_order.grandtotal@ FROM DUAL |
|
||||
|so_creditused |@SQL=SELECT @C_bpartner.so_creditused@ FROM DUAL |
|
||||
|totalopenbalance |@SQL=SELECT @C_bpartner.totalopenbalance@ FROM DUAL |
|
||||
|
||||
Check existance of shipment
|
||||
|
||||
|
@ -123,17 +123,14 @@ Check existance of invoice
|
|||
|qtyinvoiced | |
|
||||
|linenetamt | |
|
||||
|
||||
Check existance of cash journal line
|
||||
Check existance of cash payment (now on payment table)
|
||||
|
||||
!|Read Record|
|
||||
|*Table* |C_CashLine |
|
||||
|*Table* |C_Payment |
|
||||
|C_Invoice_id|@C_Invoice.C_Invoice_id@|
|
||||
|*Read* | |
|
||||
|line | |
|
||||
|c_cash_id | |
|
||||
|line | |
|
||||
|documentno | |
|
||||
|description | |
|
||||
|amount | |
|
||||
|isgenerated | |
|
||||
|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
|
||||
|
||||
|
@ -7,4 +7,4 @@ This test tries to create a reference in the database, intentionally the !-Valid
|
|||
|Name |Fitnesse Test|
|
||||
|ValidationType|Y |
|
||||
|invalidcolumn|Y |
|
||||
|*Save* | |
|
||||
|*Save*Error* |java.lang.Exception: Cannot set value of column|
|
||||
|
|
|
@ -2,19 +2,23 @@ This test creates a new tenant in the database.
|
|||
|
||||
!include TestLoginSystem
|
||||
|
||||
!|Run Process|
|
||||
|*ProcessValue* |InitialClientSetup |
|
||||
|ClientName |Prueba |
|
||||
|OrgName |Prueba |
|
||||
|AdminUserName |PruebaAdmin |
|
||||
|NormalUserName |PruebaUser |
|
||||
|C_Currency_ID |230 |
|
||||
|C_Country_ID |156 |
|
||||
|CityName |Bogotá |
|
||||
|IsUseBPDimension |Y |
|
||||
|IsUseProductDimension |Y |
|
||||
|IsUseProjectDimension |Y |
|
||||
|IsUseCampaignDimension |N |
|
||||
|IsUseSalesRegionDimension|N |
|
||||
|CoAFile |/home/carlos/hgAdempiere/adempiere361/data/import/AccountingUS.csv|
|
||||
|*Run* | |
|
||||
!|Set Variable |
|
||||
|@random_string@|@random_string(,,6)|
|
||||
|
||||
|
||||
!|Run Process |
|
||||
|*ProcessValue* |InitialClientSetup |
|
||||
|ClientName |TestClient @random_string@ |
|
||||
|OrgName |TestOrg @random_string@ |
|
||||
|AdminUserName |@random_string@Admin |
|
||||
|NormalUserName |@random_string@User |
|
||||
|C_Currency_ID |230 |
|
||||
|C_Country_ID |156 |
|
||||
|CityName |Bogotá |
|
||||
|IsUseBPDimension |Y |
|
||||
|IsUseProductDimension |Y |
|
||||
|IsUseProjectDimension |Y |
|
||||
|IsUseCampaignDimension |N |
|
||||
|IsUseSalesRegionDimension|N |
|
||||
|CoAFile |${fitnesse_home}/../org.adempiere.server-feature/data/import/AccountingUS.csv|
|
||||
|*Run* | |
|
||||
|
|
|
@ -4,43 +4,49 @@ https://sourceforge.net/tracker/?func=detail&atid=879332&aid=2713724&group_id=17
|
|||
|
||||
!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 Record|
|
||||
|*Table*|M_Inventory |
|
||||
!|Create Record |
|
||||
|*Table* |M_Inventory |
|
||||
|ad_org_id |11 |
|
||||
|c_doctype_id |144 |
|
||||
|c_doctype_id |200000 |
|
||||
|m_warehouse_id|103 |
|
||||
|movementdate |2009-03-26 00:00:00.0|
|
||||
|*Save*| |
|
||||
|movementdate |2013-06-26 00:00:00.0|
|
||||
|*Save* | |
|
||||
|
||||
Create internal use line
|
||||
|
||||
!|Create Record|
|
||||
|*Table*|M_InventoryLine |
|
||||
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@ |
|
||||
|ad_org_id |@M_Inventory.AD_Org_ID@ |
|
||||
|m_locator_id |101 |
|
||||
|m_product_id |141 |
|
||||
|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|
|
||||
|qtybook|@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101 and m_attributesetinstance_id=0|
|
||||
|*Save*| |
|
||||
!|Create Record |
|
||||
|*Table* |M_InventoryLine |
|
||||
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@|
|
||||
|ad_org_id |@M_Inventory.AD_Org_ID@ |
|
||||
|m_locator_id |101 |
|
||||
|m_product_id |141 |
|
||||
|c_charge_id |101 |
|
||||
|qtyinternaluse|2 |
|
||||
|*Save* | |
|
||||
|
||||
Complete the internal use
|
||||
|
||||
!|Run Process|
|
||||
|*ProcessValue*|M_Inventory Process |
|
||||
!|Run Process |
|
||||
|*ProcessValue*|M_Inventory Process |
|
||||
|*RecordID* |@M_Inventory.M_Inventory_ID@|
|
||||
|*DocAction* |CO |
|
||||
|*Run*| |
|
||||
|*DocAction* |CO |
|
||||
|*Run* | |
|
||||
|
||||
!|Assert Variable |
|
||||
|@ExpectedInventoryLevelAfter@|@SQL=select sum(qtyonhand) from m_storage where m_product_id=141 and m_locator_id=101|
|
||||
|
||||
Post
|
||||
|
||||
!|Set DocAction|
|
||||
|*Table* |M_Inventory|
|
||||
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@ |
|
||||
|docAction |PO |
|
||||
|*Save*| |
|
||||
!|Set DocAction |
|
||||
|*Table* |M_Inventory |
|
||||
|M_Inventory_ID|@M_Inventory.M_Inventory_ID@|
|
||||
|docAction |PO |
|
||||
|*Save* | |
|
||||
|
||||
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|
|
||||
|FitLibraryWeb||01:41:13 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|
|
||||
|AvgCostSuite.BasicTest||01:18: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.TestCreateBusinessPartner||24:19:40 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.TestLoginGardenAdmin||24:17:07 mar, abr 03, 2012|
|
||||
|IdempiereSuite.QuickTest||24:16:36 mar, abr 03, 2012|
|
||||
|
|
|
@ -15,12 +15,12 @@
|
|||
|''window''|${windowId}|''click toolbar''|!-BtnSave-!|
|
||||
|''wait response''|
|
||||
|''window message''|${windowId}|is|!-Record saved-!|
|
||||
|''window''|${windowId}|''click detail toolbar''|!-BtnNew-!|
|
||||
|''window''|${windowId}|''click detail toolbar''|!-BtnEdit-!|
|
||||
|''wait response''|
|
||||
|''text of''|${windowId} $recordInfo|is|!-+*1/1-!|
|
||||
|''window''|${windowId}|''click toolbar''|!-BtnParentRecord-!|
|
||||
|''wait response''|
|
||||
|''window''|${windowId}|''click process button''|!-CreateFrom-!|
|
||||
|''click''|${windowId} $Production $CreateFrom|
|
||||
|''wait response''|
|
||||
|''click''|${windowId} @window[title="Create Production"] $Ok|
|
||||
|''wait response''|
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
'''start firefox,chrome or phantomjs'''
|
||||
|''start spider with''|firefox|
|
||||
|''shutdown browser automatically''|false|
|
||||
|''get url''|http://localhost:8080/webui/index.zul|
|
||||
|''get url''|http://localhost:${ADEMPIERE_WEB_PORT}/webui/index.zul|
|
||||
|
||||
|''wait response''|
|
||||
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
'''start firefox,chrome or phantomjs'''
|
||||
|''start spider with''|firefox|
|
||||
|''shutdown browser automatically''|false|
|
||||
|''get url''|http://localhost:8080/webui/index.zul|
|
||||
|''get url''|http://localhost:${ADEMPIERE_WEB_PORT}/webui/index.zul|
|
||||
|
||||
|''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
|
||||
//end AZ Goodwill
|
||||
|
||||
public PO getPO()
|
||||
{
|
||||
return p_po;
|
||||
}
|
||||
|
||||
/**
|
||||
* String representation
|
||||
* @return String
|
||||
|
|
|
@ -21,6 +21,8 @@ import java.sql.ResultSet;
|
|||
import java.util.ArrayList;
|
||||
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.MCurrency;
|
||||
import org.compiere.model.MAccount;
|
||||
|
@ -33,6 +35,7 @@ import org.compiere.model.MProduct;
|
|||
import org.compiere.model.ProductCost;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
|
||||
/**
|
||||
* Post Shipment/Receipt Documents.
|
||||
|
@ -178,9 +181,19 @@ public class Doc_InOut extends Doc
|
|||
MProduct product = line.getProduct();
|
||||
if (product.isStocked())
|
||||
{
|
||||
p_Error = "No Costs for " + line.getProduct().getName();
|
||||
log.log(Level.WARNING, p_Error);
|
||||
return null;
|
||||
//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();
|
||||
log.log(Level.WARNING, p_Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
else // ignore service
|
||||
continue;
|
||||
|
@ -381,6 +394,7 @@ public class Doc_InOut extends Doc
|
|||
DocLine line = p_lines[i];
|
||||
BigDecimal costs = null;
|
||||
MProduct product = line.getProduct();
|
||||
MOrderLine orderLine = null;
|
||||
if (!isReversal(line))
|
||||
{
|
||||
//get costing method for product
|
||||
|
@ -393,7 +407,7 @@ public class Doc_InOut extends Doc
|
|||
// Low - check if c_orderline_id is valid
|
||||
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
|
||||
C_Currency_ID = orderLine.getC_Currency_ID();
|
||||
//
|
||||
|
@ -418,8 +432,8 @@ public class Doc_InOut extends Doc
|
|||
costs = costs.multiply(line.getQty());
|
||||
}
|
||||
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);
|
||||
return null;
|
||||
}
|
||||
|
@ -432,9 +446,17 @@ public class Doc_InOut extends Doc
|
|||
|
||||
if (costs == null || costs.signum() == 0)
|
||||
{
|
||||
p_Error = "Resubmit - No Costs for " + product.getName();
|
||||
log.log(Level.WARNING, p_Error);
|
||||
return null;
|
||||
//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();
|
||||
log.log(Level.WARNING, p_Error);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -525,7 +547,33 @@ public class Doc_InOut extends Doc
|
|||
MProduct product = line.getProduct();
|
||||
if (!isReversal(line))
|
||||
{
|
||||
costs = line.getProductCosts(as, line.getAD_Org_ID(), false); // current costs
|
||||
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
|
||||
}
|
||||
if (costs == null || costs.signum() == 0)
|
||||
{
|
||||
p_Error = "Resubmit - No Costs for " + product.getName();
|
||||
|
@ -535,7 +583,8 @@ public class Doc_InOut extends Doc
|
|||
}
|
||||
else
|
||||
{
|
||||
costs = BigDecimal.ZERO;
|
||||
//update below
|
||||
costs = Env.ONE;
|
||||
}
|
||||
// NotInvoicedReceipt DR
|
||||
// Elaine 2008/06/26
|
||||
|
@ -596,7 +645,15 @@ public class Doc_InOut extends Doc
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
String costingError = createVendorRMACostDetail(as, line, costs);
|
||||
if (!Util.isEmpty(costingError))
|
||||
{
|
||||
p_Error = costingError;
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
} // Purchasing Return
|
||||
else
|
||||
{
|
||||
|
@ -613,4 +670,20 @@ public class Doc_InOut extends Doc
|
|||
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
|
||||
|
|
|
@ -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()
|
||||
+ ",Qty=" + getQty() + ",InOutQty=" + m_receiptLine.getMovementQty());
|
||||
|
||||
// Invoice Price Variance
|
||||
BigDecimal ipv = dr.getSourceBalance().negate();
|
||||
if (ipv.signum() != 0)
|
||||
{
|
||||
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 = fact.createLine (null, expense, as.getC_Currency_ID(), null, Env.ONE);
|
||||
cr.setAmtAcctCr(BigDecimal.ZERO);
|
||||
cr.setAmtSourceCr(BigDecimal.ZERO);
|
||||
}
|
||||
cr.setQty(getQty().negate());
|
||||
temp = cr.getAcctBalance();
|
||||
|
@ -351,6 +333,8 @@ public class Doc_MatchInv extends Doc
|
|||
if (m_invoiceLine != null && m_invoiceLine.get_ID() > 0
|
||||
&& m_receiptLine != null && m_receiptLine.get_ID() > 0)
|
||||
{
|
||||
MMatchInv matchInv = (MMatchInv)getPO();
|
||||
|
||||
BigDecimal LineNetAmt = m_invoiceLine.getLineNetAmt();
|
||||
BigDecimal multiplier = getQty()
|
||||
.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)
|
||||
LineNetAmt = LineNetAmt.multiply(multiplier);
|
||||
|
||||
// Source from Doc_MatchInv.createFacts(MAcctSchema)
|
||||
// Cost Detail Record - data from Expense/IncClearing (CR) record
|
||||
// MZ Goodwill
|
||||
// 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());
|
||||
|
@ -367,7 +349,7 @@ public class Doc_MatchInv extends Doc
|
|||
BigDecimal tAmt = Env.ZERO;
|
||||
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());
|
||||
multiplier = mInv[i].getQty()
|
||||
|
@ -397,8 +379,7 @@ public class Doc_MatchInv extends Doc
|
|||
tQty = tQty.add(getQty().negate()); // Qty is set to negative value
|
||||
else
|
||||
tQty = tQty.add(getQty());
|
||||
|
||||
MMatchInv matchInv = (MMatchInv)getPO();
|
||||
|
||||
// Set Total Amount and Total Quantity from Matched Invoice
|
||||
if (!MCostDetail.createInvoice(as, getAD_Org_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
|
||||
|
@ -48,6 +48,11 @@ public class MColor extends X_AD_Color
|
|||
if (AD_Color_ID == 0)
|
||||
setName("-/-");
|
||||
} // MColor
|
||||
|
||||
public MColor(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/**
|
||||
* String Representation
|
||||
|
|
|
@ -290,6 +290,8 @@ public class MCost extends X_M_Cost
|
|||
if (retValue == null || retValue.signum() == 0)
|
||||
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
|
||||
|
@ -1480,9 +1482,9 @@ public class MCost extends X_M_Cost
|
|||
public void setWeightedAverage (BigDecimal amt, BigDecimal 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)
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.util.List;
|
|||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.acct.Doc;
|
||||
import org.compiere.model.X_M_CostHistory;
|
||||
import org.compiere.util.CLogger;
|
||||
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 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.
|
||||
* Called from Doc_MatchPO
|
||||
|
@ -677,6 +684,20 @@ public class MCostDetail extends X_M_CostDetail
|
|||
return isSOTrx() && getM_InOutLine_ID() != 0;
|
||||
} // 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)?
|
||||
* @return true if delta is not null
|
||||
|
@ -1036,22 +1057,26 @@ public class MCostDetail extends X_M_CostDetail
|
|||
|| getPP_Cost_Collector_ID() != 0)
|
||||
{
|
||||
boolean addition = qty.signum() > 0;
|
||||
boolean isVendorRMA = isVendorRMA();
|
||||
//
|
||||
if (ce.isAverageInvoice())
|
||||
{
|
||||
if (addition)
|
||||
if (!isVendorRMA)
|
||||
{
|
||||
cost.setWeightedAverage(amt, qty);
|
||||
//shouldn't accumulate reversal of customer shipment qty and amt
|
||||
if (isShipment())
|
||||
if (addition)
|
||||
{
|
||||
cost.setCumulatedQty(history.getOldCQty());
|
||||
cost.setCumulatedAmt(history.getOldCAmt());
|
||||
cost.setWeightedAverage(amt, qty);
|
||||
//shouldn't accumulate reversal of customer shipment qty and amt
|
||||
if (isShipment())
|
||||
{
|
||||
cost.setCumulatedQty(history.getOldCQty());
|
||||
cost.setCumulatedAmt(history.getOldCAmt());
|
||||
}
|
||||
}
|
||||
else
|
||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - AverageInv - " + cost);
|
||||
}
|
||||
else
|
||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - AverageInv - " + cost);
|
||||
}
|
||||
else if (ce.isAveragePO())
|
||||
{
|
||||
|
@ -1059,51 +1084,63 @@ public class MCostDetail extends X_M_CostDetail
|
|||
{
|
||||
cost.setWeightedAverage(amt, qty);
|
||||
//shouldn't accumulate reversal of customer shipment qty and amt
|
||||
if (isShipment())
|
||||
if (isShipment() && !isVendorRMA())
|
||||
{
|
||||
cost.setCumulatedQty(history.getOldCQty());
|
||||
cost.setCumulatedAmt(history.getOldCAmt());
|
||||
}
|
||||
}
|
||||
else
|
||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||
{
|
||||
if (isVendorRMA)
|
||||
{
|
||||
cost.setWeightedAverage(amt, qty);
|
||||
}
|
||||
else
|
||||
{
|
||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||
}
|
||||
}
|
||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - AveragePO - " + cost);
|
||||
}
|
||||
else if (ce.isFifo() || ce.isLifo())
|
||||
{
|
||||
if (addition)
|
||||
if (!isVendorRMA)
|
||||
{
|
||||
// Real ASI - costing level Org
|
||||
MCostQueue cq = MCostQueue.get(product, getM_AttributeSetInstance_ID(),
|
||||
as, Org_ID, ce.getM_CostElement_ID(), get_TrxName());
|
||||
cq.setCosts(amt, qty, precision);
|
||||
cq.saveEx();
|
||||
if (addition)
|
||||
{
|
||||
// Real ASI - costing level Org
|
||||
MCostQueue cq = MCostQueue.get(product, getM_AttributeSetInstance_ID(),
|
||||
as, Org_ID, ce.getM_CostElement_ID(), get_TrxName());
|
||||
cq.setCosts(amt, qty, precision);
|
||||
cq.saveEx();
|
||||
}
|
||||
else
|
||||
{
|
||||
// Adjust Queue - costing level Org/ASI
|
||||
MCostQueue.adjustQty(product, M_ASI_ID,
|
||||
as, Org_ID, ce, qty.negate(), get_TrxName());
|
||||
}
|
||||
// Get Costs - costing level Org/ASI
|
||||
MCostQueue[] cQueue = MCostQueue.getQueue(product, M_ASI_ID,
|
||||
as, Org_ID, ce, get_TrxName());
|
||||
if (cQueue != null && cQueue.length > 0)
|
||||
cost.setCurrentCostPrice(cQueue[0].getCurrentCostPrice());
|
||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - FiFo/Lifo - " + cost);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Adjust Queue - costing level Org/ASI
|
||||
MCostQueue.adjustQty(product, M_ASI_ID,
|
||||
as, Org_ID, ce, qty.negate(), get_TrxName());
|
||||
}
|
||||
// Get Costs - costing level Org/ASI
|
||||
MCostQueue[] cQueue = MCostQueue.getQueue(product, M_ASI_ID,
|
||||
as, Org_ID, ce, get_TrxName());
|
||||
if (cQueue != null && cQueue.length > 0)
|
||||
cost.setCurrentCostPrice(cQueue[0].getCurrentCostPrice());
|
||||
cost.setCurrentQty(cost.getCurrentQty().add(qty));
|
||||
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));
|
||||
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));
|
||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - LastPO - " + cost);
|
||||
}
|
||||
else if (ce.isStandardCosting())
|
||||
else if (ce.isStandardCosting() && !isVendorRMA)
|
||||
{
|
||||
if (addition)
|
||||
{
|
||||
|
@ -1123,7 +1160,7 @@ public class MCostDetail extends X_M_CostDetail
|
|||
}
|
||||
if (log.isLoggable(Level.FINER)) log.finer("QtyAdjust - Standard - " + cost);
|
||||
}
|
||||
else if (ce.isUserDefined())
|
||||
else if (ce.isUserDefined() && !isVendorRMA)
|
||||
{
|
||||
// Interface
|
||||
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) {
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
* 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;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
|
||||
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,
|
||||
String 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;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
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
|
||||
|
@ -41,6 +42,11 @@ public class MReplication extends X_AD_Replication
|
|||
{
|
||||
super (ctx, AD_Replication_ID, trxName);
|
||||
} // MReplication
|
||||
|
||||
public MReplication (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Public Access
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
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
|
||||
|
@ -47,5 +48,10 @@ public class MReplicationLog extends X_AD_Replication_Log
|
|||
setIsReplicated(false);
|
||||
setP_Msg(P_Msg);
|
||||
} // MReplicationLog
|
||||
|
||||
|
||||
public MReplicationLog(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
} // MReplicationLog
|
||||
|
|
|
@ -16,6 +16,7 @@
|
|||
*****************************************************************************/
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.Timestamp;
|
||||
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
|
||||
|
@ -46,6 +47,11 @@ public class MReplicationRun extends X_AD_Replication_Run
|
|||
super.setIsReplicated (false);
|
||||
} // MReplicationRun
|
||||
|
||||
public MReplicationRun (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Replication Flag
|
||||
* @param IsReplicated replicated
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
package org.compiere.model;
|
||||
|
||||
import java.sql.ResultSet;
|
||||
import java.util.List;
|
||||
import java.util.Properties;
|
||||
|
||||
|
@ -34,10 +35,10 @@ import org.compiere.util.CLogger;
|
|||
*/
|
||||
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_DOCUMENT =1;
|
||||
|
||||
|
@ -56,7 +57,11 @@ public class MReplicationStrategy extends X_AD_ReplicationStrategy {
|
|||
public MReplicationStrategy(Properties ctx, int AD_ReplicationStrategy_ID, String 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
|
||||
*/
|
||||
|
|
|
@ -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 */
|
||||
public static final String SEARCHTYPE_TABLE = "T";
|
||||
/** Constant for the searchtype query */
|
||||
|
@ -66,6 +66,10 @@ public class MSearchDefinition extends X_AD_SearchDefinition {
|
|||
public MSearchDefinition(Properties ctx, int AD_SearchDefinition_ID, String 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
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.compiere.print;
|
|||
|
||||
import java.awt.Color;
|
||||
import java.awt.SystemColor;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -36,11 +37,10 @@ import org.compiere.util.Util;
|
|||
*/
|
||||
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
|
||||
|
@ -138,6 +138,11 @@ public class MPrintColor extends X_AD_PrintColor
|
|||
if (AD_PrintColor_ID == 0)
|
||||
setIsDefault(false);
|
||||
} // MPrintColor
|
||||
|
||||
public MPrintColor(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** Color cached */
|
||||
private Color m_cacheColor = null;
|
||||
|
|
|
@ -18,6 +18,7 @@ package org.compiere.print;
|
|||
|
||||
import java.awt.Font;
|
||||
import java.awt.GraphicsEnvironment;
|
||||
import java.sql.ResultSet;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
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
|
||||
|
@ -53,6 +54,11 @@ public class MPrintFont extends X_AD_PrintFont
|
|||
if (AD_PrintFont_ID == 0)
|
||||
setIsDefault(false);
|
||||
} // MPrintFont
|
||||
|
||||
public MPrintFont(Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** Font cached */
|
||||
private Font m_cacheFont = null;
|
||||
|
|
|
@ -48,6 +48,7 @@ import org.compiere.model.PO;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Util;
|
||||
import org.eevolution.model.I_DD_Order;
|
||||
import org.eevolution.model.I_HR_Process;
|
||||
import org.eevolution.model.I_PP_Cost_Collector;
|
||||
|
@ -489,6 +490,12 @@ public class DocumentEngine implements DocAction
|
|||
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());
|
||||
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);
|
||||
} // 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
|
||||
|
@ -54,6 +54,11 @@ public class MReportColumnSet extends X_PA_ReportColumnSet
|
|||
else
|
||||
loadColumns();
|
||||
} // MReportColumnSet
|
||||
|
||||
public MReportColumnSet (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** Contained Columns */
|
||||
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
|
||||
|
@ -54,6 +54,11 @@ public class MReportLineSet extends X_PA_ReportLineSet
|
|||
else
|
||||
loadLines();
|
||||
} // MReportLineSet
|
||||
|
||||
public MReportLineSet (Properties ctx, ResultSet rs, String trxName)
|
||||
{
|
||||
super (ctx, rs, trxName);
|
||||
}
|
||||
|
||||
/** Contained Lines */
|
||||
private MReportLine[] m_lines = null;
|
||||
|
|
|
@ -22,10 +22,10 @@ import java.sql.Savepoint;
|
|||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.logging.Level;
|
||||
|
||||
|
@ -63,16 +63,11 @@ public class Trx
|
|||
* @param createNew if false, null is returned if not found
|
||||
* @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)
|
||||
throw new IllegalArgumentException ("No Transaction Name");
|
||||
|
||||
if (s_cache == null)
|
||||
{
|
||||
s_cache = new HashMap<String,Trx>(10);
|
||||
}
|
||||
|
||||
Trx retValue = (Trx)s_cache.get(trxName);
|
||||
if (retValue == null && createNew)
|
||||
{
|
||||
|
@ -83,9 +78,9 @@ public class Trx
|
|||
} // get
|
||||
|
||||
/** 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>();
|
||||
|
||||
|
@ -171,7 +166,7 @@ public class Trx
|
|||
* @param createNew if true, create new connection if the trx does not have one created yet
|
||||
* @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);
|
||||
|
||||
|
@ -179,7 +174,7 @@ public class Trx
|
|||
{
|
||||
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();
|
||||
return null;
|
||||
|
@ -272,7 +267,7 @@ public class Trx
|
|||
* @param throwException if true, re-throws exception
|
||||
* @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
|
||||
try
|
||||
|
@ -351,7 +346,7 @@ public class Trx
|
|||
* @param throwException if true, re-throws exception
|
||||
* @return true if success
|
||||
**/
|
||||
public boolean commit(boolean throwException) throws SQLException
|
||||
public synchronized boolean commit(boolean throwException) throws SQLException
|
||||
{
|
||||
//local
|
||||
try
|
||||
|
@ -410,8 +405,7 @@ public class Trx
|
|||
*/
|
||||
public synchronized boolean close()
|
||||
{
|
||||
if (s_cache != null)
|
||||
s_cache.remove(getTrxName());
|
||||
s_cache.remove(getTrxName());
|
||||
|
||||
//local
|
||||
if (m_connection == null)
|
||||
|
@ -459,7 +453,7 @@ public class Trx
|
|||
* @return Savepoint
|
||||
* @throws SQLException
|
||||
*/
|
||||
public Savepoint setSavepoint(String name) throws SQLException {
|
||||
public synchronized Savepoint setSavepoint(String name) throws SQLException {
|
||||
if (m_connection == null)
|
||||
getConnection();
|
||||
|
||||
|
@ -479,7 +473,7 @@ public class Trx
|
|||
* @throws SQLException
|
||||
* @see {@link Connection#releaseSavepoint(Savepoint)}
|
||||
*/
|
||||
public void releaseSavepoint(Savepoint savepoint) throws SQLException
|
||||
public synchronized void releaseSavepoint(Savepoint savepoint) throws SQLException
|
||||
{
|
||||
if (DB.isOracle())
|
||||
{
|
||||
|
@ -519,9 +513,6 @@ public class Trx
|
|||
*/
|
||||
public static Trx[] getActiveTransactions()
|
||||
{
|
||||
if (s_cache == null)
|
||||
return new Trx[0];
|
||||
|
||||
Collection<Trx> collections = s_cache.values();
|
||||
Trx[] trxs = new Trx[collections.size()];
|
||||
collections.toArray(trxs);
|
||||
|
@ -626,11 +617,15 @@ public class Trx
|
|||
* @param listener
|
||||
*/
|
||||
public void addTrxEventListener(TrxEventListener listener) {
|
||||
listeners.add(listener);
|
||||
synchronized (listeners) {
|
||||
listeners.add(listener);
|
||||
}
|
||||
}
|
||||
|
||||
public boolean removeTrxEventListener(TrxEventListener listener) {
|
||||
return listeners.remove(listener);
|
||||
synchronized (listeners) {
|
||||
return listeners.remove(listener);
|
||||
}
|
||||
}
|
||||
|
||||
static class TrxMonitor implements Runnable
|
||||
|
@ -638,7 +633,7 @@ public class Trx
|
|||
|
||||
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]);
|
||||
for(int i = 0; i < trxs.length; i++)
|
||||
|
|
|
@ -56,7 +56,10 @@ public class AdElementHandler extends AbstractElementHandler {
|
|||
|
||||
M_Element mElement = findPO(ctx, element);
|
||||
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));
|
||||
}
|
||||
List<String> excludes = defaultExcludeList(X_AD_Element.Table_Name);
|
||||
|
|
|
@ -64,7 +64,10 @@ public class AttachmentElementHandler extends AbstractElementHandler {
|
|||
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));
|
||||
if (mAttachment.is_new()) {
|
||||
mAttachment.setAD_Table_ID(AD_Table_ID);
|
||||
|
|
|
@ -73,7 +73,10 @@ public class ColumnElementHandler extends AbstractElementHandler {
|
|||
filler.setTableReference("AD_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));
|
||||
if (mColumn.getAD_Column_ID() == 0 && isOfficialId(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);
|
||||
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));
|
||||
}
|
||||
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);
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -100,11 +100,14 @@ public class FieldElementHandler extends AbstractElementHandler {
|
|||
MField mField = findPO(ctx, element);
|
||||
if (mField == null)
|
||||
{
|
||||
StringBuffer sqlB = new StringBuffer(
|
||||
"select AD_Field_ID from AD_Field where AD_Column_ID = ")
|
||||
.append(AD_Column_ID)
|
||||
.append(" and AD_Tab_ID = ?");
|
||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), tabid);
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
StringBuffer sqlB = new StringBuffer(
|
||||
"select AD_Field_ID from AD_Field where AD_Column_ID = ")
|
||||
.append(AD_Column_ID)
|
||||
.append(" and AD_Tab_ID = ?");
|
||||
id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), tabid);
|
||||
}
|
||||
mField = new MField(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
if (mField.is_new()) {
|
||||
mField.setAD_Column_ID(AD_Column_ID);
|
||||
|
|
|
@ -58,7 +58,10 @@ public class FieldGroupElementHandler extends AbstractElementHandler {
|
|||
X_AD_FieldGroup fieldGroup = findPO(ctx, element);
|
||||
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));
|
||||
}
|
||||
PoFiller pf = new PoFiller(ctx, fieldGroup, element, this);
|
||||
|
|
|
@ -66,10 +66,12 @@ public class FormAccessElementHandler extends AbstractElementHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
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})
|
||||
.setClient_ID()
|
||||
.<MFormAccess>first();
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
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})
|
||||
.setClient_ID()
|
||||
.<MFormAccess>first();
|
||||
}
|
||||
if (po == null)
|
||||
{
|
||||
po = new MFormAccess(ctx.ctx, 0, getTrxName(ctx));
|
||||
|
|
|
@ -50,7 +50,10 @@ public class FormElementHandler extends AbstractElementHandler {
|
|||
MForm mForm = findPO(ctx, element);
|
||||
if (mForm == null) {
|
||||
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));
|
||||
}
|
||||
PoFiller filler = new PoFiller(ctx, mForm, element, this);
|
||||
|
|
|
@ -56,7 +56,10 @@ public class ImpFormatElementHandler extends AbstractElementHandler {
|
|||
|
||||
X_AD_ImpFormat mImpFormat = findPO(ctx, element);
|
||||
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,
|
||||
getTrxName(ctx));
|
||||
}
|
||||
|
|
|
@ -102,8 +102,11 @@ public class ImpFormatRowElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
}
|
||||
|
||||
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);
|
||||
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=?");
|
||||
id = DB.getSQLValue(getTrxName(ctx),sqlB.toString(),columnId,impFormatId);
|
||||
}
|
||||
mImpFormatRow = new X_AD_ImpFormat_Row(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
|
||||
mImpFormatRow.setAD_Column_ID(columnId);
|
||||
|
|
|
@ -59,8 +59,11 @@ public class MenuElementHandler extends AbstractElementHandler {
|
|||
|
||||
X_AD_Menu mMenu = findPO(ctx, element);
|
||||
if (mMenu == null) {
|
||||
String menuName = getStringValue(element, "Name");
|
||||
int menuId = findIdByColumn(ctx, "AD_Menu", "Name", menuName);
|
||||
int menuId = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
String menuName = getStringValue(element, "Name");
|
||||
menuId = findIdByColumn(ctx, "AD_Menu", "Name", menuName);
|
||||
}
|
||||
mMenu = new X_AD_Menu(ctx.ctx, menuId > 0 ? menuId : 0, getTrxName(ctx));
|
||||
}
|
||||
PoFiller filler = new PoFiller(ctx, mMenu, element, this);
|
||||
|
|
|
@ -46,9 +46,11 @@ public class MessageElementHandler extends AbstractElementHandler {
|
|||
if (isProcessElement(ctx.ctx, entitytype)) {
|
||||
MMessage mMessage = findPO(ctx, element);
|
||||
if (mMessage == null) {
|
||||
String value = getStringValue(element, "Value");
|
||||
int id = findIdByColumn(ctx, "AD_Message", "value", value);
|
||||
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
String value = getStringValue(element, "Value");
|
||||
id = findIdByColumn(ctx, "AD_Message", "value", value);
|
||||
}
|
||||
mMessage = new MMessage(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
}
|
||||
PoFiller filler = new PoFiller(ctx, mMessage, element, this);
|
||||
|
|
|
@ -37,7 +37,10 @@ public class ModelValidatorElementHandler extends AbstractElementHandler{
|
|||
|
||||
X_AD_ModelValidator validator = findPO(ctx, element);
|
||||
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));
|
||||
}
|
||||
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);
|
||||
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));
|
||||
}
|
||||
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");
|
||||
int orgId = ReferenceUtils.resolveReference(ctx.ctx, orgElement, 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})
|
||||
.setClient_ID()
|
||||
.<X_AD_Role_OrgAccess>first();
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
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})
|
||||
.setClient_ID()
|
||||
.<X_AD_Role_OrgAccess>first();
|
||||
}
|
||||
|
||||
if (po == null) {
|
||||
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);
|
||||
if (mPrintFormat == null) {
|
||||
String name = getStringValue(element, "Name");
|
||||
int id = findIdByColumn(ctx, "AD_PrintFormat", "Name", name);
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
String name = getStringValue(element, "Name");
|
||||
id = findIdByColumn(ctx, "AD_PrintFormat", "Name", name);
|
||||
}
|
||||
mPrintFormat = new X_AD_PrintFormat(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
}
|
||||
PoFiller filler = new PoFiller(ctx, mPrintFormat, element, this);
|
||||
|
|
|
@ -64,8 +64,11 @@ public class PrintFormatItemElementHandler extends AbstractElementHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
String name = getStringValue(element, "Name");
|
||||
int id = findIdByNameAndParentId(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", parentId);
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
String name = getStringValue(element, "Name");
|
||||
id = findIdByNameAndParentId(ctx, "AD_PrintFormatItem", name, "AD_PrintFormat", parentId);
|
||||
}
|
||||
mPrintFormatItem = new X_AD_PrintFormatItem(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mPrintFormatItem.setAD_PrintFormat_ID(parentId);
|
||||
excludes.add(I_AD_PrintFormatItem.COLUMNNAME_AD_PrintFormat_ID);
|
||||
|
|
|
@ -46,9 +46,12 @@ public class PrintPaperElementHandler extends AbstractElementHandler {
|
|||
|
||||
if (printPaper == null) {
|
||||
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.setName(printPaperName);
|
||||
}
|
||||
PoFiller filler = new PoFiller(ctx, printPaper, element, this);
|
||||
|
||||
|
|
|
@ -66,9 +66,11 @@ public class ProcessAccessElementHandler extends AbstractElementHandler {
|
|||
element.unresolved = "AD_Process_ID " + (processElement.contents != null ? processElement.contents.toString() : "");
|
||||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
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();
|
||||
}
|
||||
if (po == null)
|
||||
{
|
||||
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");
|
||||
|
||||
// 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));
|
||||
}
|
||||
|
||||
|
|
|
@ -69,7 +69,9 @@ public class ProcessParaElementHandler extends AbstractElementHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
id = findIdByColumnAndParentId(ctx, "AD_Process_Para", "ColumnName", name, "AD_Process", masterId);
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
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.setAD_Process_ID(masterId);
|
||||
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);
|
||||
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));
|
||||
}
|
||||
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));
|
||||
}
|
||||
|
||||
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));
|
||||
}
|
||||
|
||||
|
|
|
@ -67,22 +67,26 @@ public class ReferenceTableElementHandler extends AbstractElementHandler {
|
|||
if (AD_Reference_ID <= 0 && isOfficialId(element, "AD_Reference_ID"))
|
||||
AD_Reference_ID = getIntValue(element, "AD_Reference_ID");
|
||||
|
||||
String sql = "SELECT * FROM AD_Ref_Table WHERE AD_Reference_ID = ?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
|
||||
pstmt.setInt(1, AD_Reference_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()) {
|
||||
refTable = new X_AD_Ref_Table(ctx.ctx, rs, getTrxName(ctx));
|
||||
} else {
|
||||
refTable = new X_AD_Ref_Table(ctx.ctx, 0, getTrxName(ctx));
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
String sql = "SELECT * FROM AD_Ref_Table WHERE AD_Reference_ID = ?";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, getTrxName(ctx));
|
||||
pstmt.setInt(1, AD_Reference_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next()) {
|
||||
refTable = new X_AD_Ref_Table(ctx.ctx, rs, getTrxName(ctx));
|
||||
} else {
|
||||
refTable = new X_AD_Ref_Table(ctx.ctx, 0, getTrxName(ctx));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new DatabaseAccessException(e.getLocalizedMessage(), e);
|
||||
} finally {
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw new DatabaseAccessException(e.getLocalizedMessage(), e);
|
||||
} finally {
|
||||
DB.close(rs, pstmt);
|
||||
} else {
|
||||
refTable = new X_AD_Ref_Table(ctx.ctx, 0, getTrxName(ctx));
|
||||
}
|
||||
}
|
||||
String action = refTable.is_new() ? "New" : "Update";
|
||||
|
|
|
@ -90,7 +90,10 @@ public class ReportViewColElementHandler extends AbstractElementHandler {
|
|||
sql.append(" AND FunctionColumn = ?");
|
||||
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.setAD_ReportView_ID(AD_ReportView_ID);
|
||||
if (AD_Column_ID > 0) {
|
||||
|
|
|
@ -57,8 +57,11 @@ public class ReportViewElementHandler extends AbstractElementHandler {
|
|||
|
||||
X_AD_ReportView mReportview = findPO(ctx, element);
|
||||
if (mReportview == null) {
|
||||
String name = getStringValue(element, "Name");
|
||||
int id = findIdByName(ctx, "AD_ReportView", name);
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
String name = getStringValue(element, "Name");
|
||||
id = findIdByName(ctx, "AD_ReportView", name);
|
||||
}
|
||||
mReportview = new X_AD_ReportView(ctx.ctx, id, getTrxName(ctx));
|
||||
}
|
||||
PoFiller filler = new PoFiller(ctx, mReportview, element, this);
|
||||
|
|
|
@ -69,7 +69,10 @@ public class RoleElementHandler extends AbstractElementHandler {
|
|||
MRole mRole = findPO(ctx, element);
|
||||
if (mRole == null) {
|
||||
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.setName(name);
|
||||
}
|
||||
|
|
|
@ -85,11 +85,14 @@ public class TabElementHandler extends AbstractElementHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
String sql = "SELECT AD_Tab_ID FROM AD_Tab where AD_Window_ID = ? "
|
||||
+ " AND Name = ?"
|
||||
+ " AND AD_Table_ID = ?";
|
||||
|
||||
int id = DB.getSQLValue(getTrxName(ctx), sql, windowId, name, tableId);
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
String sql = "SELECT AD_Tab_ID FROM AD_Tab where AD_Window_ID = ? "
|
||||
+ " AND Name = ?"
|
||||
+ " AND AD_Table_ID = ?";
|
||||
|
||||
id = DB.getSQLValue(getTrxName(ctx), sql, windowId, name, tableId);
|
||||
}
|
||||
mTab = new MTab(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mTab.setAD_Table_ID(tableId);
|
||||
mTab.setName(name);
|
||||
|
|
|
@ -58,16 +58,18 @@ public class TableElementHandler extends AbstractElementHandler {
|
|||
|
||||
MTable mTable = findPO(ctx, element);
|
||||
if (mTable == null) {
|
||||
int id = 0;
|
||||
String tableName = getStringValue(element, "TableName", excludes);
|
||||
|
||||
int id = packIn.getTableId(tableName);
|
||||
if (id <= 0) {
|
||||
id = findIdByColumn(ctx, "AD_Table", "TableName", tableName);
|
||||
if (id > 0)
|
||||
packIn.addTable(tableName, id);
|
||||
}
|
||||
if (id > 0 && isTableProcess(ctx, id)) {
|
||||
return;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
id = packIn.getTableId(tableName);
|
||||
if (id <= 0) {
|
||||
id = findIdByColumn(ctx, "AD_Table", "TableName", tableName);
|
||||
if (id > 0)
|
||||
packIn.addTable(tableName, id);
|
||||
}
|
||||
if (id > 0 && isTableProcess(ctx, id)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mTable = new MTable(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
|
|
|
@ -67,8 +67,10 @@ public class TaskAccessElementHandler extends AbstractElementHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
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();
|
||||
}
|
||||
if (po == null){
|
||||
po = new X_AD_Task_Access(ctx.ctx, 0, getTrxName(ctx));
|
||||
po.setAD_Role_ID(roleid);
|
||||
|
|
|
@ -50,8 +50,11 @@ public class TaskElementHandler extends AbstractElementHandler {
|
|||
|
||||
MTask mTask = findPO(ctx, element);
|
||||
if (mTask == null) {
|
||||
String name = getStringValue(element, "Name");
|
||||
int id = findIdByName(ctx, "AD_Task", name);
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
String name = getStringValue(element, "Name");
|
||||
id = findIdByName(ctx, "AD_Task", name);
|
||||
}
|
||||
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);
|
||||
orgid = ReferenceUtils.resolveReference(ctx.ctx, orgElement, 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();
|
||||
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));
|
||||
po = query.setParameters(new Object[]{userid, roleid, orgid}).first();
|
||||
}
|
||||
if (po == null) {
|
||||
po = new X_AD_User_Roles(ctx.ctx, 0, getTrxName(ctx));
|
||||
po.setAD_Org_ID(orgid);
|
||||
|
|
|
@ -66,8 +66,10 @@ public class WindowAccessElementHandler extends AbstractElementHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
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();
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
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();
|
||||
}
|
||||
if (po == null) {
|
||||
po = new X_AD_Window_Access(ctx.ctx, 0, getTrxName(ctx));
|
||||
po.setAD_Role_ID(roleid);
|
||||
|
|
|
@ -63,12 +63,14 @@ public class WindowElementHandler extends AbstractElementHandler {
|
|||
if (isProcessElement(ctx.ctx, entitytype)) {
|
||||
MWindow mWindow = findPO(ctx, element);
|
||||
if (mWindow == null) {
|
||||
int id = 0;
|
||||
String name = getStringValue(element, "Name", excludes);
|
||||
int id = findIdByName(ctx, "AD_Window", name);
|
||||
if (id > 0 && windows.contains(id)) {
|
||||
return;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
id = findIdByName(ctx, "AD_Window", name);
|
||||
if (id > 0 && windows.contains(id)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mWindow = new MWindow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mWindow.setName(name);
|
||||
} else {
|
||||
|
|
|
@ -67,8 +67,10 @@ public class WorkflowAccessElementHandler extends AbstractElementHandler {
|
|||
element.unresolved = "AD_Workflow_ID";
|
||||
}
|
||||
|
||||
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();
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
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();
|
||||
}
|
||||
if (po == null) {
|
||||
po = new MWorkflowAccess(ctx.ctx, 0, getTrxName(ctx));
|
||||
po.setAD_Role_ID(roleid);
|
||||
|
|
|
@ -63,11 +63,14 @@ public class WorkflowElementHandler extends AbstractElementHandler {
|
|||
|
||||
MWorkflow mWorkflow = findPO(ctx, element);
|
||||
if (mWorkflow == null) {
|
||||
int id = 0;
|
||||
String workflowValue = getStringValue(element, "Value", excludes);
|
||||
int id = findIdByColumn(ctx, "AD_Workflow", "Value", workflowValue);
|
||||
if (id > 0 && workflows.contains(id)) {
|
||||
element.skip = true;
|
||||
return;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
id = findIdByColumn(ctx, "AD_Workflow", "Value", workflowValue);
|
||||
if (id > 0 && workflows.contains(id)) {
|
||||
element.skip = true;
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
mWorkflow = new MWorkflow(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
|
|
|
@ -74,10 +74,12 @@ public class WorkflowNodeElementHandler extends AbstractElementHandler {
|
|||
}
|
||||
|
||||
String workflowNodeValue = getStringValue(element, "Value", excludes);
|
||||
StringBuilder sqlB = new StringBuilder(
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
StringBuilder sqlB = new StringBuilder(
|
||||
"SELECT AD_WF_Node_ID FROM AD_WF_Node WHERE AD_Workflow_ID=? and Value =?");
|
||||
|
||||
int id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeValue);
|
||||
id = DB.getSQLValue(getTrxName(ctx), sqlB.toString(), workflowId, workflowNodeValue);
|
||||
}
|
||||
mWFNode = new MWFNode(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mWFNode.setValue(workflowNodeValue);
|
||||
mWFNode.setAD_Workflow_ID(workflowId);
|
||||
|
|
|
@ -78,9 +78,12 @@ public class WorkflowNodeNextConditionElementHandler extends
|
|||
return;
|
||||
}
|
||||
|
||||
int seqNo = getIntValue(element, "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});
|
||||
int id = 0;
|
||||
if (!hasUUIDKey(ctx, element)) {
|
||||
int seqNo = getIntValue(element, "SeqNo");
|
||||
String sql = "SELECT AD_WF_NextCondition_ID FROM AD_WF_NextCondition WHERE AD_WF_NodeNext_ID =? AND SeqNo=?";
|
||||
id = DB.getSQLValue(getTrxName(ctx), sql, new Object[] {wfNodeNextId, seqNo});
|
||||
}
|
||||
|
||||
mWFNodeNextCondition = new MWFNextCondition(ctx.ctx, id > 0 ? id : 0, getTrxName(ctx));
|
||||
mWFNodeNextCondition.setAD_WF_NodeNext_ID(wfNodeNextId);
|
||||
|
|
|
@ -94,7 +94,10 @@ public class WorkflowNodeNextElementHandler extends AbstractElementHandler {
|
|||
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.setAD_WF_Node_ID(wfNodeId);
|
||||
|
|
|
@ -574,7 +574,25 @@ public abstract class AbstractElementHandler implements ElementHandler {
|
|||
}
|
||||
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
|
||||
|
|
|
@ -81,7 +81,7 @@ public class AdempiereActivator implements BundleActivator, ServiceTrackerCustom
|
|||
|
||||
String where = "Name=? AND PK_Version LIKE ?";
|
||||
Query q = new Query(Env.getCtx(), X_AD_Package_Imp.Table_Name,
|
||||
where.toString(), trxName);
|
||||
where.toString(), null);
|
||||
q.setParameters(new Object[] { getName(), version + "%" });
|
||||
X_AD_Package_Imp pkg = q.first();
|
||||
if (pkg == null) {
|
||||
|
|
|
@ -9,14 +9,13 @@ import java.util.Properties;
|
|||
|
||||
import org.adempiere.server.IServerFactory;
|
||||
import org.compiere.model.MIMPProcessor;
|
||||
import org.compiere.server.AdempiereServer;
|
||||
import org.compiere.server.ReplicationProcessor;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class ReplicationServerFactory implements IServerFactory {
|
||||
public class ReplicationServerFactory implements IServerFactory<ReplicationProcessor, MIMPProcessor> {
|
||||
|
||||
/**
|
||||
* default constructor
|
||||
|
@ -28,17 +27,21 @@ public class ReplicationServerFactory implements IServerFactory {
|
|||
* @see org.adempiere.server.IServerFactory#create()
|
||||
*/
|
||||
@Override
|
||||
public AdempiereServer[] create(Properties ctx) {
|
||||
List<AdempiereServer> list = new ArrayList<AdempiereServer>();
|
||||
public ReplicationProcessor[] create(Properties ctx) {
|
||||
List<ReplicationProcessor> list = new ArrayList<ReplicationProcessor>();
|
||||
MIMPProcessor[] importModels = MIMPProcessor.getActive(ctx);
|
||||
for (int i = 0; i < importModels.length; i++)
|
||||
for (MIMPProcessor lp : importModels)
|
||||
{
|
||||
MIMPProcessor lp = importModels[i];
|
||||
AdempiereServer server = new ReplicationProcessor(lp);
|
||||
ReplicationProcessor server = new ReplicationProcessor(lp);
|
||||
list.add(server);
|
||||
}
|
||||
AdempiereServer[] servers = list.toArray(new AdempiereServer[0]);
|
||||
ReplicationProcessor[] servers = list.toArray(new ReplicationProcessor[0]);
|
||||
return servers;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Class<MIMPProcessor> getProcessorClass() {
|
||||
return MIMPProcessor.class;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -48,18 +48,17 @@ import org.compiere.model.MIMPProcessorLog;
|
|||
public class ReplicationProcessor extends AdempiereServer {
|
||||
|
||||
/** Last Summary */
|
||||
private StringBuffer m_summary = new StringBuffer();
|
||||
protected StringBuffer m_summary = new StringBuffer();
|
||||
|
||||
/** Client info */
|
||||
@SuppressWarnings("unused")
|
||||
private MClient m_client = null;
|
||||
protected MClient m_client = null;
|
||||
|
||||
private MIMPProcessor mImportProcessor = null;
|
||||
protected MIMPProcessor mImportProcessor = null;
|
||||
|
||||
/**
|
||||
* flag showing if process is working!
|
||||
*/
|
||||
private boolean isProcessRunning = false;
|
||||
protected boolean isProcessRunning = false;
|
||||
|
||||
|
||||
/*protected ReplicationProcessor(MIMPProcessor model, int initialNap) {
|
||||
|
@ -75,10 +74,10 @@ public class ReplicationProcessor extends AdempiereServer {
|
|||
}*/
|
||||
|
||||
public ReplicationProcessor(AdempiereProcessor model, int initialNap) {
|
||||
super (model, initialNap);
|
||||
mImportProcessor = (MIMPProcessor)model;
|
||||
m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID());
|
||||
}
|
||||
super (model, initialNap);
|
||||
mImportProcessor = (MIMPProcessor)model;
|
||||
m_client = MClient.get(mImportProcessor.getCtx(), mImportProcessor.getAD_Client_ID());
|
||||
}
|
||||
public ReplicationProcessor(AdempiereProcessor model) {
|
||||
super (model, 30);
|
||||
mImportProcessor =(MIMPProcessor)model;
|
||||
|
|
|
@ -20,6 +20,11 @@
|
|||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
<buildCommand>
|
||||
<name>org.eclipse.pde.ds.core.builder</name>
|
||||
<arguments>
|
||||
</arguments>
|
||||
</buildCommand>
|
||||
</buildSpec>
|
||||
<natures>
|
||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||
|
|
|
@ -32,4 +32,8 @@ Import-Package: javax.jms;version="1.1.0",
|
|||
org.restlet.service,
|
||||
org.restlet.util
|
||||
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,\
|
||||
webstart.jpg,\
|
||||
zip.gif,\
|
||||
plugin.xml
|
||||
bin.excludes = src/**,\
|
||||
.settings/**,\
|
||||
.classpath,\
|
||||
.project,\
|
||||
build.properties
|
||||
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/
|
||||
output.. = build/classes/
|
||||
bin.excludes = src/**,\
|
||||
.settings/**,\
|
||||
.classpath,\
|
||||
.project,\
|
||||
build.properties
|
||||
|
|
|
@ -15,6 +15,7 @@ package org.adempiere.server;
|
|||
|
||||
import java.util.Properties;
|
||||
|
||||
import org.compiere.model.AdempiereProcessor;
|
||||
import org.compiere.server.AdempiereServer;
|
||||
|
||||
/**
|
||||
|
@ -22,8 +23,18 @@ import org.compiere.server.AdempiereServer;
|
|||
* @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
|
||||
|
||||
/** The Concrete Model */
|
||||
private MLdapProcessor m_model = null;
|
||||
protected MLdapProcessor m_model = null;
|
||||
/** Last Summary */
|
||||
private StringBuffer m_summary = new StringBuffer();
|
||||
protected StringBuffer m_summary = new StringBuffer();
|
||||
/** Server Socket */
|
||||
private ServerSocket m_serverSocket = null;
|
||||
protected ServerSocket m_serverSocket = null;
|
||||
/** Counter */
|
||||
private int m_counter = 0;
|
||||
protected int m_counter = 0;
|
||||
|
||||
|
||||
/**
|
||||
|
|
|
@ -56,13 +56,13 @@ public class AcctProcessor extends AdempiereServer
|
|||
} // AcctProcessor
|
||||
|
||||
/** The Concrete Model */
|
||||
private MAcctProcessor m_model = null;
|
||||
protected MAcctProcessor m_model = null;
|
||||
/** Last Summary */
|
||||
private StringBuffer m_summary = new StringBuffer();
|
||||
protected StringBuffer m_summary = new StringBuffer();
|
||||
/** Client onfo */
|
||||
private MClient m_client = null;
|
||||
protected MClient m_client = null;
|
||||
/** Accounting Schemata */
|
||||
private MAcctSchema[] m_ass = null;
|
||||
protected MAcctSchema[] m_ass = null;
|
||||
|
||||
/**
|
||||
* Work
|
||||
|
|
|
@ -20,22 +20,15 @@ import java.sql.Timestamp;
|
|||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.ldap.LdapProcessor;
|
||||
import org.compiere.model.AdempiereProcessor;
|
||||
import org.compiere.model.AdempiereProcessor2;
|
||||
import org.compiere.model.AdempiereProcessorLog;
|
||||
import org.compiere.model.MAcctProcessor;
|
||||
import org.compiere.model.MAlertProcessor;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MLdapProcessor;
|
||||
import org.compiere.model.MRequestProcessor;
|
||||
import org.compiere.model.MSchedule;
|
||||
import org.compiere.model.MScheduler;
|
||||
import org.compiere.model.MSystem;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.TimeUtil;
|
||||
import org.compiere.wf.MWorkflowProcessor;
|
||||
|
||||
/**
|
||||
* Adempiere Server Base
|
||||
|
@ -45,31 +38,6 @@ import org.compiere.wf.MWorkflowProcessor;
|
|||
*/
|
||||
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
|
||||
|
|
|
@ -27,15 +27,10 @@ import java.util.logging.Level;
|
|||
import org.adempiere.base.Service;
|
||||
import org.adempiere.server.IServerFactory;
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.model.MAcctProcessor;
|
||||
import org.compiere.model.MAlertProcessor;
|
||||
import org.compiere.model.MLdapProcessor;
|
||||
import org.compiere.model.MRequestProcessor;
|
||||
import org.compiere.model.MScheduler;
|
||||
import org.compiere.model.AdempiereProcessor;
|
||||
import org.compiere.model.MSession;
|
||||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.wf.MWorkflowProcessor;
|
||||
|
||||
/**
|
||||
* Adempiere Server Manager
|
||||
|
@ -105,100 +100,36 @@ public class AdempiereServerMgr
|
|||
* Start Environment
|
||||
* @return true if started
|
||||
*/
|
||||
@SuppressWarnings("rawtypes")
|
||||
public boolean startServers()
|
||||
{
|
||||
log.info("");
|
||||
int noServers = 0;
|
||||
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
|
||||
List<IServerFactory> serverFactoryList = Service.locator().list(IServerFactory.class).getServices();
|
||||
if (serverFactoryList != null && !serverFactoryList.isEmpty())
|
||||
{
|
||||
List<String> processed = new ArrayList<String>();
|
||||
for(IServerFactory factory : serverFactoryList )
|
||||
{
|
||||
AdempiereServer[] servers = factory.create(m_ctx);
|
||||
if (servers != null && servers.length > 0)
|
||||
String name = factory.getProcessorClass().getName();
|
||||
if (!processed.contains(name))
|
||||
{
|
||||
for (AdempiereServer server : servers)
|
||||
processed.add(name);
|
||||
AdempiereServer[] servers = factory.create(m_ctx);
|
||||
if (servers != null && servers.length > 0)
|
||||
{
|
||||
// server.start();
|
||||
// server.setPriority(Thread.NORM_PRIORITY-1);
|
||||
m_servers.add(new ServerWrapper(server));
|
||||
}
|
||||
}
|
||||
for (AdempiereServer server : servers)
|
||||
{
|
||||
AdempiereProcessor model = server.getModel();
|
||||
if (AdempiereServer.isOKtoRunOnIP(model)) {
|
||||
m_servers.add(new ServerWrapper(server));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -72,13 +72,13 @@ public class AlertProcessor extends AdempiereServer
|
|||
} // AlertProcessor
|
||||
|
||||
/** The Concrete Model */
|
||||
private MAlertProcessor m_model = null;
|
||||
protected MAlertProcessor m_model = null;
|
||||
/** Last Summary */
|
||||
private StringBuffer m_summary = new StringBuffer();
|
||||
protected StringBuffer m_summary = new StringBuffer();
|
||||
/** Last Error Msg */
|
||||
private StringBuffer m_errors = new StringBuffer();
|
||||
protected StringBuffer m_errors = new StringBuffer();
|
||||
/** Client info */
|
||||
private MClient m_client = null;
|
||||
protected MClient m_client = null;
|
||||
|
||||
/**
|
||||
* Work
|
||||
|
@ -119,7 +119,7 @@ public class AlertProcessor extends AdempiereServer
|
|||
* @param alert alert
|
||||
* @return true if processed
|
||||
*/
|
||||
private boolean processAlert (MAlert alert)
|
||||
protected boolean processAlert (MAlert alert)
|
||||
{
|
||||
if (!alert.isValid())
|
||||
return false;
|
||||
|
@ -240,7 +240,7 @@ public class AlertProcessor extends AdempiereServer
|
|||
* @param attachments
|
||||
* @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;
|
||||
for (int user_id : users) {
|
||||
|
@ -289,7 +289,7 @@ public class AlertProcessor extends AdempiereServer
|
|||
* @return data
|
||||
* @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>>();
|
||||
PreparedStatement pstmt = null;
|
||||
|
@ -351,7 +351,7 @@ public class AlertProcessor extends AdempiereServer
|
|||
* @return list of rows & values
|
||||
* @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
|
||||
{
|
||||
StringBuilder result = new StringBuilder();
|
||||
|
@ -407,7 +407,7 @@ public class AlertProcessor extends AdempiereServer
|
|||
* @return summary message to be added into mail content
|
||||
* @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
|
||||
{
|
||||
ArrayList<ArrayList<Object>> data = getData(sql, trxName);
|
||||
|
|
|
@ -69,30 +69,30 @@ public class EMailProcessor
|
|||
} // EMail
|
||||
|
||||
/** EMail Host Parameter */
|
||||
private String m_host = null;
|
||||
protected String m_host = null;
|
||||
/** EMail User Parameter */
|
||||
private String m_user = null;
|
||||
protected String m_user = null;
|
||||
/** Password Parameter */
|
||||
private String m_pass = null;
|
||||
protected String m_pass = null;
|
||||
|
||||
/** Session */
|
||||
private Session m_session = null;
|
||||
protected Session m_session = null;
|
||||
/** Store */
|
||||
private Store m_store = null;
|
||||
protected Store m_store = null;
|
||||
|
||||
|
||||
/** Logger */
|
||||
protected CLogger log = CLogger.getCLogger(getClass());
|
||||
|
||||
/** Process Error */
|
||||
private static final int ERROR = 0;
|
||||
protected static final int ERROR = 0;
|
||||
/** Process Request */
|
||||
private static final int REQUEST = 1;
|
||||
protected static final int REQUEST = 1;
|
||||
/** Process Workflow */
|
||||
private static final int WORKFLOW = 2;
|
||||
protected static final int WORKFLOW = 2;
|
||||
|
||||
/** Process Delivery Confirm */
|
||||
private static final int DELIVERY = 9;
|
||||
protected static final int DELIVERY = 9;
|
||||
|
||||
/**
|
||||
* Process Messages in InBox
|
||||
|
@ -130,7 +130,7 @@ public class EMailProcessor
|
|||
* @return Session
|
||||
* @throws Exception
|
||||
*/
|
||||
private Session getSession() throws Exception
|
||||
protected Session getSession() throws Exception
|
||||
{
|
||||
if (m_session != null)
|
||||
return m_session;
|
||||
|
@ -155,7 +155,7 @@ public class EMailProcessor
|
|||
* @return Store
|
||||
* @throws Exception
|
||||
*/
|
||||
private Store getStore() throws Exception
|
||||
protected Store getStore() throws Exception
|
||||
{
|
||||
if (m_store != null)
|
||||
return m_store;
|
||||
|
@ -177,7 +177,7 @@ public class EMailProcessor
|
|||
* @return number of processed
|
||||
* @throws Exception
|
||||
*/
|
||||
private int processInBox() throws Exception
|
||||
protected int processInBox() throws Exception
|
||||
{
|
||||
// Folder
|
||||
Folder folder;
|
||||
|
@ -276,7 +276,7 @@ public class EMailProcessor
|
|||
* @return Type of Message
|
||||
* @throws Exception
|
||||
*/
|
||||
private int processMessage (Message msg) throws Exception
|
||||
protected int processMessage (Message msg) throws Exception
|
||||
{
|
||||
dumpEnvelope (msg);
|
||||
dumpBody (msg);
|
||||
|
@ -301,7 +301,7 @@ public class EMailProcessor
|
|||
* @param msg message
|
||||
* @return subject or ""
|
||||
*/
|
||||
private String getSubject (Message msg)
|
||||
protected String getSubject (Message msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -321,7 +321,7 @@ public class EMailProcessor
|
|||
* @param msg Message
|
||||
* @return message or ""
|
||||
*/
|
||||
private String getMessage (Part msg)
|
||||
protected String getMessage (Part msg)
|
||||
{
|
||||
StringBuilder sb = new StringBuilder();
|
||||
try
|
||||
|
@ -406,7 +406,7 @@ public class EMailProcessor
|
|||
* @param msg message
|
||||
* @return delivery info or null
|
||||
*/
|
||||
private String getDeliveryReport (Part msg)
|
||||
protected String getDeliveryReport (Part msg)
|
||||
{
|
||||
try
|
||||
{
|
||||
|
@ -451,7 +451,7 @@ public class EMailProcessor
|
|||
* @return info or null
|
||||
* @throws Exception
|
||||
*/
|
||||
private String getDeliveredReportDetail (Part part) throws Exception
|
||||
protected String getDeliveredReportDetail (Part part) throws Exception
|
||||
{
|
||||
Object content = part.getContent();
|
||||
if (content == null)
|
||||
|
@ -504,7 +504,7 @@ public class EMailProcessor
|
|||
* @param m message
|
||||
* @throws Exception
|
||||
*/
|
||||
private void dumpEnvelope(Message m) throws Exception
|
||||
protected void dumpEnvelope(Message m) throws Exception
|
||||
{
|
||||
printOut("-----------------------------------------------------------------");
|
||||
Address[] a;
|
||||
|
@ -613,7 +613,7 @@ public class EMailProcessor
|
|||
* @param p
|
||||
* @throws Exception
|
||||
*/
|
||||
private void dumpBody (Part p) throws Exception
|
||||
protected void dumpBody (Part p) throws Exception
|
||||
{
|
||||
// http://www.iana.org/assignments/media-types/
|
||||
printOut("=================================================================");
|
||||
|
@ -688,7 +688,7 @@ public class EMailProcessor
|
|||
* Print
|
||||
* @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.println(s);
|
||||
|
|
|
@ -57,11 +57,11 @@ public class RequestProcessor extends AdempiereServer
|
|||
} // RequestProcessor
|
||||
|
||||
/** The Concrete Model */
|
||||
private MRequestProcessor m_model = null;
|
||||
protected MRequestProcessor m_model = null;
|
||||
/** Last Summary */
|
||||
private StringBuffer m_summary = new StringBuffer();
|
||||
protected StringBuffer m_summary = new StringBuffer();
|
||||
/** Client onfo */
|
||||
private MClient m_client = null;
|
||||
protected MClient m_client = null;
|
||||
|
||||
/**************************************************************************
|
||||
* Do the actual Work
|
||||
|
@ -90,7 +90,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
* Process requests.
|
||||
* Scheduled - are they due?
|
||||
*/
|
||||
private void processRequests ()
|
||||
protected void processRequests ()
|
||||
{
|
||||
/**
|
||||
* Due Requests
|
||||
|
@ -368,7 +368,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
* @param AD_Message message
|
||||
* @return true if sent
|
||||
*/
|
||||
private boolean sendEmail (MRequest request, String AD_Message)
|
||||
protected boolean sendEmail (MRequest request, String AD_Message)
|
||||
{
|
||||
// Alert: Request {0} overdue
|
||||
String subject = Msg.getMsg(m_client.getAD_Language(), AD_Message,
|
||||
|
@ -382,7 +382,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
* @param request request
|
||||
* @return true if saved
|
||||
*/
|
||||
private boolean escalate (MRequest request)
|
||||
protected boolean escalate (MRequest request)
|
||||
{
|
||||
// Get Supervisor
|
||||
MUser supervisor = request.getSalesRep(); // self
|
||||
|
@ -424,7 +424,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
/**************************************************************************
|
||||
* Process Request Status
|
||||
*/
|
||||
private void processStatus()
|
||||
protected void processStatus()
|
||||
{
|
||||
int count = 0;
|
||||
// Requests with status with after timeout
|
||||
|
@ -482,7 +482,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
/**
|
||||
* Create ECR
|
||||
*/
|
||||
private void processECR()
|
||||
protected void processECR()
|
||||
{
|
||||
// Get Requests with Request Type-AutoChangeRequest and Group with info
|
||||
String sql = "SELECT * FROM R_Request r "
|
||||
|
@ -543,7 +543,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
/**************************************************************************
|
||||
* Create Reauest / Updates from EMail
|
||||
*/
|
||||
private void processEMail ()
|
||||
protected void processEMail ()
|
||||
{
|
||||
// m_summary.append("Mail #").append(count)
|
||||
// .append(" - ");
|
||||
|
@ -553,7 +553,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
/**************************************************************************
|
||||
* Allocate Sales Rep
|
||||
*/
|
||||
private void findSalesRep ()
|
||||
protected void findSalesRep ()
|
||||
{
|
||||
int changed = 0;
|
||||
int notFound = 0;
|
||||
|
@ -614,7 +614,7 @@ public class RequestProcessor extends AdempiereServer
|
|||
* @param request request
|
||||
* @return SalesRep_ID user
|
||||
*/
|
||||
private int findSalesRep (MRequest request)
|
||||
protected int findSalesRep (MRequest request)
|
||||
{
|
||||
String QText = request.getSummary();
|
||||
if (QText == null)
|
||||
|
|
|
@ -69,14 +69,14 @@ public class Scheduler extends AdempiereServer
|
|||
} // Scheduler
|
||||
|
||||
/** The Concrete Model */
|
||||
private MScheduler m_model = null;
|
||||
protected MScheduler m_model = null;
|
||||
/** Last Summary */
|
||||
private StringBuffer m_summary = new StringBuffer();
|
||||
protected StringBuffer m_summary = new StringBuffer();
|
||||
/** Transaction */
|
||||
private Trx m_trx = null;
|
||||
protected Trx m_trx = null;
|
||||
|
||||
// ctx for the report/process
|
||||
Properties m_schedulerctx = new Properties();
|
||||
protected Properties m_schedulerctx = new Properties();
|
||||
|
||||
/**
|
||||
* Work
|
||||
|
@ -148,7 +148,7 @@ public class Scheduler extends AdempiereServer
|
|||
* @return summary
|
||||
* @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());
|
||||
|
||||
|
@ -278,7 +278,7 @@ public class Scheduler extends AdempiereServer
|
|||
return pi.getSummary();
|
||||
} // runProcess
|
||||
|
||||
private int getAD_User_ID() {
|
||||
protected int getAD_User_ID() {
|
||||
int AD_User_ID;
|
||||
if (m_model.getSupervisor_ID() > 0)
|
||||
AD_User_ID = m_model.getSupervisor_ID();
|
||||
|
@ -295,7 +295,7 @@ public class Scheduler extends AdempiereServer
|
|||
* Fill Parameter
|
||||
* @param pInstance process instance
|
||||
*/
|
||||
private void fillParameter(MPInstance pInstance)
|
||||
protected void fillParameter(MPInstance pInstance)
|
||||
{
|
||||
MSchedulerPara[] sParams = m_model.getParameters (false);
|
||||
MPInstancePara[] iParams = pInstance.getParameters();
|
||||
|
|
|
@ -61,11 +61,11 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
} // WorkflowProcessor
|
||||
|
||||
/** The Concrete Model */
|
||||
private MWorkflowProcessor m_model = null;
|
||||
protected MWorkflowProcessor m_model = null;
|
||||
/** Last Summary */
|
||||
private StringBuffer m_summary = new StringBuffer();
|
||||
protected StringBuffer m_summary = new StringBuffer();
|
||||
/** Client onfo */
|
||||
private MClient m_client = null;
|
||||
protected MClient m_client = null;
|
||||
|
||||
/**
|
||||
* Work
|
||||
|
@ -90,7 +90,7 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
/**
|
||||
* Continue Workflow After Sleep
|
||||
*/
|
||||
private void wakeup()
|
||||
protected void wakeup()
|
||||
{
|
||||
String sql = "SELECT * "
|
||||
+ "FROM AD_WF_Activity a "
|
||||
|
@ -135,7 +135,7 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
/**
|
||||
* Set/Increase Priority dynamically
|
||||
*/
|
||||
private void dynamicPriority()
|
||||
protected void dynamicPriority()
|
||||
{
|
||||
// suspened activities with dynamic priority node
|
||||
String sql = "SELECT * "
|
||||
|
@ -184,7 +184,7 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
/**
|
||||
* Send Alerts
|
||||
*/
|
||||
private void sendAlerts()
|
||||
protected void sendAlerts()
|
||||
{
|
||||
// Alert over Priority
|
||||
if (m_model.getAlertOverPriority() > 0)
|
||||
|
@ -350,7 +350,7 @@ public class WorkflowProcessor extends AdempiereServer
|
|||
* @param toSupervisor true if to Supervisor
|
||||
* @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)
|
||||
{
|
||||
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
|
||||
* @return number of mail sent
|
||||
*/
|
||||
private int sendAlertToResponsible (MWFResponsible responsible,
|
||||
protected int sendAlertToResponsible (MWFResponsible responsible,
|
||||
ArrayList<Integer> list, MWFProcess process,
|
||||
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