IDEMPIERE-5838 Base: Improve readability of code (#2129)
* IDEMPIERE-5838 Base: Improve readability of code * IDEMPIERE-5838 Base: Improve readability of code
This commit is contained in:
parent
342a243c1a
commit
7329975eec
|
|
@ -11,6 +11,7 @@ import org.compiere.process.SvrProcess;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
|
|
||||||
@org.adempiere.base.annotation.Process
|
@org.adempiere.base.annotation.Process
|
||||||
|
@Deprecated
|
||||||
public class UpdateRoleMenu extends SvrProcess
|
public class UpdateRoleMenu extends SvrProcess
|
||||||
{
|
{
|
||||||
private int p_role_id = 0;
|
private int p_role_id = 0;
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,8 @@ import org.compiere.model.MProduct;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create Distribution List Order
|
* Create Distribution List Order. <br/>
|
||||||
|
* Note: feature not fully implemented and have been marked as inactive in application dictionary.
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: DistributionCreate.java,v 1.3 2006/07/30 00:51:01 jjanke Exp $
|
* @version $Id: DistributionCreate.java,v 1.3 2006/07/30 00:51:01 jjanke Exp $
|
||||||
|
|
|
||||||
|
|
@ -23,11 +23,13 @@ import org.compiere.model.MSystem;
|
||||||
import org.compiere.util.AdempiereSystemError;
|
import org.compiere.util.AdempiereSystemError;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Report System Issue
|
* Report System Issue.
|
||||||
*
|
*
|
||||||
* @author Jorg Janke
|
* @author Jorg Janke
|
||||||
* @version $Id: IssueReport.java,v 1.2 2006/07/30 00:54:44 jjanke Exp $
|
* @version $Id: IssueReport.java,v 1.2 2006/07/30 00:54:44 jjanke Exp $
|
||||||
|
* @deprecated not fully implemented
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
@org.adempiere.base.annotation.Process
|
@org.adempiere.base.annotation.Process
|
||||||
public class IssueReport extends SvrProcess
|
public class IssueReport extends SvrProcess
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,9 @@ package com.akunagroup.uk.postcode;
|
||||||
* Interface for Address Lookup Web Service.
|
* Interface for Address Lookup Web Service.
|
||||||
* https://sourceforge.net/p/adempiere/feature-requests/137/
|
* https://sourceforge.net/p/adempiere/feature-requests/137/
|
||||||
* The Address Structure
|
* The Address Structure
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "11")
|
||||||
public interface AddressInterface
|
public interface AddressInterface
|
||||||
{
|
{
|
||||||
public int size();
|
public int size();
|
||||||
|
|
|
||||||
|
|
@ -51,7 +51,9 @@ import org.w3c.dom.NodeList;
|
||||||
*
|
*
|
||||||
* @author Michael Judd
|
* @author Michael Judd
|
||||||
* @version $Id$
|
* @version $Id$
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "11")
|
||||||
public class AddressLookup implements AddressLookupInterface {
|
public class AddressLookup implements AddressLookupInterface {
|
||||||
/** The logger. */
|
/** The logger. */
|
||||||
private static final CLogger log = CLogger.getCLogger(AddressLookup.class);
|
private static final CLogger log = CLogger.getCLogger(AddressLookup.class);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,9 @@ import java.util.HashMap;
|
||||||
* Interface for Address Lookup Web Service.
|
* Interface for Address Lookup Web Service.
|
||||||
* https://sourceforge.net/p/adempiere/feature-requests/137/
|
* https://sourceforge.net/p/adempiere/feature-requests/137/
|
||||||
* The Address lookup class interface
|
* The Address lookup class interface
|
||||||
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated(forRemoval = true, since = "11")
|
||||||
public interface AddressLookupInterface {
|
public interface AddressLookupInterface {
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
|
||||||
|
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
package com.akunagroup.uk.postcode;
|
package com.akunagroup.uk.postcode;
|
||||||
|
|
||||||
|
@Deprecated(forRemoval = true, since = "11")
|
||||||
public class Postcode implements AddressInterface
|
public class Postcode implements AddressInterface
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -58,6 +58,7 @@ import org.jfree.data.time.Year;
|
||||||
import org.jfree.data.xy.IntervalXYDataset;
|
import org.jfree.data.xy.IntervalXYDataset;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Builder for JFree Chart
|
||||||
* @author Paul Bowden, Adaxa Pty Ltd
|
* @author Paul Bowden, Adaxa Pty Ltd
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
|
|
@ -70,6 +71,9 @@ public class ChartBuilder {
|
||||||
private HashMap<String,MQuery> queries;
|
private HashMap<String,MQuery> queries;
|
||||||
private Dataset dataset;
|
private Dataset dataset;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param chart
|
||||||
|
*/
|
||||||
public ChartBuilder(MChart chart) {
|
public ChartBuilder(MChart chart) {
|
||||||
this.chartModel = chart;
|
this.chartModel = chart;
|
||||||
}
|
}
|
||||||
|
|
@ -145,6 +149,9 @@ public class ChartBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load data from chart data source
|
||||||
|
*/
|
||||||
public void loadData() {
|
public void loadData() {
|
||||||
queries = new HashMap<String,MQuery>();
|
queries = new HashMap<String,MQuery>();
|
||||||
for ( MChartDatasource ds : chartModel.getDatasources() )
|
for ( MChartDatasource ds : chartModel.getDatasources() )
|
||||||
|
|
@ -153,6 +160,10 @@ public class ChartBuilder {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load data from data source into {@link #dataset}
|
||||||
|
* @param ds
|
||||||
|
*/
|
||||||
private void addData(MChartDatasource ds) {
|
private void addData(MChartDatasource ds) {
|
||||||
|
|
||||||
String value = ds.getValueColumn();
|
String value = ds.getValueColumn();
|
||||||
|
|
@ -335,8 +346,13 @@ public class ChartBuilder {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private Date increment(Date lastDate, String timeUnit, int qty) {
|
/**
|
||||||
|
* @param lastDate input date
|
||||||
|
* @param timeUnit AD_Chart.TIMEUNIT_*
|
||||||
|
* @param qty qty to increment
|
||||||
|
* @return alter date
|
||||||
|
*/
|
||||||
|
private Date increment(Date lastDate, String timeUnit, int qty) {
|
||||||
if ( lastDate == null )
|
if ( lastDate == null )
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
|
|
@ -357,35 +373,56 @@ public class ChartBuilder {
|
||||||
return cal.getTime();
|
return cal.getTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and load data set from data source
|
||||||
|
* @return CategoryDataset
|
||||||
|
*/
|
||||||
public CategoryDataset getCategoryDataset() {
|
public CategoryDataset getCategoryDataset() {
|
||||||
dataset = new DefaultCategoryDataset();
|
dataset = new DefaultCategoryDataset();
|
||||||
loadData();
|
loadData();
|
||||||
return (CategoryDataset) dataset;
|
return (CategoryDataset) dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and load data set from data source
|
||||||
|
* @return IntervalXYDataset
|
||||||
|
*/
|
||||||
public IntervalXYDataset getXYDataset() {
|
public IntervalXYDataset getXYDataset() {
|
||||||
dataset = new TimeSeriesCollection();
|
dataset = new TimeSeriesCollection();
|
||||||
loadData();
|
loadData();
|
||||||
return (IntervalXYDataset) dataset;
|
return (IntervalXYDataset) dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create and load data set from data source
|
||||||
|
* @return PieDataset
|
||||||
|
*/
|
||||||
public PieDataset getPieDataset() {
|
public PieDataset getPieDataset() {
|
||||||
dataset = new DefaultPieDataset();
|
dataset = new DefaultPieDataset();
|
||||||
loadData();
|
loadData();
|
||||||
return (PieDataset) dataset;
|
return (PieDataset) dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get current data set
|
||||||
|
* @return dataset
|
||||||
|
*/
|
||||||
public Dataset getDataset() {
|
public Dataset getDataset() {
|
||||||
return dataset;
|
return dataset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return named query
|
||||||
|
*/
|
||||||
public HashMap<String, MQuery> getQueries() {
|
public HashMap<String, MQuery> getQueries() {
|
||||||
return queries;
|
return queries;
|
||||||
}
|
}
|
||||||
|
|
||||||
public MQuery getQuery(String key) {
|
/**
|
||||||
|
* @param key
|
||||||
|
* @return MQuery
|
||||||
|
*/
|
||||||
|
public MQuery getQuery(String key) {
|
||||||
if ( queries.containsKey(key) )
|
if ( queries.containsKey(key) )
|
||||||
{
|
{
|
||||||
return queries.get(key);
|
return queries.get(key);
|
||||||
|
|
@ -394,6 +431,9 @@ public class ChartBuilder {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createXYBarChart() {
|
private JFreeChart createXYBarChart() {
|
||||||
JFreeChart chart = ChartFactory.createXYBarChart(
|
JFreeChart chart = ChartFactory.createXYBarChart(
|
||||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||||
|
|
@ -412,6 +452,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createTimeSeriesChart() {
|
private JFreeChart createTimeSeriesChart() {
|
||||||
JFreeChart chart = ChartFactory.createTimeSeriesChart(
|
JFreeChart chart = ChartFactory.createTimeSeriesChart(
|
||||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||||
|
|
@ -427,6 +470,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createWaterfallChart() {
|
private JFreeChart createWaterfallChart() {
|
||||||
JFreeChart chart = ChartFactory.createWaterfallChart(
|
JFreeChart chart = ChartFactory.createWaterfallChart(
|
||||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||||
|
|
@ -444,6 +490,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createRingChart() {
|
private JFreeChart createRingChart() {
|
||||||
final JFreeChart chart = ChartFactory.createRingChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
final JFreeChart chart = ChartFactory.createRingChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
||||||
getPieDataset(), chartModel.isDisplayLegend(), true, true);
|
getPieDataset(), chartModel.isDisplayLegend(), true, true);
|
||||||
|
|
@ -451,6 +500,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createPieChart() {
|
private JFreeChart createPieChart() {
|
||||||
final JFreeChart chart = ChartFactory.createPieChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
final JFreeChart chart = ChartFactory.createPieChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
||||||
getPieDataset(), false, true, true);
|
getPieDataset(), false, true, true);
|
||||||
|
|
@ -458,6 +510,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart create3DPieChart() {
|
private JFreeChart create3DPieChart() {
|
||||||
final JFreeChart chart = ChartFactory.createPieChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
final JFreeChart chart = ChartFactory.createPieChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
||||||
getPieDataset(), false, true, true);
|
getPieDataset(), false, true, true);
|
||||||
|
|
@ -465,6 +520,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createBarChart() {
|
private JFreeChart createBarChart() {
|
||||||
JFreeChart chart = ChartFactory.createBarChart(
|
JFreeChart chart = ChartFactory.createBarChart(
|
||||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||||
|
|
@ -488,6 +546,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart create3DBarChart() {
|
private JFreeChart create3DBarChart() {
|
||||||
JFreeChart chart = ChartFactory.createBarChart(
|
JFreeChart chart = ChartFactory.createBarChart(
|
||||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||||
|
|
@ -505,6 +566,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createStackedBarChart() {
|
private JFreeChart createStackedBarChart() {
|
||||||
JFreeChart chart = ChartFactory.createStackedBarChart(
|
JFreeChart chart = ChartFactory.createStackedBarChart(
|
||||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||||
|
|
@ -529,6 +593,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart create3DStackedBarChart() {
|
private JFreeChart create3DStackedBarChart() {
|
||||||
JFreeChart chart = ChartFactory.createStackedBarChart(
|
JFreeChart chart = ChartFactory.createStackedBarChart(
|
||||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||||
|
|
@ -546,6 +613,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createAreaChart() {
|
private JFreeChart createAreaChart() {
|
||||||
// create the chart...
|
// create the chart...
|
||||||
JFreeChart chart = ChartFactory.createAreaChart(
|
JFreeChart chart = ChartFactory.createAreaChart(
|
||||||
|
|
@ -564,6 +634,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createStackedAreaChart() {
|
private JFreeChart createStackedAreaChart() {
|
||||||
// create the chart...
|
// create the chart...
|
||||||
JFreeChart chart = ChartFactory.createStackedAreaChart(
|
JFreeChart chart = ChartFactory.createStackedAreaChart(
|
||||||
|
|
@ -582,6 +655,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart createLineChart() {
|
private JFreeChart createLineChart() {
|
||||||
// create the chart...
|
// create the chart...
|
||||||
JFreeChart chart = ChartFactory.createLineChart(
|
JFreeChart chart = ChartFactory.createLineChart(
|
||||||
|
|
@ -601,6 +677,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return JFreeChart
|
||||||
|
*/
|
||||||
private JFreeChart create3DLineChart() {
|
private JFreeChart create3DLineChart() {
|
||||||
// create the chart...
|
// create the chart...
|
||||||
JFreeChart chart = ChartFactory.createLineChart(
|
JFreeChart chart = ChartFactory.createLineChart(
|
||||||
|
|
@ -620,6 +699,9 @@ public class ChartBuilder {
|
||||||
return chart;
|
return chart;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param chart
|
||||||
|
*/
|
||||||
private void setupCategoryChart(JFreeChart chart) {
|
private void setupCategoryChart(JFreeChart chart) {
|
||||||
CategoryPlot plot = chart.getCategoryPlot();
|
CategoryPlot plot = chart.getCategoryPlot();
|
||||||
CategoryAxis xAxis = (CategoryAxis)plot.getDomainAxis();
|
CategoryAxis xAxis = (CategoryAxis)plot.getDomainAxis();
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,9 @@ import org.jfree.data.general.DefaultPieDataset;
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
* @deprecated
|
||||||
*/
|
*/
|
||||||
|
@Deprecated
|
||||||
public class GraphBuilder {
|
public class GraphBuilder {
|
||||||
|
|
||||||
/** The Goal */
|
/** The Goal */
|
||||||
|
|
|
||||||
|
|
@ -29,13 +29,11 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DisplayType;
|
import org.compiere.util.DisplayType;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Value object of chart column
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class GraphColumn
|
public class GraphColumn
|
||||||
{
|
{
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base Constructor
|
* Base Constructor
|
||||||
* @param label label
|
* @param label label
|
||||||
|
|
@ -81,6 +79,8 @@ public class GraphColumn
|
||||||
/**
|
/**
|
||||||
* Request Type Constructor
|
* Request Type Constructor
|
||||||
* @param rt Request Type
|
* @param rt Request Type
|
||||||
|
* @param data
|
||||||
|
* @param id
|
||||||
*/
|
*/
|
||||||
public GraphColumn (MRequestType rt, BigDecimal data, int id)
|
public GraphColumn (MRequestType rt, BigDecimal data, int id)
|
||||||
{
|
{
|
||||||
|
|
@ -92,6 +92,8 @@ public class GraphColumn
|
||||||
/**
|
/**
|
||||||
* Project Type Constructor
|
* Project Type Constructor
|
||||||
* @param pt Project Type
|
* @param pt Project Type
|
||||||
|
* @param data
|
||||||
|
* @param id
|
||||||
*/
|
*/
|
||||||
public GraphColumn (MProjectType pt, BigDecimal data, int id)
|
public GraphColumn (MProjectType pt, BigDecimal data, int id)
|
||||||
{
|
{
|
||||||
|
|
@ -163,33 +165,48 @@ public class GraphColumn
|
||||||
return m_mc;
|
return m_mc;
|
||||||
} // getMeasureCalc
|
} // getMeasureCalc
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return MRequestType
|
||||||
|
*/
|
||||||
public MRequestType getRequestType()
|
public MRequestType getRequestType()
|
||||||
{
|
{
|
||||||
return m_rt;
|
return m_rt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return MProjectType
|
||||||
|
*/
|
||||||
public MProjectType getProjectType()
|
public MProjectType getProjectType()
|
||||||
{
|
{
|
||||||
return m_pt;
|
return m_pt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return measure display type (MGoal.MEASUREDISPLAY_*)
|
||||||
|
*/
|
||||||
public String getMeasureDisplay()
|
public String getMeasureDisplay()
|
||||||
{
|
{
|
||||||
return m_measureDisplay;
|
return m_measureDisplay;
|
||||||
} // getMeasureDisplay
|
} // getMeasureDisplay
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return date
|
||||||
|
*/
|
||||||
public Timestamp getDate()
|
public Timestamp getDate()
|
||||||
{
|
{
|
||||||
return m_date;
|
return m_date;
|
||||||
} // getDate
|
} // getDate
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return record id
|
||||||
|
*/
|
||||||
public int getID()
|
public int getID()
|
||||||
{
|
{
|
||||||
return m_id;
|
return m_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the label.
|
* @return column label.
|
||||||
*/
|
*/
|
||||||
public String getLabel ()
|
public String getLabel ()
|
||||||
{
|
{
|
||||||
|
|
@ -210,7 +227,7 @@ public class GraphColumn
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param date for label.
|
* @param date for label.
|
||||||
* @param MeasureDisplay measure display
|
* @param MeasureDisplay measure display type (MGoal.MEASUREDISPLAY_*)
|
||||||
*/
|
*/
|
||||||
public void setLabel (Timestamp date, String MeasureDisplay)
|
public void setLabel (Timestamp date, String MeasureDisplay)
|
||||||
{
|
{
|
||||||
|
|
@ -243,7 +260,7 @@ public class GraphColumn
|
||||||
} // setLabel
|
} // setLabel
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the targetValue.
|
* @return targetValue.
|
||||||
*/
|
*/
|
||||||
public double getTargetValue ()
|
public double getTargetValue ()
|
||||||
{
|
{
|
||||||
|
|
@ -259,7 +276,7 @@ public class GraphColumn
|
||||||
} // setTargetValue
|
} // setTargetValue
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the data value.
|
* @return data value
|
||||||
*/
|
*/
|
||||||
public double getValue ()
|
public double getValue ()
|
||||||
{
|
{
|
||||||
|
|
@ -279,7 +296,7 @@ public class GraphColumn
|
||||||
} // setValue
|
} // setValue
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the column width in pixels.
|
* @return column width in pixels.
|
||||||
*/
|
*/
|
||||||
public double getColWidth ()
|
public double getColWidth ()
|
||||||
{
|
{
|
||||||
|
|
@ -295,7 +312,7 @@ public class GraphColumn
|
||||||
} // getColWidth
|
} // getColWidth
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return Returns the height in pixels.
|
* @return height in pixels.
|
||||||
*/
|
*/
|
||||||
public double getColHeight()
|
public double getColHeight()
|
||||||
{
|
{
|
||||||
|
|
@ -310,6 +327,11 @@ public class GraphColumn
|
||||||
m_height = height;
|
m_height = height;
|
||||||
} // setHeight
|
} // setHeight
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get query for goal
|
||||||
|
* @param mGoal
|
||||||
|
* @return query
|
||||||
|
*/
|
||||||
public MQuery getMQuery(MGoal mGoal)
|
public MQuery getMQuery(MGoal mGoal)
|
||||||
{
|
{
|
||||||
MQuery query = null;
|
MQuery query = null;
|
||||||
|
|
|
||||||
|
|
@ -45,6 +45,13 @@ public abstract class AbstractModelFactory implements IModelFactory {
|
||||||
return getPO(getClass(tableName), tableName, Record_ID, trxName);
|
return getPO(getClass(tableName), tableName, Record_ID, trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param clazz
|
||||||
|
* @param tableName
|
||||||
|
* @param Record_ID
|
||||||
|
* @param trxName
|
||||||
|
* @return new PO instance
|
||||||
|
*/
|
||||||
public static PO getPO(Class<?> clazz, String tableName, int Record_ID, String trxName) {
|
public static PO getPO(Class<?> clazz, String tableName, int Record_ID, String trxName) {
|
||||||
if (clazz == null)
|
if (clazz == null)
|
||||||
{
|
{
|
||||||
|
|
@ -130,6 +137,13 @@ public abstract class AbstractModelFactory implements IModelFactory {
|
||||||
return getPO(getClass(tableName), tableName, Record_UU, trxName);
|
return getPO(getClass(tableName), tableName, Record_UU, trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param clazz
|
||||||
|
* @param tableName
|
||||||
|
* @param Record_UU
|
||||||
|
* @param trxName
|
||||||
|
* @return new PO instance
|
||||||
|
*/
|
||||||
public static PO getPO(Class<?> clazz, String tableName, String Record_UU, String trxName) {
|
public static PO getPO(Class<?> clazz, String tableName, String Record_UU, String trxName) {
|
||||||
if (clazz == null)
|
if (clazz == null)
|
||||||
{
|
{
|
||||||
|
|
@ -208,6 +222,13 @@ public abstract class AbstractModelFactory implements IModelFactory {
|
||||||
return getPO(getClass(tableName), tableName, rs, trxName);
|
return getPO(getClass(tableName), tableName, rs, trxName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param clazz
|
||||||
|
* @param tableName
|
||||||
|
* @param rs
|
||||||
|
* @param trxName
|
||||||
|
* @return new PO instance
|
||||||
|
*/
|
||||||
public static PO getPO(Class<?> clazz, String tableName, ResultSet rs, String trxName) {
|
public static PO getPO(Class<?> clazz, String tableName, ResultSet rs, String trxName) {
|
||||||
if (clazz == null)
|
if (clazz == null)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -98,6 +98,12 @@ public abstract class AnnotationBasedColumnCalloutFactory extends AnnotationBase
|
||||||
return callouts.toArray(new IColumnCallout[0]);
|
return callouts.toArray(new IColumnCallout[0]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create new callout instance using reflection and add it to the callouts list
|
||||||
|
* @param callouts
|
||||||
|
* @param classLoader
|
||||||
|
* @param calloutClassNames
|
||||||
|
*/
|
||||||
private void newCalloutInstance(List<IColumnCallout> callouts, ClassLoader classLoader,
|
private void newCalloutInstance(List<IColumnCallout> callouts, ClassLoader classLoader,
|
||||||
List<String> calloutClassNames) {
|
List<String> calloutClassNames) {
|
||||||
for(String calloutClass : calloutClassNames) {
|
for(String calloutClass : calloutClassNames) {
|
||||||
|
|
@ -136,6 +142,11 @@ public abstract class AnnotationBasedColumnCalloutFactory extends AnnotationBase
|
||||||
*/
|
*/
|
||||||
protected abstract String[] getPackages();
|
protected abstract String[] getPackages();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Perform annotation scanning upon activation of component
|
||||||
|
* @param context
|
||||||
|
* @throws ClassNotFoundException
|
||||||
|
*/
|
||||||
@Activate
|
@Activate
|
||||||
public void activate(ComponentContext context) throws ClassNotFoundException {
|
public void activate(ComponentContext context) throws ClassNotFoundException {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
@ -179,6 +190,11 @@ public abstract class AnnotationBasedColumnCalloutFactory extends AnnotationBase
|
||||||
graph.scanAsync(getExecutorService(), getMaxThreads(), scanResultProcessor, getScanFailureHandler());
|
graph.scanAsync(getExecutorService(), getMaxThreads(), scanResultProcessor, getScanFailureHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process class annotation and register column callout.
|
||||||
|
* @param className
|
||||||
|
* @param annotationInfo
|
||||||
|
*/
|
||||||
private void processAnnotation(String className, AnnotationInfo annotationInfo) {
|
private void processAnnotation(String className, AnnotationInfo annotationInfo) {
|
||||||
//not sure why but sometime ClassGraph return Object[] instead of the expected String[]
|
//not sure why but sometime ClassGraph return Object[] instead of the expected String[]
|
||||||
Object[] tableNames = (Object[]) annotationInfo.getParameterValues().getValue("tableName");
|
Object[] tableNames = (Object[]) annotationInfo.getParameterValues().getValue("tableName");
|
||||||
|
|
@ -232,6 +248,12 @@ public abstract class AnnotationBasedColumnCalloutFactory extends AnnotationBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add callout for column names
|
||||||
|
* @param className
|
||||||
|
* @param columnNames
|
||||||
|
* @param columnNameMap
|
||||||
|
*/
|
||||||
private void addCallout(String className, Object[] columnNames, Map<String, List<String>> columnNameMap) {
|
private void addCallout(String className, Object[] columnNames, Map<String, List<String>> columnNameMap) {
|
||||||
for (Object columnName : columnNames) {
|
for (Object columnName : columnNames) {
|
||||||
List<String> callouts = columnNameMap.get(columnName);
|
List<String> callouts = columnNameMap.get(columnName);
|
||||||
|
|
@ -243,6 +265,11 @@ public abstract class AnnotationBasedColumnCalloutFactory extends AnnotationBase
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add global callout (for all columns)
|
||||||
|
* @param className
|
||||||
|
* @param columnNameMap
|
||||||
|
*/
|
||||||
private void addCallout(String className, Map<String, List<String>> columnNameMap) {
|
private void addCallout(String className, Map<String, List<String>> columnNameMap) {
|
||||||
List<String> callouts = columnNameMap.get("*");
|
List<String> callouts = columnNameMap.get("*");
|
||||||
if (callouts == null ) {
|
if (callouts == null ) {
|
||||||
|
|
|
||||||
|
|
@ -215,6 +215,12 @@ public abstract class AnnotationBasedEventManager extends AnnotationBasedFactory
|
||||||
scan(bundleContext, true, getPackages());
|
scan(bundleContext, true, getPackages());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param classLoader
|
||||||
|
* @param className
|
||||||
|
* @param filter
|
||||||
|
* @return new SimpleEventHandler instance
|
||||||
|
*/
|
||||||
private EventHandler simpleEventDelegate(ClassLoader classLoader, String className, String filter) {
|
private EventHandler simpleEventDelegate(ClassLoader classLoader, String className, String filter) {
|
||||||
try {
|
try {
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
|
@ -233,6 +239,13 @@ public abstract class AnnotationBasedEventManager extends AnnotationBasedFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param classLoader
|
||||||
|
* @param className
|
||||||
|
* @param annotationInfo
|
||||||
|
* @param filter
|
||||||
|
* @return new ProcessEventHandler instance
|
||||||
|
*/
|
||||||
private EventHandler processEventDelegate(ClassLoader classLoader, String className, AnnotationInfo annotationInfo, String filter) {
|
private EventHandler processEventDelegate(ClassLoader classLoader, String className, AnnotationInfo annotationInfo, String filter) {
|
||||||
try {
|
try {
|
||||||
String processUUID = (String) annotationInfo.getParameterValues().getValue("processUUID");
|
String processUUID = (String) annotationInfo.getParameterValues().getValue("processUUID");
|
||||||
|
|
@ -252,6 +265,13 @@ public abstract class AnnotationBasedEventManager extends AnnotationBasedFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param classLoader
|
||||||
|
* @param className
|
||||||
|
* @param annotationInfo
|
||||||
|
* @param filter
|
||||||
|
* @return new ImportEventHandler instance
|
||||||
|
*/
|
||||||
private EventHandler importEventDelegate(ClassLoader classLoader, String className, AnnotationInfo annotationInfo, String filter) {
|
private EventHandler importEventDelegate(ClassLoader classLoader, String className, AnnotationInfo annotationInfo, String filter) {
|
||||||
try {
|
try {
|
||||||
String importTableName = (String) annotationInfo.getParameterValues().getValue("importTableName");
|
String importTableName = (String) annotationInfo.getParameterValues().getValue("importTableName");
|
||||||
|
|
@ -271,6 +291,13 @@ public abstract class AnnotationBasedEventManager extends AnnotationBasedFactory
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param classLoader
|
||||||
|
* @param className
|
||||||
|
* @param annotationInfo
|
||||||
|
* @param filter
|
||||||
|
* @return new ModelEventHandler instance
|
||||||
|
*/
|
||||||
private EventHandler modelEventDelegate(ClassLoader classLoader, String className, AnnotationInfo annotationInfo, String filter) {
|
private EventHandler modelEventDelegate(ClassLoader classLoader, String className, AnnotationInfo annotationInfo, String filter) {
|
||||||
try {
|
try {
|
||||||
AnnotationClassRef classRef = (AnnotationClassRef) annotationInfo.getParameterValues().getValue("modelClass");
|
AnnotationClassRef classRef = (AnnotationClassRef) annotationInfo.getParameterValues().getValue("modelClass");
|
||||||
|
|
|
||||||
|
|
@ -21,6 +21,7 @@ import java.util.concurrent.ExecutorService;
|
||||||
import java.util.concurrent.Executors;
|
import java.util.concurrent.Executors;
|
||||||
import java.util.concurrent.Future;
|
import java.util.concurrent.Future;
|
||||||
import java.util.concurrent.atomic.AtomicBoolean;
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
@ -66,14 +67,18 @@ public abstract class AnnotationBasedFactory {
|
||||||
} catch (Exception e) { }
|
} catch (Exception e) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Wait for completion of annotation scanning
|
||||||
|
*/
|
||||||
protected void blockWhileScanning() {
|
protected void blockWhileScanning() {
|
||||||
String className = this.getClass().getSimpleName();
|
String className = this.getClass().getSimpleName();
|
||||||
if(!scanCompleted.get())
|
if(!scanCompleted.get())
|
||||||
try {
|
try {
|
||||||
Instant start = Instant.now();
|
Instant start = Instant.now();
|
||||||
threadBlockerFuture.get();
|
threadBlockerFuture.get();
|
||||||
s_log.fine(() -> String.format("%s waited %d(ms) for class scanning to end"
|
if (s_log.isLoggable(Level.FINE))
|
||||||
, className, Duration.between(start, Instant.now()).toMillis()));
|
s_log.fine(() -> String.format("%s waited %d(ms) for class scanning to end"
|
||||||
|
, className, Duration.between(start, Instant.now()).toMillis()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import io.github.classgraph.ScanResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translates table names into model classes having the {@link Model} annotation. Relies on
|
* Translates table names into model classes having the {@link Model} annotation. Relies on
|
||||||
* {@link DefaultModelFactory} for everything else.
|
* {@link DefaultModelFactory} for everything else.<br/>
|
||||||
* This factory is designed to have a service rank higher than {@link DefaultModelFactory}, as class
|
* This factory is designed to have a service rank higher than {@link DefaultModelFactory}, as class
|
||||||
* discovery using SPI is preferred over reflection-based methods.
|
* discovery using SPI is preferred over reflection-based methods.
|
||||||
* @author Saulo Gil
|
* @author Saulo Gil
|
||||||
|
|
@ -77,6 +77,11 @@ public class AnnotationBasedModelFactory extends AnnotationBasedFactory implemen
|
||||||
return patterns;
|
return patterns;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scan annotation upon activation of component
|
||||||
|
* @param context
|
||||||
|
* @throws ClassNotFoundException
|
||||||
|
*/
|
||||||
@Activate
|
@Activate
|
||||||
public void activate(ComponentContext context) throws ClassNotFoundException {
|
public void activate(ComponentContext context) throws ClassNotFoundException {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
@ -125,6 +130,11 @@ public class AnnotationBasedModelFactory extends AnnotationBasedFactory implemen
|
||||||
graph.scanAsync(getExecutorService(), getMaxThreads(), scanResultProcessor, getScanFailureHandler());
|
graph.scanAsync(getExecutorService(), getMaxThreads(), scanResultProcessor, getScanFailureHandler());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Process annotation scan result
|
||||||
|
* @param classLoader
|
||||||
|
* @param scanResult
|
||||||
|
*/
|
||||||
private void processResults(ClassLoader classLoader, ScanResult scanResult ) {
|
private void processResults(ClassLoader classLoader, ScanResult scanResult ) {
|
||||||
BiConsumer<String,ClassNotFoundException> exceptionHandler = (className, exception) ->
|
BiConsumer<String,ClassNotFoundException> exceptionHandler = (className, exception) ->
|
||||||
s_log.severe(String.format("exception while loading class %s - %s", className, exception.getMessage()));
|
s_log.severe(String.format("exception while loading class %s - %s", className, exception.getMessage()));
|
||||||
|
|
|
||||||
|
|
@ -44,7 +44,7 @@ import io.github.classgraph.ClassGraph.ScanResultProcessor;
|
||||||
import io.github.classgraph.ClassInfo;
|
import io.github.classgraph.ClassInfo;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Scan, discover and register process classes.
|
* Scan, discover and register process classes.<br/>
|
||||||
* Process class will be registered using class name. You can use the optional
|
* Process class will be registered using class name. You can use the optional
|
||||||
* {@link Process} annotation to register a process class with an additional name (for e.g
|
* {@link Process} annotation to register a process class with an additional name (for e.g
|
||||||
* to replace a core process class).
|
* to replace a core process class).
|
||||||
|
|
@ -72,6 +72,11 @@ public abstract class AnnotationBasedProcessFactory extends AnnotationBasedFacto
|
||||||
*/
|
*/
|
||||||
protected abstract String[] getPackages();
|
protected abstract String[] getPackages();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Scan annotation upon activation of component
|
||||||
|
* @param context
|
||||||
|
* @throws ClassNotFoundException
|
||||||
|
*/
|
||||||
@Activate
|
@Activate
|
||||||
public void activate(ComponentContext context) throws ClassNotFoundException {
|
public void activate(ComponentContext context) throws ClassNotFoundException {
|
||||||
long start = System.currentTimeMillis();
|
long start = System.currentTimeMillis();
|
||||||
|
|
@ -103,8 +108,9 @@ public abstract class AnnotationBasedProcessFactory extends AnnotationBasedFacto
|
||||||
classCache.put(alternateName, className);
|
classCache.put(alternateName, className);
|
||||||
}
|
}
|
||||||
long end = System.currentTimeMillis();
|
long end = System.currentTimeMillis();
|
||||||
s_log.info(() -> this.getClass().getSimpleName() + " loaded " + classCache.size() + " classes in "
|
if (s_log.isLoggable(Level.INFO))
|
||||||
+ ((end-start)/1000f) + "s");
|
s_log.info(() -> this.getClass().getSimpleName() + " loaded " + classCache.size() + " classes in "
|
||||||
|
+ ((end-start)/1000f) + "s");
|
||||||
signalScanCompletion(true);
|
signalScanCompletion(true);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,6 @@ public final class ColumnCalloutManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param tableName
|
* @param tableName
|
||||||
* @param columnName
|
* @param columnName
|
||||||
* @return list of {@link IColumnCallout} register for tableName.columnName
|
* @return list of {@link IColumnCallout} register for tableName.columnName
|
||||||
|
|
@ -137,7 +136,6 @@ public final class ColumnCalloutManager {
|
||||||
|
|
||||||
// IDEMPIERE-2732
|
// IDEMPIERE-2732
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param className
|
* @param className
|
||||||
* @param methodName
|
* @param methodName
|
||||||
* @return {@link Callout} for className and methodName
|
* @return {@link Callout} for className and methodName
|
||||||
|
|
@ -172,8 +170,7 @@ public final class ColumnCalloutManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return {@link IMappedColumnCalloutFactory} instance
|
||||||
* @return {@link IMappedColumnCalloutFactory}
|
|
||||||
*/
|
*/
|
||||||
public synchronized static IMappedColumnCalloutFactory getMappedColumnCalloutFactory() {
|
public synchronized static IMappedColumnCalloutFactory getMappedColumnCalloutFactory() {
|
||||||
IMappedColumnCalloutFactory factoryService = null;
|
IMappedColumnCalloutFactory factoryService = null;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,8 @@ import org.osgi.service.component.runtime.ServiceComponentRuntime;
|
||||||
import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
|
import org.osgi.service.component.runtime.dto.ComponentDescriptionDTO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Service listener to block the loading of OSGi component. <br/>
|
||||||
|
* To block the loading of an OSGi component, append the OSGi component's component name to {IDEMPIERE_HOME}/components.blacklist file.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -20,7 +20,8 @@ import org.adempiere.model.IAddressValidation;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default address validation factory
|
* Default {@link IAddressValidationFactory} implementation for core.<br/>
|
||||||
|
* Load {@link IAddressValidation} instance from plugin.xml (org.adempiere.model.IAddressValidation extension point) or class path.
|
||||||
* @author Elaine
|
* @author Elaine
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -21,10 +21,9 @@ import org.compiere.model.Callout;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link ICalloutFactory} implementation for core.<br/>
|
||||||
|
* Load {@link Callout} instance from plugin.xml (org.compiere.model.Callout extension point) or class path.
|
||||||
* @author a42niem
|
* @author a42niem
|
||||||
*
|
|
||||||
* This is just a blueprint for creation of a CalloutFactory
|
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultCalloutFactory implements ICalloutFactory {
|
public class DefaultCalloutFactory implements ICalloutFactory {
|
||||||
|
|
||||||
|
|
@ -96,7 +95,8 @@ public class DefaultCalloutFactory implements ICalloutFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
log.log(Level.FINE, "Required method " + methodName + " not found in class " + className);
|
if (log.isLoggable(Level.FINE))
|
||||||
|
log.log(Level.FINE, "Required method " + methodName + " not found in class " + className);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,9 @@ import java.util.List;
|
||||||
import org.adempiere.base.equinox.EquinoxExtensionLocator;
|
import org.adempiere.base.equinox.EquinoxExtensionLocator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link IColumnCalloutFactory} implementation for core.<br/>
|
||||||
|
* Load {@link IColumnCallout} instance from plugin.xml (org.adempiere.base.IColumnCallout extension point)
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultColumnCalloutFactory implements IColumnCalloutFactory {
|
public class DefaultColumnCalloutFactory implements IColumnCalloutFactory {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,8 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Default {@link IDocFactory} implementation from core.<br/>
|
||||||
|
* Load {@link Doc} instance from class path.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -26,9 +26,10 @@ import org.compiere.util.DisplayType;
|
||||||
import static org.compiere.util.DisplayType.*;
|
import static org.compiere.util.DisplayType.*;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link ILookupFactory} implementation for core.<br/>
|
||||||
|
* Create new {@link Lookup} instance by predefined display type.
|
||||||
* @author Jan Thielemann - jan.thielemann@evenos.de
|
* @author Jan Thielemann - jan.thielemann@evenos.de
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultLookupFactory implements ILookupFactory{
|
public class DefaultLookupFactory implements ILookupFactory{
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,9 @@ import org.adempiere.base.equinox.EquinoxExtensionLocator;
|
||||||
import org.compiere.model.ModelValidator;
|
import org.compiere.model.ModelValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link IModelValidatorFactory} implementation for core. <br/>
|
||||||
|
* Load {@link ModelValidator} instance from plugin.xml (org.adempiere.base.ModelValidator extension point) or class path.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultModelValidatorFactory implements IModelValidatorFactory {
|
public class DefaultModelValidatorFactory implements IModelValidatorFactory {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,9 @@ import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.PaymentExport;
|
import org.compiere.util.PaymentExport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link IPaymentExporterFactory} implementation for core.<br/>
|
||||||
|
* Load {@link PaymentExport} instance from plugin.xml (org.compiere.util.PaymentExport extension point) or class path.
|
||||||
* @author mbozem
|
* @author mbozem
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultPaymentExporterFactory implements IPaymentExporterFactory {
|
public class DefaultPaymentExporterFactory implements IPaymentExporterFactory {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,9 @@ import org.compiere.model.PaymentProcessor;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link IPaymentProcessorFactory} implementation for core. <br/>
|
||||||
|
* Load {@link PaymentProcessor} instance from plugin.xml (org.compiere.model.PaymentProcessor extension point) or class path.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultPaymentProcessorFactory implements IPaymentProcessorFactory {
|
public class DefaultPaymentProcessorFactory implements IPaymentProcessorFactory {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,9 @@ import org.compiere.process.ProcessCall;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link IProcessFactory} implementation for core.<br/>
|
||||||
|
* Load {@link ProcessCall} instance from plugin.xml (org.adempiere.base.Process extension point) or class path.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultProcessFactory implements IProcessFactory {
|
public class DefaultProcessFactory implements IProcessFactory {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,35 @@
|
||||||
|
/***********************************************************************
|
||||||
|
* This file is part of iDempiere ERP Open Source *
|
||||||
|
* http://www.idempiere.org *
|
||||||
|
* *
|
||||||
|
* Copyright (C) Contributors *
|
||||||
|
* *
|
||||||
|
* This program is free software; you can redistribute it and/or *
|
||||||
|
* modify it under the terms of the GNU General Public License *
|
||||||
|
* as published by the Free Software Foundation; either version 2 *
|
||||||
|
* of the License, or (at your option) any later version. *
|
||||||
|
* *
|
||||||
|
* This program is distributed in the hope that it will be useful, *
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of *
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
|
||||||
|
* GNU General Public License for more details. *
|
||||||
|
* *
|
||||||
|
* You should have received a copy of the GNU General Public License *
|
||||||
|
* along with this program; if not, write to the Free Software *
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, *
|
||||||
|
* MA 02110-1301, USA. *
|
||||||
|
* *
|
||||||
|
* Contributors: *
|
||||||
|
* - Diego Ruiz *
|
||||||
|
**********************************************************************/
|
||||||
package org.adempiere.base;
|
package org.adempiere.base;
|
||||||
|
|
||||||
import org.compiere.model.MProductPricing;
|
import org.compiere.model.MProductPricing;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default {@link IProductPricingFactory} implementation for core. <br/>
|
||||||
|
* Always return new {@link MProductPricing} instance.
|
||||||
|
*/
|
||||||
public class DefaultProductPricingFactory implements IProductPricingFactory {
|
public class DefaultProductPricingFactory implements IProductPricingFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,9 @@ import org.adempiere.model.IShipmentProcessor;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link IShipmentProcessorFactory} implementation for core.<br/>
|
||||||
|
* Load {@link IShipmentProcessor} instance from plugin.xml (org.adempiere.model.IShipmentProcessor extension point) or class path.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultShipmentProcessorFactory implements IShipmentProcessorFactory {
|
public class DefaultShipmentProcessorFactory implements IShipmentProcessorFactory {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -31,8 +31,9 @@ import org.compiere.model.Tax;
|
||||||
import org.osgi.service.component.annotations.Component;
|
import org.osgi.service.component.annotations.Component;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Default {@link ITaxLookup} implementation for core.<br/>
|
||||||
|
* Delegate to the static get methods in {@link Tax}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Component(immediate = true, service = {ITaxLookup.class})
|
@Component(immediate = true, service = {ITaxLookup.class})
|
||||||
public class DefaultTaxLookup implements ITaxLookup {
|
public class DefaultTaxLookup implements ITaxLookup {
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,9 @@ import org.adempiere.model.ITaxProvider;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Default tax provider factory
|
* Default {@link ITaxProviderFactory} implementation for core.<br/>
|
||||||
|
* Load {@link ITaxProvider} instance from plugin.xml (org.adempiere.model.ITaxProvider extension point) or class path.
|
||||||
* @author Elaine
|
* @author Elaine
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DefaultTaxProviderFactory implements ITaxProviderFactory {
|
public class DefaultTaxProviderFactory implements ITaxProviderFactory {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -34,7 +34,7 @@ public interface IBankStatementLoaderFactory {
|
||||||
* want to use.
|
* want to use.
|
||||||
*
|
*
|
||||||
* @param className
|
* @param className
|
||||||
* @return BankStatementLoader instance
|
* @return BankStatementLoaderInterface instance
|
||||||
*/
|
*/
|
||||||
public BankStatementLoaderInterface newBankStatementLoaderInstance(String className);
|
public BankStatementLoaderInterface newBankStatementLoaderInstance(String className);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public interface IBankStatementMatcherFactory {
|
||||||
* the fully qualified classname of the Loader class you want to use.
|
* the fully qualified classname of the Loader class you want to use.
|
||||||
*
|
*
|
||||||
* @param className
|
* @param className
|
||||||
* @return BankStatementMatcher instance
|
* @return BankStatementMatcherInterface instance
|
||||||
*/
|
*/
|
||||||
public BankStatementMatcherInterface newBankStatementMatcherInstance(String className);
|
public BankStatementMatcherInterface newBankStatementMatcherInstance(String className);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,17 +16,17 @@ package org.adempiere.base;
|
||||||
import org.compiere.model.Callout;
|
import org.compiere.model.Callout;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for {@link Callout}.<br/>
|
||||||
|
* For plugin that implement this as OSGi component, use <b>property = {"service.ranking:Integer=1"}</b> to set up a calling order
|
||||||
|
* that prioritizes your component over core component.
|
||||||
* @author a42niem
|
* @author a42niem
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface ICalloutFactory {
|
public interface ICalloutFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param className
|
* @param className
|
||||||
* @param methodName
|
* @param methodName
|
||||||
* @return matching Callout
|
* @return matching Callout instance
|
||||||
*/
|
*/
|
||||||
public Callout getCallout(String className, String methodName);
|
public Callout getCallout(String className, String methodName);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,15 +29,15 @@ public interface IColumnCallout
|
||||||
/**
|
/**
|
||||||
* Start Callout.
|
* Start Callout.
|
||||||
* <p>
|
* <p>
|
||||||
* Callout's are used for cross field validation and setting values in other fields
|
* Callout's are used for cross field validation and setting values in other fields.
|
||||||
* when returning a non empty (error message) string, an exception is raised
|
* When returning a non empty (error message) string, an exception is raised.
|
||||||
* <p>
|
* <p>
|
||||||
* When invoked, the Tab model has the new value!
|
* When invoked, the Tab model has the new value!
|
||||||
*
|
*
|
||||||
* @param ctx Context
|
* @param ctx Context
|
||||||
* @param WindowNo current Window No
|
* @param WindowNo current Window No
|
||||||
* @param mTab Model Tab
|
* @param mTab Tab model
|
||||||
* @param mField Model Field
|
* @param mField Field model
|
||||||
* @param value The new value
|
* @param value The new value
|
||||||
* @param oldValue The old value
|
* @param oldValue The old value
|
||||||
* @return Error message or ""
|
* @return Error message or ""
|
||||||
|
|
|
||||||
|
|
@ -14,14 +14,14 @@
|
||||||
package org.adempiere.base;
|
package org.adempiere.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for {@link IColumnCallout}.<br/>
|
||||||
|
* For plugin that implement this as OSGi component, use <b>property = {"service.ranking:Integer=1"}</b> to set up a calling order
|
||||||
|
* that prioritizes your component over core component.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IColumnCalloutFactory {
|
public interface IColumnCalloutFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param tableName
|
* @param tableName
|
||||||
* @param columnName
|
* @param columnName
|
||||||
* @return array of matching callouts
|
* @return array of matching callouts
|
||||||
|
|
|
||||||
|
|
@ -21,15 +21,22 @@ import org.compiere.model.X_AD_Package_Imp_Proc;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A dictionary service provides for easy handling of dynamic Adempiere
|
* Interface for import of Application Dictionary data.
|
||||||
* dictionary.
|
|
||||||
*
|
*
|
||||||
* @author Joerg Viola
|
* @author Joerg Viola
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IDictionaryService {
|
public interface IDictionaryService {
|
||||||
|
/**
|
||||||
|
* Import application dictionary package
|
||||||
|
* @param context
|
||||||
|
* @param packageFile Application Dictionary package
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
void merge(BundleContext context, File packageFile) throws Exception;
|
void merge(BundleContext context, File packageFile) throws Exception;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return X_AD_Package_Imp_Proc
|
||||||
|
*/
|
||||||
default public X_AD_Package_Imp_Proc getAD_Package_Imp_Proc() {
|
default public X_AD_Package_Imp_Proc getAD_Package_Imp_Proc() {
|
||||||
return null;
|
return null;
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -18,40 +18,99 @@ import java.text.SimpleDateFormat;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Interface for display type factory.
|
||||||
* @author Jan Thielemann - jan.thielemann@evenos-consulting.de
|
* @author Jan Thielemann - jan.thielemann@evenos-consulting.de
|
||||||
* @author evenos Consulting GmbH - www.evenos.org
|
* @author evenos Consulting GmbH - www.evenos.org
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public interface IDisplayTypeFactory {
|
public interface IDisplayTypeFactory {
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return true if displayType is of int ID type
|
||||||
|
*/
|
||||||
public boolean isID(int displayType);
|
public boolean isID(int displayType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return true if displayType is of UUID type
|
||||||
|
*/
|
||||||
public default boolean isUUID(int displayType) {
|
public default boolean isUUID(int displayType) {
|
||||||
return false;
|
return false;
|
||||||
};
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return true if displayType is of numeric type
|
||||||
|
*/
|
||||||
public boolean isNumeric(int displayType);
|
public boolean isNumeric(int displayType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return default numeric precision for displayType
|
||||||
|
*/
|
||||||
public Integer getDefaultPrecision(int displayType);
|
public Integer getDefaultPrecision(int displayType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return true if displayType is of text type
|
||||||
|
*/
|
||||||
public boolean isText(int displayType);
|
public boolean isText(int displayType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return true if displayType is of date type
|
||||||
|
*/
|
||||||
public boolean isDate (int displayType);
|
public boolean isDate (int displayType);
|
||||||
public default boolean isList (int displayType) {
|
public default boolean isList (int displayType) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return true if displayType is of lookup type (usually a foreign key type)
|
||||||
|
*/
|
||||||
public boolean isLookup(int displayType);
|
public boolean isLookup(int displayType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return true if displayType is of LOB type
|
||||||
|
*/
|
||||||
public boolean isLOB (int displayType);
|
public boolean isLOB (int displayType);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @param language
|
||||||
|
* @param pattern
|
||||||
|
* @return DecimalFormat
|
||||||
|
*/
|
||||||
public DecimalFormat getNumberFormat(int displayType, Language language, String pattern);
|
public DecimalFormat getNumberFormat(int displayType, Language language, String pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @param language
|
||||||
|
* @param pattern
|
||||||
|
* @return SimpleDateFormat
|
||||||
|
*/
|
||||||
public SimpleDateFormat getDateFormat (int displayType, Language language, String pattern);
|
public SimpleDateFormat getDateFormat (int displayType, Language language, String pattern);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @param yesNoAsBoolean
|
||||||
|
* @return Java type for displayType
|
||||||
|
*/
|
||||||
public Class<?> getClass (int displayType, boolean yesNoAsBoolean);
|
public Class<?> getClass (int displayType, boolean yesNoAsBoolean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @param columnName
|
||||||
|
* @param fieldLength
|
||||||
|
* @return SQL data type for displayType
|
||||||
|
*/
|
||||||
public String getSQLDataType (int displayType, String columnName, int fieldLength);
|
public String getSQLDataType (int displayType, String columnName, int fieldLength);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param displayType
|
||||||
|
* @return description for displayType
|
||||||
|
*/
|
||||||
public String getDescription (int displayType);
|
public String getDescription (int displayType);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -25,9 +25,8 @@ import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for {@link Doc}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IDocFactory {
|
public interface IDocFactory {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,14 +23,13 @@ import org.adempiere.util.IProcessUI;
|
||||||
import org.compiere.model.GridTab;
|
import org.compiere.model.GridTab;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Interface to import data to {@link GridTab}.
|
||||||
* @author Carlos Ruiz
|
* @author Carlos Ruiz
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IGridTabImporter {
|
public interface IGridTabImporter {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* export gridTab data to file
|
* Import data from filestream to gridTab
|
||||||
* @param gridTab
|
* @param gridTab
|
||||||
* @param childs
|
* @param childs
|
||||||
* @param filestream
|
* @param filestream
|
||||||
|
|
@ -39,14 +38,14 @@ public interface IGridTabImporter {
|
||||||
public File fileImport(GridTab gridTab, List<GridTab> childs, InputStream filestream, Charset charset, String importMode);
|
public File fileImport(GridTab gridTab, List<GridTab> childs, InputStream filestream, Charset charset, String importMode);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* export gridTab data to file
|
* Import data from filestream to gridTab
|
||||||
* @param gridTab
|
* @param gridTab
|
||||||
* @param childs
|
* @param childs
|
||||||
* @param filestream
|
* @param filestream
|
||||||
* @param charset
|
* @param charset
|
||||||
* @param importMode
|
* @param importMode
|
||||||
* @param processUI
|
* @param processUI
|
||||||
* @return
|
* @return File for import log
|
||||||
*/
|
*/
|
||||||
public File fileImport(GridTab gridTab, List<GridTab> childs, InputStream filestream, Charset charset, String importMode, IProcessUI processUI);
|
public File fileImport(GridTab gridTab, List<GridTab> childs, InputStream filestream, Charset charset, String importMode, IProcessUI processUI);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,12 @@ package org.adempiere.base;
|
||||||
import javax.crypto.SecretKey;
|
import javax.crypto.SecretKey;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Interface for key store
|
||||||
* @author deepak
|
* @author deepak
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IKeyStore {
|
public interface IKeyStore {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param AD_Client_ID
|
* @param AD_Client_ID
|
||||||
* @return secret key
|
* @return secret key
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -17,27 +17,27 @@ import org.compiere.model.InfoColumnVO;
|
||||||
import org.compiere.model.Lookup;
|
import org.compiere.model.Lookup;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Factory interface for {@link Lookup}.
|
||||||
|
* For plugin that implement this as OSGi component, use <b>property = {"service.ranking:Integer=1"}</b> to set up a calling order
|
||||||
|
* that prioritizes your component over core component.
|
||||||
* @author Jan Thielemann - jan.thielemann@evenos.de
|
* @author Jan Thielemann - jan.thielemann@evenos.de
|
||||||
* @author evenos Consulting GmbH - www.evenos.org
|
* @author evenos Consulting GmbH - www.evenos.org
|
||||||
*/
|
*/
|
||||||
public interface ILookupFactory {
|
public interface ILookupFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param gridFieldVO
|
* @param gridFieldVO
|
||||||
* @return lookup instance
|
* @return lookup instance
|
||||||
*/
|
*/
|
||||||
public Lookup getLookup (GridFieldVO gridFieldVO);
|
public Lookup getLookup (GridFieldVO gridFieldVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param gridFieldVO
|
* @param gridFieldVO
|
||||||
* @return true if the field's displaytype uses lookup
|
* @return true if the field's displaytype uses lookup
|
||||||
*/
|
*/
|
||||||
public boolean isLookup(GridFieldVO gridFieldVO);
|
public boolean isLookup(GridFieldVO gridFieldVO);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param infoColumnVO
|
* @param infoColumnVO
|
||||||
* @return true if the field's displaytype uses lookup
|
* @return true if the field's displaytype uses lookup
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -47,14 +47,12 @@ public interface IMappedByNameFactory<T> {
|
||||||
public void removeMapping(String name);
|
public void removeMapping(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param name
|
* @param name
|
||||||
* @return {@link Supplier}
|
* @return {@link Supplier}
|
||||||
*/
|
*/
|
||||||
public Supplier<T> getSupplier(String name);
|
public Supplier<T> getSupplier(String name);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param name
|
* @param name
|
||||||
* @return new instance of T (if there are register supplier for name)
|
* @return new instance of T (if there are register supplier for name)
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -26,10 +26,11 @@ package org.adempiere.base;
|
||||||
|
|
||||||
import java.util.function.Supplier;
|
import java.util.function.Supplier;
|
||||||
|
|
||||||
|
import org.adempiere.base.annotation.Callout;
|
||||||
import org.osgi.framework.BundleContext;
|
import org.osgi.framework.BundleContext;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for mapping of tableName+columnName to {@link IColumnCallout} implementation.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -52,7 +53,7 @@ public interface IMappedColumnCalloutFactory {
|
||||||
public void removeMapping(String tableName, String columnName, Supplier<IColumnCallout> supplier);
|
public void removeMapping(String tableName, String columnName, Supplier<IColumnCallout> supplier);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* scan, discover and register classes with Callout annotation
|
* scan, discover and register classes with {@link Callout} annotation
|
||||||
* @param context
|
* @param context
|
||||||
* @param packages
|
* @param packages
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -31,7 +31,7 @@ import org.compiere.acct.Doc;
|
||||||
import org.compiere.model.MAcctSchema;
|
import org.compiere.model.MAcctSchema;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for mapping between tableName+gaap to {@link Doc} implementation.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -46,7 +46,7 @@ public interface IMappedDocumentFactory {
|
||||||
public void addMapping(String gaap, String tableName, Function<Parameter, ? extends Doc> supplier);
|
public void addMapping(String gaap, String tableName, Function<Parameter, ? extends Doc> supplier);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Remove mapping
|
||||||
* @param gaap
|
* @param gaap
|
||||||
* @param tableName
|
* @param tableName
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ package org.adempiere.base;
|
||||||
import org.compiere.model.ModelValidator;
|
import org.compiere.model.ModelValidator;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for {@link ModelValidator}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -24,7 +24,7 @@ public interface IModelValidatorFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param className
|
* @param className
|
||||||
* @return new modelvalidator intance
|
* @return new ModelValidator instance
|
||||||
*/
|
*/
|
||||||
public ModelValidator newModelValidatorInstance(String className);
|
public ModelValidator newModelValidatorInstance(String className);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,14 +16,14 @@ package org.adempiere.base;
|
||||||
import org.compiere.util.PaymentExport;
|
import org.compiere.util.PaymentExport;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* PaymentExporter factory interface.
|
* Factory interface for {@link PaymentExport}.
|
||||||
* @author mbozem
|
* @author mbozem
|
||||||
*/
|
*/
|
||||||
public interface IPaymentExporterFactory {
|
public interface IPaymentExporterFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param className
|
* @param className
|
||||||
* @return payment exporter instance
|
* @return new PaymentExport instance
|
||||||
*/
|
*/
|
||||||
public PaymentExport newPaymentExporterInstance(String className);
|
public PaymentExport newPaymentExporterInstance(String className);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,15 +16,14 @@ package org.adempiere.base;
|
||||||
import org.compiere.model.PaymentProcessor;
|
import org.compiere.model.PaymentProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for {@link PaymentProcessor}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IPaymentProcessorFactory {
|
public interface IPaymentProcessorFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param className
|
* @param className
|
||||||
* @return payment processor instance
|
* @return new PaymentProcessor instance
|
||||||
*/
|
*/
|
||||||
public PaymentProcessor newPaymentProcessorInstance(String className);
|
public PaymentProcessor newPaymentProcessorInstance(String className);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,15 @@ package org.adempiere.base;
|
||||||
import org.compiere.process.ProcessCall;
|
import org.compiere.process.ProcessCall;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for {@link ProcessCall}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IProcessFactory {
|
public interface IProcessFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new process instance
|
* Create new process instance
|
||||||
* @param className
|
* @param className
|
||||||
* @return new process instance
|
* @return new ProcessCall instance
|
||||||
*/
|
*/
|
||||||
public ProcessCall newProcessInstance(String className);
|
public ProcessCall newProcessInstance(String className);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -23,7 +23,7 @@ import org.compiere.model.I_M_RMALine;
|
||||||
import org.compiere.model.I_M_RequisitionLine;
|
import org.compiere.model.I_M_RequisitionLine;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Product Price Calculations
|
* Interface for Product Price Calculations
|
||||||
*/
|
*/
|
||||||
public interface IProductPricing {
|
public interface IProductPricing {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -13,8 +13,14 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.base;
|
package org.adempiere.base;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory interface for {@link AbstractProductPricing}.
|
||||||
|
*/
|
||||||
public interface IProductPricingFactory {
|
public interface IProductPricingFactory {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return new AbstractProductPricing instance
|
||||||
|
*/
|
||||||
public AbstractProductPricing newProductPricingInstance();
|
public AbstractProductPricing newProductPricingInstance();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,9 +11,8 @@ import org.compiere.util.ReplenishInterface;
|
||||||
public interface IReplenishFactory {
|
public interface IReplenishFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param className
|
* @param className
|
||||||
* @return Replenish instance
|
* @return new ReplenishInterface instance
|
||||||
*/
|
*/
|
||||||
public ReplenishInterface newReplenishInstance(String className);
|
public ReplenishInterface newReplenishInstance(String className);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -18,8 +18,15 @@ package org.adempiere.base;
|
||||||
|
|
||||||
import java.net.URL;
|
import java.net.URL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Service interface to find resource by name
|
||||||
|
*/
|
||||||
public interface IResourceFinder {
|
public interface IResourceFinder {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param name
|
||||||
|
* @return URL for resource found or null
|
||||||
|
*/
|
||||||
URL getResource(String name);
|
URL getResource(String name);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@
|
||||||
package org.adempiere.base;
|
package org.adempiere.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Holder interface for dynamic service
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
|
|
|
||||||
|
|
@ -17,33 +17,30 @@
|
||||||
package org.adempiere.base;
|
package org.adempiere.base;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A service locator looks up services.
|
* Interface for dynamic discovery of services.<br/>
|
||||||
* This is the central authority for adempiere service definition,
|
* This is the primary entry point for iDempiere service discovery.
|
||||||
* because each service defined has to be looked up via this interface.
|
|
||||||
*
|
|
||||||
* A service in adempiere is an implementation for the registered interface, expose through osgi service registry
|
|
||||||
*
|
*
|
||||||
* @author viola
|
* @author viola
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public interface IServiceLocator {
|
public interface IServiceLocator {
|
||||||
/**
|
/**
|
||||||
*
|
* Locate matching service by type (order by service.ranking priority)
|
||||||
* @param type service interface
|
* @param type service interface
|
||||||
* @return holder for dynamic service
|
* @return holder for dynamic service
|
||||||
*/
|
*/
|
||||||
<T> IServiceHolder<T> locate(Class<T> type);
|
<T> IServiceHolder<T> locate(Class<T> type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Locate matching service by type and query expression
|
||||||
* @param type
|
* @param type
|
||||||
* @param query
|
* @param query
|
||||||
* @return
|
* @return holder for service
|
||||||
*/
|
*/
|
||||||
<T> IServiceHolder<T> locate(Class<T> type, ServiceQuery query);
|
<T> IServiceHolder<T> locate(Class<T> type, ServiceQuery query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Locate matching service by component name and query expression
|
||||||
* @param type
|
* @param type
|
||||||
* @param componentName service component name
|
* @param componentName service component name
|
||||||
* @param query
|
* @param query
|
||||||
|
|
@ -52,14 +49,14 @@ public interface IServiceLocator {
|
||||||
<T> IServiceHolder<T> locate(Class<T> type, String componentName, ServiceQuery query);
|
<T> IServiceHolder<T> locate(Class<T> type, String componentName, ServiceQuery query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Find all matching services by type
|
||||||
* @param type
|
* @param type
|
||||||
* @return holder for list of dynamic service
|
* @return holder for list of dynamic service
|
||||||
*/
|
*/
|
||||||
<T> IServicesHolder<T> list(Class<T> type);
|
<T> IServicesHolder<T> list(Class<T> type);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Find all matching services by type and query expression
|
||||||
* @param type
|
* @param type
|
||||||
* @param query
|
* @param query
|
||||||
* @return holder for list of dynamic service
|
* @return holder for list of dynamic service
|
||||||
|
|
@ -67,7 +64,7 @@ public interface IServiceLocator {
|
||||||
<T> IServicesHolder<T> list(Class<T> type, ServiceQuery query);
|
<T> IServicesHolder<T> list(Class<T> type, ServiceQuery query);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Find all matching services by component name and query expression
|
||||||
* @param type
|
* @param type
|
||||||
* @param componentName osgi service component name
|
* @param componentName osgi service component name
|
||||||
* @param query
|
* @param query
|
||||||
|
|
|
||||||
|
|
@ -27,8 +27,8 @@ package org.adempiere.base;
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Dynamic service reference holder for a service object.
|
* Service reference holder for a service object. <br/>
|
||||||
* For cache usage, you should cache this instead of service object
|
* For caching of service, you should cache this instead of the service object.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ package org.adempiere.base;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Holder interface for list of service
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,15 @@ package org.adempiere.base;
|
||||||
import org.adempiere.model.IShipmentProcessor;
|
import org.adempiere.model.IShipmentProcessor;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Factory interface for {@link IShipmentProcessor}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IShipmentProcessorFactory {
|
public interface IShipmentProcessorFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new shipment processor instance
|
* Create new shipment processor instance
|
||||||
* @param className
|
* @param className
|
||||||
* @return shipment processor instance
|
* @return new IShipmentProcessor instance
|
||||||
*/
|
*/
|
||||||
public IShipmentProcessor newShipmentProcessorInstance(String className);
|
public IShipmentProcessor newShipmentProcessorInstance(String className);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -28,9 +28,8 @@ import java.sql.Timestamp;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Interface to lookup C_Tax record id
|
* Interface to lookup C_Tax record id (C_Tax_ID)
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface ITaxLookup {
|
public interface ITaxLookup {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -18,14 +18,13 @@ import org.adempiere.model.ITaxProvider;
|
||||||
/**
|
/**
|
||||||
* Tax provider factory interface
|
* Tax provider factory interface
|
||||||
* @author Elaine
|
* @author Elaine
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface ITaxProviderFactory {
|
public interface ITaxProviderFactory {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create new tax provider instance
|
* Create new tax provider instance
|
||||||
* @param className
|
* @param className
|
||||||
* @return tax provider instance
|
* @return new ITaxProvider instance
|
||||||
*/
|
*/
|
||||||
public ITaxProvider newTaxProviderInstance(String className);
|
public ITaxProvider newTaxProviderInstance(String className);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -45,9 +45,8 @@ import io.github.classgraph.ClassInfo;
|
||||||
import io.github.classgraph.ScanResult;
|
import io.github.classgraph.ScanResult;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Default implementation of {@link IMappedColumnCalloutFactory} for core.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Component(name = "org.adempiere.base.MappedColumnCalloutFactory",
|
@Component(name = "org.adempiere.base.MappedColumnCalloutFactory",
|
||||||
immediate = true,
|
immediate = true,
|
||||||
|
|
@ -117,6 +116,9 @@ public class MappedColumnCalloutFactory implements IColumnCalloutFactory, IMappe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* For plugin to lookup this service by component name and call this method to register annotated callout classes.
|
||||||
|
*/
|
||||||
@Override
|
@Override
|
||||||
public void scan(BundleContext context, String... packages) {
|
public void scan(BundleContext context, String... packages) {
|
||||||
ClassLoader classLoader = context.getBundle().adapt(BundleWiring.class).getClassLoader();
|
ClassLoader classLoader = context.getBundle().adapt(BundleWiring.class).getClassLoader();
|
||||||
|
|
|
||||||
|
|
@ -35,17 +35,16 @@ import org.compiere.util.Env;
|
||||||
import org.compiere.util.Util;
|
import org.compiere.util.Util;
|
||||||
import org.osgi.service.component.annotations.Component;
|
import org.osgi.service.component.annotations.Component;
|
||||||
|
|
||||||
@Component(name = "org.adempiere.base.MappedDocumentFactory",
|
|
||||||
service = {IDocFactory.class, IMappedDocumentFactory.class},
|
|
||||||
immediate = true,
|
|
||||||
property = {"service.ranking:Integer=1", "gaap=*"})
|
|
||||||
/**
|
/**
|
||||||
*
|
* Document factory backed by map between tablename + gaap and lambda function object.<br/>
|
||||||
* Document factory backed by map between tablename + gaap and lambda function object.
|
|
||||||
* If you create a subclass of this and register it as osgi service, don't register for the IMappedDocumentFactory interface.
|
* If you create a subclass of this and register it as osgi service, don't register for the IMappedDocumentFactory interface.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@Component(name = "org.adempiere.base.MappedDocumentFactory",
|
||||||
|
service = {IDocFactory.class, IMappedDocumentFactory.class},
|
||||||
|
immediate = true,
|
||||||
|
property = {"service.ranking:Integer=1", "gaap=*"})
|
||||||
public class MappedDocumentFactory implements IDocFactory, IMappedDocumentFactory {
|
public class MappedDocumentFactory implements IDocFactory, IMappedDocumentFactory {
|
||||||
|
|
||||||
private final ConcurrentHashMap<String, Function<Parameter, ? extends Doc>> documentMap = new ConcurrentHashMap<>();
|
private final ConcurrentHashMap<String, Function<Parameter, ? extends Doc>> documentMap = new ConcurrentHashMap<>();
|
||||||
|
|
|
||||||
|
|
@ -28,7 +28,7 @@ public @interface Model {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Table name
|
* Table name
|
||||||
* @return
|
* @return table name
|
||||||
*/
|
*/
|
||||||
String table();
|
String table();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ public class Service {
|
||||||
private static IServiceLocator theLocator = new DynamicServiceLocator();
|
private static IServiceLocator theLocator = new DynamicServiceLocator();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return IServiceLocator instance
|
||||||
* @return service locator instance
|
|
||||||
*/
|
*/
|
||||||
public static IServiceLocator locator() {
|
public static IServiceLocator locator() {
|
||||||
return theLocator;
|
return theLocator;
|
||||||
|
|
|
||||||
|
|
@ -32,8 +32,9 @@ import java.lang.annotation.Retention;
|
||||||
import java.lang.annotation.Target;
|
import java.lang.annotation.Target;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Annotation for Column Callout. This should only be used with class that implements the IColumnCallout interface.
|
* Annotation for Column Callout. <br/>
|
||||||
* You can repeat the annotation multiple time for different table and column name combination
|
* This should only be used for class that implements the IColumnCallout interface.
|
||||||
|
* You can repeat the annotation multiple time for different table and column name combination.<br/>
|
||||||
* Note that you can't use * for both tableName and columnName attribute.
|
* Note that you can't use * for both tableName and columnName attribute.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -33,11 +33,9 @@ import java.lang.annotation.Target;
|
||||||
import org.adempiere.base.event.annotations.EventDelegate;
|
import org.adempiere.base.event.annotations.EventDelegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Annotation for OSGi Event Topic Delegate.<br/>
|
||||||
* Annotation for OSGi Event Topic Delegate.
|
|
||||||
* Works with {@link EventDelegate} and its sub classes
|
* Works with {@link EventDelegate} and its sub classes
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
@Retention(RUNTIME)
|
@Retention(RUNTIME)
|
||||||
@Target(ElementType.TYPE)
|
@Target(ElementType.TYPE)
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ import java.lang.annotation.Target;
|
||||||
import org.adempiere.base.event.annotations.imp.ImportEventDelegate;
|
import org.adempiere.base.event.annotations.imp.ImportEventDelegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define parameter for {@link ImportEventDelegate}
|
* Specify parameter for {@link ImportEventDelegate}.<br/>
|
||||||
* Works with classes with {@link EventTopicDelegate} annotation
|
* Works with classes with {@link EventTopicDelegate} annotation.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -34,8 +34,8 @@ import org.adempiere.base.event.annotations.ModelEventDelegate;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Specify parameter for {@link ModelEventDelegate}
|
* Specify parameter for {@link ModelEventDelegate}.<br/>
|
||||||
* Works with classes with {@link EventTopicDelegate} annotation
|
* Works with classes with {@link EventTopicDelegate} annotation.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -22,16 +22,16 @@ import org.compiere.model.X_AD_Process_Para;
|
||||||
import org.compiere.process.SvrProcess;
|
import org.compiere.process.SvrProcess;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Tags a process class field as a process parameter in order to have its value set automatically.
|
* Tags a process class field as a process parameter in order to have its value set automatically.<br/>
|
||||||
* Class fields are matched against process parameters using the following heuristics: <br>
|
* Class fields are matched against process parameters using the following heuristics: <br>
|
||||||
* [1] If the parameter annotation has a name, then it must match exactly the process parameter
|
* [1] If the parameter annotation has a name, then it must match exactly the process parameter
|
||||||
* metadata definition. For example: <br>
|
* metadata definition. For example: <br>
|
||||||
* <code>@Parameter(name="C_BPartner_ID") int foo</code> will fill <code>foo</code> with
|
* <code>@Parameter(name="C_BPartner_ID") int foo</code> will fill <code>foo</code> with
|
||||||
* the value of the parameter named <code>C_BPartner_ID</code>. <br>
|
* the value of the parameter named <code>C_BPartner_ID</code>. <br>
|
||||||
* [2] Class fields with the <code>p_</code> prefix will be matched automatically. Example: <br>
|
* [2] Class fields with the <code>p_</code> prefix will be matched automatically. Example: <br>
|
||||||
* <code>@Parameter Integer p_C_BPartner_ID</code> will match a parameter named <code>C_BPartner_ID</code>.
|
* <code>@Parameter Integer p_C_BPartner_ID</code> will match a parameter named <code>C_BPartner_ID</code>.<br/>
|
||||||
* [3] Fields with their names matching metadata names after stripping the "_" character. Example:
|
* [3] Fields with their names matching metadata names after stripping the "_" character. Example:
|
||||||
* <code>@Parameter Integer cBPartnerId</code> will match a parameter named <code>C_BPartner_ID</code>.
|
* <code>@Parameter Integer cBPartnerId</code> will match a parameter named <code>C_BPartner_ID</code>.<br/>
|
||||||
* [4] Fields with their names matching exactly their metadata names. Example:
|
* [4] Fields with their names matching exactly their metadata names. Example:
|
||||||
* <code>@Parameter Integer C_BPartner_ID</code> will match a parameter named <code>C_BPartner_ID</code>.
|
* <code>@Parameter Integer C_BPartner_ID</code> will match a parameter named <code>C_BPartner_ID</code>.
|
||||||
* @see SvrProcess
|
* @see SvrProcess
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,15 @@
|
||||||
|
/******************************************************************************
|
||||||
|
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||||
|
* 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.adempiere.base.annotation;
|
package org.adempiere.base.annotation;
|
||||||
|
|
||||||
import static java.lang.annotation.ElementType.TYPE;
|
import static java.lang.annotation.ElementType.TYPE;
|
||||||
|
|
|
||||||
|
|
@ -33,8 +33,8 @@ import java.lang.annotation.Target;
|
||||||
import org.adempiere.base.event.annotations.process.ProcessEventDelegate;
|
import org.adempiere.base.event.annotations.process.ProcessEventDelegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Define parameter for {@link ProcessEventDelegate}
|
* Specify parameter for {@link ProcessEventDelegate}.<br/>
|
||||||
* Works with classes with {@link EventTopicDelegate} annotation
|
* Works with classes with {@link EventTopicDelegate} annotation.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -43,7 +43,7 @@ import org.adempiere.base.event.annotations.process.ProcessEventDelegate;
|
||||||
public @interface ProcessEventTopic {
|
public @interface ProcessEventTopic {
|
||||||
/**
|
/**
|
||||||
* AD_Process.AD_Process_UU (uuid) value for {@link ProcessEventDelegate}
|
* AD_Process.AD_Process_UU (uuid) value for {@link ProcessEventDelegate}
|
||||||
* @return process uuid
|
* @return AD_Process_UU
|
||||||
*/
|
*/
|
||||||
String processUUID();
|
String processUUID();
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -25,8 +25,8 @@ import org.osgi.framework.ServiceReference;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Holder for OSGI service. Implemented using {@link ServiceTracker}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DynamicServiceHolder<T> implements IServiceHolder<T>, IServicesHolder<T> {
|
public class DynamicServiceHolder<T> implements IServiceHolder<T>, IServicesHolder<T> {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -24,13 +24,13 @@ import org.osgi.service.component.ComponentConstants;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Service locator implementation for OSGi service.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class DynamicServiceLocator implements IServiceLocator {
|
public class DynamicServiceLocator implements IServiceLocator {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* default constructor
|
||||||
*/
|
*/
|
||||||
public DynamicServiceLocator() {
|
public DynamicServiceLocator() {
|
||||||
}
|
}
|
||||||
|
|
@ -109,6 +109,13 @@ public class DynamicServiceLocator implements IServiceLocator {
|
||||||
return new DynamicServiceHolder<T>(tracker);
|
return new DynamicServiceHolder<T>(tracker);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create service query filter
|
||||||
|
* @param type
|
||||||
|
* @param serviceId
|
||||||
|
* @param query
|
||||||
|
* @return Filter
|
||||||
|
*/
|
||||||
private Filter filter(Class<?> type, String serviceId, ServiceQuery query) {
|
private Filter filter(Class<?> type, String serviceId, ServiceQuery query) {
|
||||||
StringBuilder builder = new StringBuilder("(&(objectclass=");
|
StringBuilder builder = new StringBuilder("(&(objectclass=");
|
||||||
builder.append(type.getName()).append(")");
|
builder.append(type.getName()).append(")");
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,7 @@ import org.osgi.framework.ServiceReference;
|
||||||
import org.osgi.util.tracker.ServiceTracker;
|
import org.osgi.util.tracker.ServiceTracker;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IServiceReferenceHolder implementation using ServiceTracker
|
* IServiceReferenceHolder for OSGi service, implemented using {@link ServiceTracker}
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
|
|
|
||||||
|
|
@ -31,13 +31,13 @@ import org.osgi.framework.Constants;
|
||||||
import org.osgi.framework.ServiceReference;
|
import org.osgi.framework.ServiceReference;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Service Reference Comparator.
|
* Service Reference Comparator. <br/>
|
||||||
* This comparator follows OSGi Ranking policy.
|
* This comparator follows OSGi Ranking policy.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*/
|
*/
|
||||||
public final class ServiceRankingComparator implements Comparator<ServiceReference<?>>, Serializable {
|
public final class ServiceRankingComparator implements Comparator<ServiceReference<?>>, Serializable {
|
||||||
/**
|
/**
|
||||||
*
|
* generated serial id
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 3444598255961708618L;
|
private static final long serialVersionUID = 3444598255961708618L;
|
||||||
|
|
||||||
|
|
@ -57,6 +57,7 @@ public final class ServiceRankingComparator implements Comparator<ServiceReferen
|
||||||
* (i.e for sorting in descending order of service.ranking value)
|
* (i.e for sorting in descending order of service.ranking value)
|
||||||
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
||||||
*/
|
*/
|
||||||
|
@Override
|
||||||
public int compare(ServiceReference<?> serviceReference1, ServiceReference<?> serviceReference2) {
|
public int compare(ServiceReference<?> serviceReference1, ServiceReference<?> serviceReference2) {
|
||||||
if (serviceReference1.equals(serviceReference2)) { return 0; }
|
if (serviceReference1.equals(serviceReference2)) { return 0; }
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ package org.adempiere.base.equinox;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Holder for list of Equinox extension.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -20,8 +20,8 @@ import org.adempiere.base.ServiceQuery;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This is the Equinox implementation of extension Locator.
|
* This is the Equinox implementation of extension Locator. <br/>
|
||||||
* It delegates work to the ExtensionList that lookups up extensions.
|
* It delegates work to the ExtensionList that lookups up extensions. <br/>
|
||||||
* Usually, the ids of extension points correspond to the interface names of the services.
|
* Usually, the ids of extension points correspond to the interface names of the services.
|
||||||
*
|
*
|
||||||
* @author viola
|
* @author viola
|
||||||
|
|
@ -33,12 +33,14 @@ public class EquinoxExtensionLocator {
|
||||||
|
|
||||||
private EquinoxExtensionLocator() {}
|
private EquinoxExtensionLocator() {}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return EquinoxExtensionLocator singleton instance
|
||||||
|
*/
|
||||||
public static EquinoxExtensionLocator instance() {
|
public static EquinoxExtensionLocator instance() {
|
||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @return equinox extension holder
|
* @return equinox extension holder
|
||||||
*/
|
*/
|
||||||
|
|
@ -47,7 +49,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param extensionPointId
|
* @param extensionPointId
|
||||||
* @return equinox extension holder
|
* @return equinox extension holder
|
||||||
|
|
@ -58,7 +59,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param query
|
* @param query
|
||||||
* @return equinox extension holder
|
* @return equinox extension holder
|
||||||
|
|
@ -68,7 +68,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param extensionId
|
* @param extensionId
|
||||||
* @param query
|
* @param query
|
||||||
|
|
@ -80,7 +79,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param extensionPointId
|
* @param extensionPointId
|
||||||
* @param extensionId
|
* @param extensionId
|
||||||
|
|
@ -94,7 +92,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @return equinox extension holder
|
* @return equinox extension holder
|
||||||
*/
|
*/
|
||||||
|
|
@ -103,7 +100,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param extensionPointId
|
* @param extensionPointId
|
||||||
* @return equinox extension holder
|
* @return equinox extension holder
|
||||||
|
|
@ -114,7 +110,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param query
|
* @param query
|
||||||
* @return equinox extension holder
|
* @return equinox extension holder
|
||||||
|
|
@ -124,7 +119,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param extensionId
|
* @param extensionId
|
||||||
* @param query
|
* @param query
|
||||||
|
|
@ -136,7 +130,6 @@ public class EquinoxExtensionLocator {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param type
|
* @param type
|
||||||
* @param extensionPointId
|
* @param extensionPointId
|
||||||
* @param extensionId
|
* @param extensionId
|
||||||
|
|
|
||||||
|
|
@ -29,11 +29,11 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
||||||
import org.eclipse.core.runtime.Platform;
|
import org.eclipse.core.runtime.Platform;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This List looks up services as extensions in equinox.
|
* This List looks up services as extensions in equinox.<br/>
|
||||||
* The extension point must be the class name of the service interface.
|
* The extension point must be the class name of the service interface. <br/>
|
||||||
* The query attributes are checked against the attributes
|
* The query attributes are checked against the attributes
|
||||||
* of the extension configuration element.
|
* of the extension configuration element.
|
||||||
*
|
* <p>
|
||||||
* In order to minimize equinox lookups, a filtering iterator is used.
|
* In order to minimize equinox lookups, a filtering iterator is used.
|
||||||
* @author viola
|
* @author viola
|
||||||
*
|
*
|
||||||
|
|
@ -41,15 +41,23 @@ import org.eclipse.core.runtime.Platform;
|
||||||
*/
|
*/
|
||||||
public class ExtensionList<T> implements Iterable<T>{
|
public class ExtensionList<T> implements Iterable<T>{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Iterator implementation for Equinox extension
|
||||||
|
* @param <E>
|
||||||
|
*/
|
||||||
public class ExtensionIterator<E extends T> implements Iterator<T> {
|
public class ExtensionIterator<E extends T> implements Iterator<T> {
|
||||||
|
|
||||||
private int index = 0;
|
private int index = 0;
|
||||||
|
|
||||||
|
@Override
|
||||||
public boolean hasNext() {
|
public boolean hasNext() {
|
||||||
iterateUntilAccepted();
|
iterateUntilAccepted();
|
||||||
return index<elements.length;
|
return index<elements.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Increment {@link #index} until we found the next matching element
|
||||||
|
*/
|
||||||
private void iterateUntilAccepted() {
|
private void iterateUntilAccepted() {
|
||||||
while (index<elements.length) {
|
while (index<elements.length) {
|
||||||
if (accept(elements[index]))
|
if (accept(elements[index]))
|
||||||
|
|
@ -58,6 +66,10 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param element
|
||||||
|
* @return true if current element match extension id or filter parameter
|
||||||
|
*/
|
||||||
private boolean accept(IConfigurationElement element) {
|
private boolean accept(IConfigurationElement element) {
|
||||||
if (extensionId != null) {
|
if (extensionId != null) {
|
||||||
String id = element.getDeclaringExtension().getUniqueIdentifier();
|
String id = element.getDeclaringExtension().getUniqueIdentifier();
|
||||||
|
|
@ -74,6 +86,7 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("unchecked")
|
@SuppressWarnings("unchecked")
|
||||||
|
@Override
|
||||||
public E next() {
|
public E next() {
|
||||||
iterateUntilAccepted();
|
iterateUntilAccepted();
|
||||||
IConfigurationElement e = elements[index++];
|
IConfigurationElement e = elements[index++];
|
||||||
|
|
@ -95,6 +108,10 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Not supported, will throw exception.
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public void remove() {
|
public void remove() {
|
||||||
throw new UnsupportedOperationException();
|
throw new UnsupportedOperationException();
|
||||||
}
|
}
|
||||||
|
|
@ -123,6 +140,12 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param type
|
||||||
|
* @param extensionPointId
|
||||||
|
* @param extensionId
|
||||||
|
* @param query
|
||||||
|
*/
|
||||||
public ExtensionList(Class<T> type, String extensionPointId, String extensionId, ServiceQuery query) {
|
public ExtensionList(Class<T> type, String extensionPointId, String extensionId, ServiceQuery query) {
|
||||||
this(type, extensionPointId);
|
this(type, extensionPointId);
|
||||||
this.extensionId = extensionId;
|
this.extensionId = extensionId;
|
||||||
|
|
@ -133,6 +156,11 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sort by extension priority (if defined in extensions-priorty.properties).
|
||||||
|
* @param elementArray
|
||||||
|
* @return sorted elementArray
|
||||||
|
*/
|
||||||
private IConfigurationElement[] sort(IConfigurationElement[] elementArray) {
|
private IConfigurationElement[] sort(IConfigurationElement[] elementArray) {
|
||||||
IConfigurationElement[] result = elementArray;
|
IConfigurationElement[] result = elementArray;
|
||||||
TreeMap<Integer, List<IConfigurationElement>> elementMap = new TreeMap<Integer, List<IConfigurationElement>>();
|
TreeMap<Integer, List<IConfigurationElement>> elementMap = new TreeMap<Integer, List<IConfigurationElement>>();
|
||||||
|
|
@ -169,14 +197,25 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return Iterator
|
||||||
|
*/
|
||||||
public Iterator<T> iterator() {
|
public Iterator<T> iterator() {
|
||||||
return new ExtensionIterator<T>();
|
return new ExtensionIterator<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add filter for discovery of extensions
|
||||||
|
* @param attribute
|
||||||
|
* @param value
|
||||||
|
*/
|
||||||
public void addFilter(String attribute, String value) {
|
public void addFilter(String attribute, String value) {
|
||||||
filters.put(attribute, value);
|
filters.put(attribute, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return first matching extension
|
||||||
|
*/
|
||||||
public T first() {
|
public T first() {
|
||||||
Iterator<T> i = iterator();
|
Iterator<T> i = iterator();
|
||||||
if (!i.hasNext())
|
if (!i.hasNext())
|
||||||
|
|
@ -184,6 +223,9 @@ public class ExtensionList<T> implements Iterable<T>{
|
||||||
return i.next();
|
return i.next();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return list of matching extension
|
||||||
|
*/
|
||||||
public List<T> asList() {
|
public List<T> asList() {
|
||||||
List<T> result = new ArrayList<T>();
|
List<T> result = new ArrayList<T>();
|
||||||
for (T t : this) {
|
for (T t : this) {
|
||||||
|
|
|
||||||
|
|
@ -25,7 +25,7 @@ import org.eclipse.core.runtime.Platform;
|
||||||
import org.eclipse.osgi.service.datalocation.Location;
|
import org.eclipse.osgi.service.datalocation.Location;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Load extension priority from extensions-priorty.properties
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -19,16 +19,15 @@ import org.eclipse.osgi.framework.console.CommandProvider;
|
||||||
import org.eclipse.osgi.framework.console.CommandInterpreter;
|
import org.eclipse.osgi.framework.console.CommandInterpreter;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* OSGi console command for printing of stack trace.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class StackTraceCommand implements CommandProvider {
|
public class StackTraceCommand implements CommandProvider {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* default constructor
|
||||||
*/
|
*/
|
||||||
public StackTraceCommand() {
|
public StackTraceCommand() {
|
||||||
// TODO Auto-generated constructor stub
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* (non-Javadoc)
|
/* (non-Javadoc)
|
||||||
|
|
|
||||||
|
|
@ -23,6 +23,7 @@ import org.osgi.service.event.Event;
|
||||||
import org.osgi.service.event.EventHandler;
|
import org.osgi.service.event.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Base class to help simplify implementation of OSGi {@link EventHandler}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,13 +80,13 @@ public abstract class AbstractEventHandler implements EventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* override this method to handle event
|
* Sub class should override this method to handle event.
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
protected abstract void doHandleEvent(Event event);
|
protected abstract void doHandleEvent(Event event);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* override this method to register event that the class want to listen to
|
* Sub class should override this method to register event that the class want to listen to
|
||||||
*/
|
*/
|
||||||
protected abstract void initialize();
|
protected abstract void initialize();
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -32,7 +32,7 @@ import org.compiere.util.CLogger;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Helper methods for event handler
|
* Helper methods for {@link AbstractEventHandler}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*/
|
*/
|
||||||
public final class EventHelper {
|
public final class EventHelper {
|
||||||
|
|
@ -66,7 +66,6 @@ public final class EventHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
|
|
@ -75,7 +74,6 @@ public final class EventHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param <T>
|
* @param <T>
|
||||||
* @param event
|
* @param event
|
||||||
* @param property
|
* @param property
|
||||||
|
|
|
||||||
|
|
@ -43,7 +43,7 @@ import org.osgi.service.event.EventConstants;
|
||||||
import org.osgi.service.event.EventHandler;
|
import org.osgi.service.event.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Simple wrapper for the osgi event admin service.
|
* Simple wrapper for the osgi event admin service.<br/>
|
||||||
* Usage: EventManager.getInstance().sendEvent/postEvent
|
* Usage: EventManager.getInstance().sendEvent/postEvent
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -15,14 +15,14 @@ package org.adempiere.base.event;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.adempiere.base.event.annotations.doc.FactsValidateDelegate;
|
||||||
import org.compiere.acct.Fact;
|
import org.compiere.acct.Fact;
|
||||||
import org.compiere.model.MAcctSchema;
|
import org.compiere.model.MAcctSchema;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event data for {@link FactsValidateDelegate}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class FactsEventData implements POEventData {
|
public class FactsEventData implements POEventData {
|
||||||
private MAcctSchema acctSchema;
|
private MAcctSchema acctSchema;
|
||||||
|
|
|
||||||
|
|
@ -18,9 +18,8 @@ import org.osgi.service.event.Event;
|
||||||
import org.osgi.service.event.EventHandler;
|
import org.osgi.service.event.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Interface for global event manager
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IEventManager {
|
public interface IEventManager {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -14,9 +14,8 @@
|
||||||
package org.adempiere.base.event;
|
package org.adempiere.base.event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event topic constants
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public interface IEventTopics {
|
public interface IEventTopics {
|
||||||
|
|
||||||
|
|
@ -91,7 +90,7 @@ public interface IEventTopics {
|
||||||
|
|
||||||
public static final String PREF_AFTER_LOAD = "adempiere/pref/afterLoad";
|
public static final String PREF_AFTER_LOAD = "adempiere/pref/afterLoad";
|
||||||
|
|
||||||
/** Called after next document actions are set */
|
/** Called during discovery of available and valid document actions */
|
||||||
public static final String DOCACTION = "adempiere/docAction";
|
public static final String DOCACTION = "adempiere/docAction";
|
||||||
|
|
||||||
public static final String BROADCAST_MESSAGE = "idempiere/broadcastMsg";
|
public static final String BROADCAST_MESSAGE = "idempiere/broadcastMsg";
|
||||||
|
|
|
||||||
|
|
@ -13,13 +13,13 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.base.event;
|
package org.adempiere.base.event;
|
||||||
|
|
||||||
|
import org.adempiere.base.event.annotations.imp.ImportEventDelegate;
|
||||||
import org.adempiere.process.ImportProcess;
|
import org.adempiere.process.ImportProcess;
|
||||||
import org.compiere.model.PO;
|
import org.compiere.model.PO;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event data for {@link ImportEventDelegate}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class ImportEventData {
|
public class ImportEventData {
|
||||||
private ImportProcess importProcess;
|
private ImportProcess importProcess;
|
||||||
|
|
@ -46,14 +46,14 @@ public class ImportEventData {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the source
|
* @return the source PO
|
||||||
*/
|
*/
|
||||||
public PO getSource() {
|
public PO getSource() {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the target
|
* @return the target PO
|
||||||
*/
|
*/
|
||||||
public PO getTarget() {
|
public PO getTarget() {
|
||||||
return target;
|
return target;
|
||||||
|
|
|
||||||
|
|
@ -13,10 +13,11 @@
|
||||||
*****************************************************************************/
|
*****************************************************************************/
|
||||||
package org.adempiere.base.event;
|
package org.adempiere.base.event;
|
||||||
|
|
||||||
|
import org.adempiere.base.event.annotations.AfterLoginEventDelegate;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event data for {@link AfterLoginEventDelegate}.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class LoginEventData {
|
public class LoginEventData {
|
||||||
private int AD_Client_ID;
|
private int AD_Client_ID;
|
||||||
|
|
|
||||||
|
|
@ -33,6 +33,9 @@ package org.adempiere.base.event;
|
||||||
|
|
||||||
import org.compiere.model.PrintInfo;
|
import org.compiere.model.PrintInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Event data for {@link IEventTopics#REPORT_SEND_EMAIL} event topic.
|
||||||
|
*/
|
||||||
public class ReportSendEMailEventData {
|
public class ReportSendEMailEventData {
|
||||||
|
|
||||||
public static final String CONTEXT_EMAIL_TO = "_EMAIL_TO_";
|
public static final String CONTEXT_EMAIL_TO = "_EMAIL_TO_";
|
||||||
|
|
@ -49,10 +52,25 @@ public class ReportSendEMailEventData {
|
||||||
private int m_recordId;
|
private int m_recordId;
|
||||||
private String m_recordUU;
|
private String m_recordUU;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param windowNo
|
||||||
|
* @param tableId
|
||||||
|
* @param recordId
|
||||||
|
* @param printInfo
|
||||||
|
* @param subject
|
||||||
|
*/
|
||||||
public ReportSendEMailEventData(int windowNo, int tableId, int recordId, PrintInfo printInfo, String subject) {
|
public ReportSendEMailEventData(int windowNo, int tableId, int recordId, PrintInfo printInfo, String subject) {
|
||||||
this(windowNo, tableId, recordId, null, printInfo, subject);
|
this(windowNo, tableId, recordId, null, printInfo, subject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param windowNo
|
||||||
|
* @param tableId
|
||||||
|
* @param recordId
|
||||||
|
* @param recordUU
|
||||||
|
* @param printInfo
|
||||||
|
* @param subject
|
||||||
|
*/
|
||||||
public ReportSendEMailEventData(int windowNo, int tableId, int recordId, String recordUU, PrintInfo printInfo, String subject) {
|
public ReportSendEMailEventData(int windowNo, int tableId, int recordId, String recordUU, PrintInfo printInfo, String subject) {
|
||||||
m_windowNo = windowNo;
|
m_windowNo = windowNo;
|
||||||
m_tableId = tableId;
|
m_tableId = tableId;
|
||||||
|
|
@ -62,50 +80,86 @@ public class ReportSendEMailEventData {
|
||||||
m_subject = subject;
|
m_subject = subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return window number
|
||||||
|
*/
|
||||||
public int getWindowNo() {
|
public int getWindowNo() {
|
||||||
return m_windowNo;
|
return m_windowNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param windowNo
|
||||||
|
*/
|
||||||
public void setWindowNo(int windowNo) {
|
public void setWindowNo(int windowNo) {
|
||||||
m_windowNo = windowNo;
|
m_windowNo = windowNo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return AD_Table_ID
|
||||||
|
*/
|
||||||
public int getTableId() {
|
public int getTableId() {
|
||||||
return m_tableId;
|
return m_tableId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param tableId AD_Table_ID
|
||||||
|
*/
|
||||||
public void setTableId(int tableId) {
|
public void setTableId(int tableId) {
|
||||||
m_tableId = tableId;
|
m_tableId = tableId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return record id
|
||||||
|
*/
|
||||||
public int getRecordId() {
|
public int getRecordId() {
|
||||||
return m_recordId;
|
return m_recordId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordId
|
||||||
|
*/
|
||||||
public void setRecordId(int recordId) {
|
public void setRecordId(int recordId) {
|
||||||
m_recordId = recordId;
|
m_recordId = recordId;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return record uuid
|
||||||
|
*/
|
||||||
public String getRecordUU() {
|
public String getRecordUU() {
|
||||||
return m_recordUU;
|
return m_recordUU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param recordUU record uuid
|
||||||
|
*/
|
||||||
public void setRecordUU(String recordUU) {
|
public void setRecordUU(String recordUU) {
|
||||||
m_recordUU = recordUU;
|
m_recordUU = recordUU;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return PrintInfo
|
||||||
|
*/
|
||||||
public PrintInfo getFrom() {
|
public PrintInfo getFrom() {
|
||||||
return m_printInfo;
|
return m_printInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param printInfo
|
||||||
|
*/
|
||||||
public void setFrom(PrintInfo printInfo) {
|
public void setFrom(PrintInfo printInfo) {
|
||||||
m_printInfo = printInfo;
|
m_printInfo = printInfo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return subject
|
||||||
|
*/
|
||||||
public String getSubject() {
|
public String getSubject() {
|
||||||
return m_subject;
|
return m_subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param subject
|
||||||
|
*/
|
||||||
public void setSubject(String subject) {
|
public void setSubject(String subject) {
|
||||||
m_subject = subject;
|
m_subject = subject;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -46,7 +46,7 @@ import org.osgi.service.cm.ManagedService;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request event handler
|
* Event handler for R_Request table and REQUEST_SEND_EMAIL event topic.
|
||||||
* @author Nur Yasmin
|
* @author Nur Yasmin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -100,6 +100,12 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
||||||
registerTableEvent(IEventTopics.PO_AFTER_CHANGE, I_R_Request.Table_Name);
|
registerTableEvent(IEventTopics.PO_AFTER_CHANGE, I_R_Request.Table_Name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle before update of R_Request record
|
||||||
|
* @param r
|
||||||
|
* @param newRecord
|
||||||
|
* @return error message or null
|
||||||
|
*/
|
||||||
private String beforeSaveRequest(MRequest r, boolean newRecord)
|
private String beforeSaveRequest(MRequest r, boolean newRecord)
|
||||||
{
|
{
|
||||||
// New
|
// New
|
||||||
|
|
@ -212,6 +218,12 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Handle after save of R_Request record
|
||||||
|
* @param r
|
||||||
|
* @param newRecord
|
||||||
|
* @return error message or null
|
||||||
|
*/
|
||||||
private String afterSaveRequest(MRequest r, boolean newRecord)
|
private String afterSaveRequest(MRequest r, boolean newRecord)
|
||||||
{
|
{
|
||||||
// Initial Mail
|
// Initial Mail
|
||||||
|
|
@ -222,10 +234,10 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Check for changes
|
* Process changes
|
||||||
* @param ra request action
|
* @param ra request action
|
||||||
* @param columnName column
|
* @param columnName column
|
||||||
* @return true if changes
|
* @return true if columnName has changes
|
||||||
*/
|
*/
|
||||||
public boolean checkChange (MRequest r, MRequestAction ra, String columnName)
|
public boolean checkChange (MRequest r, MRequestAction ra, String columnName)
|
||||||
{
|
{
|
||||||
|
|
@ -395,10 +407,10 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
||||||
}
|
}
|
||||||
} // sendNotice
|
} // sendNotice
|
||||||
|
|
||||||
/**************************************************************************
|
/**
|
||||||
* Get MailID
|
* Get mail trailer text
|
||||||
* @param serverAddress server address
|
* @param serverAddress server address
|
||||||
* @return Mail Trailer
|
* @return Mail trailer text
|
||||||
*/
|
*/
|
||||||
private String getMailTrailer(MRequest r, String serverAddress)
|
private String getMailTrailer(MRequest r, String serverAddress)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -32,9 +32,9 @@ import org.osgi.service.cm.Configuration;
|
||||||
import org.osgi.service.cm.ConfigurationAdmin;
|
import org.osgi.service.cm.ConfigurationAdmin;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Request property service
|
* Load request property from requesteventhandler.properties and update {@link Configuration}
|
||||||
|
* through {@link ConfigurationAdmin} service.
|
||||||
* @author Elaine
|
* @author Elaine
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class RequestPropertyService {
|
public class RequestPropertyService {
|
||||||
|
|
||||||
|
|
@ -42,17 +42,30 @@ public class RequestPropertyService {
|
||||||
|
|
||||||
private static final CLogger logger = CLogger.getCLogger(RequestPropertyService.class);
|
private static final CLogger logger = CLogger.getCLogger(RequestPropertyService.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Default constructor
|
||||||
|
*/
|
||||||
public RequestPropertyService() {
|
public RequestPropertyService() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param configurationAdmin
|
||||||
|
*/
|
||||||
public void bindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
|
public void bindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
|
||||||
readProperties(configurationAdmin);
|
readProperties(configurationAdmin);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param configurationAdmin
|
||||||
|
*/
|
||||||
public void unbindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
|
public void unbindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load request property from requesteventhandler.properties
|
||||||
|
* @param service
|
||||||
|
*/
|
||||||
private void readProperties(ConfigurationAdmin service) {
|
private void readProperties(ConfigurationAdmin service) {
|
||||||
File file = new File(Ini.getAdempiereHome(), REQUESTEVENTHANDLER_PROPERTIES);
|
File file = new File(Ini.getAdempiereHome(), REQUESTEVENTHANDLER_PROPERTIES);
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
|
|
|
||||||
|
|
@ -20,9 +20,8 @@ import org.compiere.model.MClient;
|
||||||
import org.compiere.model.MUser;
|
import org.compiere.model.MUser;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event data for {@link IEventTopics#REQUEST_SEND_EMAIL} event topic.
|
||||||
* @author Elaine
|
* @author Elaine
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public class RequestSendEMailEventData
|
public class RequestSendEMailEventData
|
||||||
{
|
{
|
||||||
|
|
@ -35,10 +34,29 @@ public class RequestSendEMailEventData
|
||||||
private int requestID;
|
private int requestID;
|
||||||
private boolean isHtml;
|
private boolean isHtml;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param client
|
||||||
|
* @param from
|
||||||
|
* @param to
|
||||||
|
* @param subject
|
||||||
|
* @param message
|
||||||
|
* @param attachment
|
||||||
|
* @param requestID
|
||||||
|
*/
|
||||||
public RequestSendEMailEventData(MClient client, MUser from, MUser to, String subject, String message, File attachment, int requestID) {
|
public RequestSendEMailEventData(MClient client, MUser from, MUser to, String subject, String message, File attachment, int requestID) {
|
||||||
this(client, from, to, subject, message, attachment, requestID, false);
|
this(client, from, to, subject, message, attachment, requestID, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param client
|
||||||
|
* @param from
|
||||||
|
* @param to
|
||||||
|
* @param subject
|
||||||
|
* @param message
|
||||||
|
* @param attachment
|
||||||
|
* @param requestID
|
||||||
|
* @param isHtml
|
||||||
|
*/
|
||||||
public RequestSendEMailEventData(MClient client, MUser from, MUser to, String subject, String message, File attachment, int requestID, boolean isHtml) {
|
public RequestSendEMailEventData(MClient client, MUser from, MUser to, String subject, String message, File attachment, int requestID, boolean isHtml) {
|
||||||
setClient(client);
|
setClient(client);
|
||||||
setFrom(from);
|
setFrom(from);
|
||||||
|
|
@ -50,66 +68,114 @@ public class RequestSendEMailEventData
|
||||||
setHtml(isHtml);
|
setHtml(isHtml);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return MClient
|
||||||
|
*/
|
||||||
public MClient getClient() {
|
public MClient getClient() {
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param client
|
||||||
|
*/
|
||||||
public void setClient(MClient client) {
|
public void setClient(MClient client) {
|
||||||
this.client = client;
|
this.client = client;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return from user
|
||||||
|
*/
|
||||||
public MUser getFrom() {
|
public MUser getFrom() {
|
||||||
return from;
|
return from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param from from user
|
||||||
|
*/
|
||||||
public void setFrom(MUser from) {
|
public void setFrom(MUser from) {
|
||||||
this.from = from;
|
this.from = from;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return to user
|
||||||
|
*/
|
||||||
public MUser getTo() {
|
public MUser getTo() {
|
||||||
return to;
|
return to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param to to user
|
||||||
|
*/
|
||||||
public void setTo(MUser to) {
|
public void setTo(MUser to) {
|
||||||
this.to = to;
|
this.to = to;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return subject
|
||||||
|
*/
|
||||||
public String getSubject() {
|
public String getSubject() {
|
||||||
return subject;
|
return subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param subject
|
||||||
|
*/
|
||||||
public void setSubject(String subject) {
|
public void setSubject(String subject) {
|
||||||
this.subject = subject;
|
this.subject = subject;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return message
|
||||||
|
*/
|
||||||
public String getMessage() {
|
public String getMessage() {
|
||||||
return message;
|
return message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param message
|
||||||
|
*/
|
||||||
public void setMessage(String message) {
|
public void setMessage(String message) {
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return attachment file
|
||||||
|
*/
|
||||||
public File getAttachment() {
|
public File getAttachment() {
|
||||||
return attachment;
|
return attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param attachment
|
||||||
|
*/
|
||||||
public void setAttachment(File attachment) {
|
public void setAttachment(File attachment) {
|
||||||
this.attachment = attachment;
|
this.attachment = attachment;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return R_Request_ID
|
||||||
|
*/
|
||||||
public int getRequestID() {
|
public int getRequestID() {
|
||||||
return requestID;
|
return requestID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param requestID R_Request_ID
|
||||||
|
*/
|
||||||
public void setRequestID(int requestID) {
|
public void setRequestID(int requestID) {
|
||||||
this.requestID = requestID;
|
this.requestID = requestID;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return true if message is html text
|
||||||
|
*/
|
||||||
public boolean isHtml() {
|
public boolean isHtml() {
|
||||||
return isHtml;
|
return isHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param isHtml
|
||||||
|
*/
|
||||||
public void setHtml(boolean isHtml) {
|
public void setHtml(boolean isHtml) {
|
||||||
this.isHtml = isHtml;
|
this.isHtml = isHtml;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -29,9 +29,10 @@ import org.adempiere.base.event.LoginEventData;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event delegate for login event.<br/>
|
||||||
|
* To handle login event, create a subclass of this and uses the {@link AfterLogin} annotation to
|
||||||
|
* annotate the method for the login event topic.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class AfterLoginEventDelegate extends EventDelegate {
|
public abstract class AfterLoginEventDelegate extends EventDelegate {
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -29,26 +29,26 @@ import java.lang.reflect.Method;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.adempiere.base.annotation.EventTopicDelegate;
|
||||||
import org.adempiere.base.event.EventHelper;
|
import org.adempiere.base.event.EventHelper;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
import org.osgi.service.event.EventHandler;
|
import org.osgi.service.event.EventHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Base class for event handler that works with annotation driven event delegate.
|
* Base class for event handler that works with annotation driven event delegate ({@link EventTopicDelegate}).
|
||||||
* The implementation of event delegate doesn't have to be thread safe as a new instance of delegate is created for each event call.
|
* The implementation of event delegate doesn't have to be thread safe as a new instance of delegate is created for each event call.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
public abstract class BaseEventHandler implements EventHandler {
|
public abstract class BaseEventHandler implements EventHandler {
|
||||||
|
|
||||||
//event topic to method mapping
|
/** event topic:method */
|
||||||
protected final Map<String, Method> eventTopicMap = new HashMap<String, Method>();
|
protected final Map<String, Method> eventTopicMap = new HashMap<String, Method>();
|
||||||
private String filter;
|
private String filter;
|
||||||
private Class<? extends EventDelegate> delegateClass;
|
private Class<? extends EventDelegate> delegateClass;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param delegateClass
|
* @param delegateClass
|
||||||
*/
|
*/
|
||||||
public BaseEventHandler(Class<? extends EventDelegate> delegateClass) {
|
public BaseEventHandler(Class<? extends EventDelegate> delegateClass) {
|
||||||
|
|
@ -58,7 +58,7 @@ public abstract class BaseEventHandler implements EventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* create event to topic to method mapping from annotations
|
* create event topic to method mapping from annotations
|
||||||
* @param delegateClass
|
* @param delegateClass
|
||||||
*/
|
*/
|
||||||
protected void createTopicMap(Class<?> delegateClass) {
|
protected void createTopicMap(Class<?> delegateClass) {
|
||||||
|
|
@ -80,7 +80,6 @@ public abstract class BaseEventHandler implements EventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return arrays of event topic
|
* @return arrays of event topic
|
||||||
*/
|
*/
|
||||||
public String[] getTopics() {
|
public String[] getTopics() {
|
||||||
|
|
@ -91,7 +90,6 @@ public abstract class BaseEventHandler implements EventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return event filter
|
* @return event filter
|
||||||
*/
|
*/
|
||||||
public String getFilter() {
|
public String getFilter() {
|
||||||
|
|
@ -107,7 +105,6 @@ public abstract class BaseEventHandler implements EventHandler {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param propertyName
|
* @param propertyName
|
||||||
* @param value
|
* @param value
|
||||||
*/
|
*/
|
||||||
|
|
@ -153,7 +150,7 @@ public abstract class BaseEventHandler implements EventHandler {
|
||||||
/**
|
/**
|
||||||
* create new instance of event delegate
|
* create new instance of event delegate
|
||||||
* @param event
|
* @param event
|
||||||
* @return {@link EventDelegate}
|
* @return new {@link EventDelegate} instance
|
||||||
*/
|
*/
|
||||||
protected abstract EventDelegate newEventDelegate(Event event);
|
protected abstract EventDelegate newEventDelegate(Event event);
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,8 @@ import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Annotation driven event delegate base class that works together with {@link BaseEventHandler}.
|
* Annotation driven event delegate base class that works together with {@link BaseEventHandler}.<br/>
|
||||||
* Subclass implementation doesn't have to be thread safe as event delegate is create and throw away for each event call.
|
* Subclass implementation doesn't have to be thread safe as event delegate is create and throw away for each event call.<br/>
|
||||||
* Subclass should use {@link EventTopic} or one of its derived annotation to define the event topic to handle
|
* Subclass should use {@link EventTopic} or one of its derived annotation to define the event topic to handle
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
|
|
@ -39,7 +39,6 @@ public class EventDelegate {
|
||||||
protected Event event;
|
protected Event event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
public EventDelegate(Event event) {
|
public EventDelegate(Event event) {
|
||||||
|
|
@ -47,7 +46,6 @@ public class EventDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return {@link Event}
|
* @return {@link Event}
|
||||||
*/
|
*/
|
||||||
protected Event getEvent() {
|
protected Event getEvent() {
|
||||||
|
|
|
||||||
|
|
@ -28,8 +28,9 @@ import org.compiere.model.PO;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event delegate for PO related event.<br/>
|
||||||
* event delegate for PO related event (po_before_change, doc_before_complete, etc)
|
* To handle a model event, create a subclass of this and uses the model event annotation (BeforeChange, BeforeComplete, etc)
|
||||||
|
* to annotate the method for a specific model event topic.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
* @param <T>
|
* @param <T>
|
||||||
|
|
@ -39,7 +40,6 @@ public class ModelEventDelegate<T extends PO> extends EventDelegate {
|
||||||
private T model;
|
private T model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param po
|
* @param po
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
|
|
@ -49,8 +49,7 @@ public class ModelEventDelegate<T extends PO> extends EventDelegate {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* @return PO model (MBPartner, MOrder, etc)
|
||||||
* @return po model (mbpartner, morder, etc)
|
|
||||||
*/
|
*/
|
||||||
protected T getModel() {
|
protected T getModel() {
|
||||||
return model;
|
return model;
|
||||||
|
|
|
||||||
|
|
@ -34,11 +34,10 @@ import org.compiere.model.PO;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event handler for PO related events. <br/>
|
||||||
* Event handler for PO related events (po_before_change, doc_before_complete, etc).
|
* Developers usually don't have to use this class directly; instead, the recommended approach is
|
||||||
* Delegate to {@link ModelEventDelegate} instance created for each event call
|
* to subclass {@link ModelEventDelegate} and use model event topic annotations.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public final class ModelEventHandler<T extends PO> extends BaseEventHandler {
|
public final class ModelEventHandler<T extends PO> extends BaseEventHandler {
|
||||||
|
|
||||||
|
|
@ -48,6 +47,8 @@ public final class ModelEventHandler<T extends PO> extends BaseEventHandler {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param modelClassType
|
* @param modelClassType
|
||||||
|
* @param delegateClass
|
||||||
|
* @param supplier
|
||||||
*/
|
*/
|
||||||
public ModelEventHandler(Class<T> modelClassType, Class<? extends ModelEventDelegate<T>> delegateClass,
|
public ModelEventHandler(Class<T> modelClassType, Class<? extends ModelEventDelegate<T>> delegateClass,
|
||||||
BiFunction<T, Event, ? extends ModelEventDelegate<T>> supplier) {
|
BiFunction<T, Event, ? extends ModelEventDelegate<T>> supplier) {
|
||||||
|
|
@ -57,6 +58,9 @@ public final class ModelEventHandler<T extends PO> extends BaseEventHandler {
|
||||||
findTableName();
|
findTableName();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Find table name property from annotation or static field (Table_Name).
|
||||||
|
*/
|
||||||
private void findTableName() {
|
private void findTableName() {
|
||||||
try {
|
try {
|
||||||
Model model = modelClassType.getSuperclass().getAnnotation(Model.class);
|
Model model = modelClassType.getSuperclass().getAnnotation(Model.class);
|
||||||
|
|
|
||||||
|
|
@ -29,7 +29,8 @@ import org.adempiere.base.event.RequestSendEMailEventData;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event delegate for {@link RequestSendEMail} event topic. <br/>
|
||||||
|
* To handle RequestSendEMail event, create a sub class of this and override the onRequestSendEmail method.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -29,8 +29,7 @@ import java.util.function.Function;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event handler that delegate to {@link EventDelegate} instance (create for each event call).
|
||||||
* Event handler that delegate to {@link EventDelegate} instance (create for each event call)
|
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
@ -39,7 +38,6 @@ public final class SimpleEventHandler extends BaseEventHandler {
|
||||||
private Function<Event, ? extends EventDelegate> supplier;
|
private Function<Event, ? extends EventDelegate> supplier;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param delegateClass
|
* @param delegateClass
|
||||||
* @param supplier
|
* @param supplier
|
||||||
*/
|
*/
|
||||||
|
|
|
||||||
|
|
@ -31,14 +31,14 @@ import org.compiere.model.PO;
|
||||||
import org.osgi.service.event.Event;
|
import org.osgi.service.event.Event;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
* Event delegate for facts validate event.<br/>
|
||||||
|
* To handle facts validate event, create a subclass of this and uses the {@link FactsValidate} annotation
|
||||||
|
* to annotate the method for the FactsValidate event topic.
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
|
||||||
*/
|
*/
|
||||||
public abstract class FactsValidateDelegate<T extends PO> extends ModelEventDelegate<T> {
|
public abstract class FactsValidateDelegate<T extends PO> extends ModelEventDelegate<T> {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param po
|
* @param po
|
||||||
* @param event
|
* @param event
|
||||||
*/
|
*/
|
||||||
|
|
@ -47,7 +47,6 @@ public abstract class FactsValidateDelegate<T extends PO> extends ModelEventDele
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @return {@link FactsEventData}
|
* @return {@link FactsEventData}
|
||||||
*/
|
*/
|
||||||
protected FactsEventData getFactsEventData() {
|
protected FactsEventData getFactsEventData() {
|
||||||
|
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue