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;
|
||||
|
||||
@org.adempiere.base.annotation.Process
|
||||
@Deprecated
|
||||
public class UpdateRoleMenu extends SvrProcess
|
||||
{
|
||||
private int p_role_id = 0;
|
||||
|
|
|
@ -30,7 +30,8 @@ import org.compiere.model.MProduct;
|
|||
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
|
||||
* @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;
|
||||
|
||||
/**
|
||||
* Report System Issue
|
||||
* Report System Issue.
|
||||
*
|
||||
* @author Jorg Janke
|
||||
* @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
|
||||
public class IssueReport extends SvrProcess
|
||||
{
|
||||
|
|
|
@ -30,7 +30,9 @@ package com.akunagroup.uk.postcode;
|
|||
* Interface for Address Lookup Web Service.
|
||||
* https://sourceforge.net/p/adempiere/feature-requests/137/
|
||||
* The Address Structure
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "11")
|
||||
public interface AddressInterface
|
||||
{
|
||||
public int size();
|
||||
|
|
|
@ -51,7 +51,9 @@ import org.w3c.dom.NodeList;
|
|||
*
|
||||
* @author Michael Judd
|
||||
* @version $Id$
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "11")
|
||||
public class AddressLookup implements AddressLookupInterface {
|
||||
/** The logger. */
|
||||
private static final CLogger log = CLogger.getCLogger(AddressLookup.class);
|
||||
|
|
|
@ -32,7 +32,9 @@ import java.util.HashMap;
|
|||
* Interface for Address Lookup Web Service.
|
||||
* https://sourceforge.net/p/adempiere/feature-requests/137/
|
||||
* The Address lookup class interface
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated(forRemoval = true, since = "11")
|
||||
public interface AddressLookupInterface {
|
||||
|
||||
/*
|
||||
|
|
|
@ -26,6 +26,7 @@
|
|||
|
||||
package com.akunagroup.uk.postcode;
|
||||
|
||||
@Deprecated(forRemoval = true, since = "11")
|
||||
public class Postcode implements AddressInterface
|
||||
{
|
||||
|
||||
|
|
|
@ -58,6 +58,7 @@ import org.jfree.data.time.Year;
|
|||
import org.jfree.data.xy.IntervalXYDataset;
|
||||
|
||||
/**
|
||||
* Builder for JFree Chart
|
||||
* @author Paul Bowden, Adaxa Pty Ltd
|
||||
* @author hengsin
|
||||
*
|
||||
|
@ -70,6 +71,9 @@ public class ChartBuilder {
|
|||
private HashMap<String,MQuery> queries;
|
||||
private Dataset dataset;
|
||||
|
||||
/**
|
||||
* @param chart
|
||||
*/
|
||||
public ChartBuilder(MChart chart) {
|
||||
this.chartModel = chart;
|
||||
}
|
||||
|
@ -145,6 +149,9 @@ public class ChartBuilder {
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Load data from chart data source
|
||||
*/
|
||||
public void loadData() {
|
||||
queries = new HashMap<String,MQuery>();
|
||||
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) {
|
||||
|
||||
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 )
|
||||
return null;
|
||||
|
||||
|
@ -357,35 +373,56 @@ public class ChartBuilder {
|
|||
return cal.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and load data set from data source
|
||||
* @return CategoryDataset
|
||||
*/
|
||||
public CategoryDataset getCategoryDataset() {
|
||||
dataset = new DefaultCategoryDataset();
|
||||
loadData();
|
||||
return (CategoryDataset) dataset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and load data set from data source
|
||||
* @return IntervalXYDataset
|
||||
*/
|
||||
public IntervalXYDataset getXYDataset() {
|
||||
dataset = new TimeSeriesCollection();
|
||||
loadData();
|
||||
return (IntervalXYDataset) dataset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create and load data set from data source
|
||||
* @return PieDataset
|
||||
*/
|
||||
public PieDataset getPieDataset() {
|
||||
dataset = new DefaultPieDataset();
|
||||
loadData();
|
||||
return (PieDataset) dataset;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get current data set
|
||||
* @return dataset
|
||||
*/
|
||||
public Dataset getDataset() {
|
||||
return dataset;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return named query
|
||||
*/
|
||||
public HashMap<String, MQuery> getQueries() {
|
||||
return queries;
|
||||
}
|
||||
|
||||
public MQuery getQuery(String key) {
|
||||
|
||||
|
||||
/**
|
||||
* @param key
|
||||
* @return MQuery
|
||||
*/
|
||||
public MQuery getQuery(String key) {
|
||||
if ( queries.containsKey(key) )
|
||||
{
|
||||
return queries.get(key);
|
||||
|
@ -394,6 +431,9 @@ public class ChartBuilder {
|
|||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createXYBarChart() {
|
||||
JFreeChart chart = ChartFactory.createXYBarChart(
|
||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||
|
@ -412,6 +452,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createTimeSeriesChart() {
|
||||
JFreeChart chart = ChartFactory.createTimeSeriesChart(
|
||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||
|
@ -427,6 +470,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createWaterfallChart() {
|
||||
JFreeChart chart = ChartFactory.createWaterfallChart(
|
||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||
|
@ -444,6 +490,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createRingChart() {
|
||||
final JFreeChart chart = ChartFactory.createRingChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
||||
getPieDataset(), chartModel.isDisplayLegend(), true, true);
|
||||
|
@ -451,6 +500,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createPieChart() {
|
||||
final JFreeChart chart = ChartFactory.createPieChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
||||
getPieDataset(), false, true, true);
|
||||
|
@ -458,6 +510,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart create3DPieChart() {
|
||||
final JFreeChart chart = ChartFactory.createPieChart(chartModel.get_Translation(MChart.COLUMNNAME_Name),
|
||||
getPieDataset(), false, true, true);
|
||||
|
@ -465,6 +520,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createBarChart() {
|
||||
JFreeChart chart = ChartFactory.createBarChart(
|
||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||
|
@ -488,6 +546,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart create3DBarChart() {
|
||||
JFreeChart chart = ChartFactory.createBarChart(
|
||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||
|
@ -505,6 +566,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createStackedBarChart() {
|
||||
JFreeChart chart = ChartFactory.createStackedBarChart(
|
||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||
|
@ -529,6 +593,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart create3DStackedBarChart() {
|
||||
JFreeChart chart = ChartFactory.createStackedBarChart(
|
||||
chartModel.get_Translation(MChart.COLUMNNAME_Name), // chart title
|
||||
|
@ -546,6 +613,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createAreaChart() {
|
||||
// create the chart...
|
||||
JFreeChart chart = ChartFactory.createAreaChart(
|
||||
|
@ -564,6 +634,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createStackedAreaChart() {
|
||||
// create the chart...
|
||||
JFreeChart chart = ChartFactory.createStackedAreaChart(
|
||||
|
@ -582,6 +655,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart createLineChart() {
|
||||
// create the chart...
|
||||
JFreeChart chart = ChartFactory.createLineChart(
|
||||
|
@ -601,6 +677,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return JFreeChart
|
||||
*/
|
||||
private JFreeChart create3DLineChart() {
|
||||
// create the chart...
|
||||
JFreeChart chart = ChartFactory.createLineChart(
|
||||
|
@ -620,6 +699,9 @@ public class ChartBuilder {
|
|||
return chart;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param chart
|
||||
*/
|
||||
private void setupCategoryChart(JFreeChart chart) {
|
||||
CategoryPlot plot = chart.getCategoryPlot();
|
||||
CategoryAxis xAxis = (CategoryAxis)plot.getDomainAxis();
|
||||
|
|
|
@ -33,8 +33,9 @@ import org.jfree.data.general.DefaultPieDataset;
|
|||
/**
|
||||
*
|
||||
* @author hengsin
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
@Deprecated
|
||||
public class GraphBuilder {
|
||||
|
||||
/** The Goal */
|
||||
|
|
|
@ -29,13 +29,11 @@ import org.compiere.util.CLogger;
|
|||
import org.compiere.util.DisplayType;
|
||||
|
||||
/**
|
||||
*
|
||||
* Value object of chart column
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class GraphColumn
|
||||
{
|
||||
|
||||
/**
|
||||
* Base Constructor
|
||||
* @param label label
|
||||
|
@ -81,6 +79,8 @@ public class GraphColumn
|
|||
/**
|
||||
* Request Type Constructor
|
||||
* @param rt Request Type
|
||||
* @param data
|
||||
* @param id
|
||||
*/
|
||||
public GraphColumn (MRequestType rt, BigDecimal data, int id)
|
||||
{
|
||||
|
@ -92,6 +92,8 @@ public class GraphColumn
|
|||
/**
|
||||
* Project Type Constructor
|
||||
* @param pt Project Type
|
||||
* @param data
|
||||
* @param id
|
||||
*/
|
||||
public GraphColumn (MProjectType pt, BigDecimal data, int id)
|
||||
{
|
||||
|
@ -163,33 +165,48 @@ public class GraphColumn
|
|||
return m_mc;
|
||||
} // getMeasureCalc
|
||||
|
||||
/**
|
||||
* @return MRequestType
|
||||
*/
|
||||
public MRequestType getRequestType()
|
||||
{
|
||||
return m_rt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MProjectType
|
||||
*/
|
||||
public MProjectType getProjectType()
|
||||
{
|
||||
return m_pt;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return measure display type (MGoal.MEASUREDISPLAY_*)
|
||||
*/
|
||||
public String getMeasureDisplay()
|
||||
{
|
||||
return m_measureDisplay;
|
||||
} // getMeasureDisplay
|
||||
|
||||
/**
|
||||
* @return date
|
||||
*/
|
||||
public Timestamp getDate()
|
||||
{
|
||||
return m_date;
|
||||
} // getDate
|
||||
|
||||
/**
|
||||
* @return record id
|
||||
*/
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Returns the label.
|
||||
* @return column label.
|
||||
*/
|
||||
public String getLabel ()
|
||||
{
|
||||
|
@ -210,7 +227,7 @@ public class GraphColumn
|
|||
|
||||
/**
|
||||
* @param date for label.
|
||||
* @param MeasureDisplay measure display
|
||||
* @param MeasureDisplay measure display type (MGoal.MEASUREDISPLAY_*)
|
||||
*/
|
||||
public void setLabel (Timestamp date, String MeasureDisplay)
|
||||
{
|
||||
|
@ -243,7 +260,7 @@ public class GraphColumn
|
|||
} // setLabel
|
||||
|
||||
/**
|
||||
* @return Returns the targetValue.
|
||||
* @return targetValue.
|
||||
*/
|
||||
public double getTargetValue ()
|
||||
{
|
||||
|
@ -259,7 +276,7 @@ public class GraphColumn
|
|||
} // setTargetValue
|
||||
|
||||
/**
|
||||
* @return Returns the data value.
|
||||
* @return data value
|
||||
*/
|
||||
public double getValue ()
|
||||
{
|
||||
|
@ -279,7 +296,7 @@ public class GraphColumn
|
|||
} // setValue
|
||||
|
||||
/**
|
||||
* @return Returns the column width in pixels.
|
||||
* @return column width in pixels.
|
||||
*/
|
||||
public double getColWidth ()
|
||||
{
|
||||
|
@ -295,7 +312,7 @@ public class GraphColumn
|
|||
} // getColWidth
|
||||
|
||||
/**
|
||||
* @return Returns the height in pixels.
|
||||
* @return height in pixels.
|
||||
*/
|
||||
public double getColHeight()
|
||||
{
|
||||
|
@ -310,6 +327,11 @@ public class GraphColumn
|
|||
m_height = height;
|
||||
} // setHeight
|
||||
|
||||
/**
|
||||
* Get query for goal
|
||||
* @param mGoal
|
||||
* @return query
|
||||
*/
|
||||
public MQuery getMQuery(MGoal mGoal)
|
||||
{
|
||||
MQuery query = null;
|
||||
|
|
|
@ -45,6 +45,13 @@ public abstract class AbstractModelFactory implements IModelFactory {
|
|||
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) {
|
||||
if (clazz == null)
|
||||
{
|
||||
|
@ -130,6 +137,13 @@ public abstract class AbstractModelFactory implements IModelFactory {
|
|||
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) {
|
||||
if (clazz == null)
|
||||
{
|
||||
|
@ -208,6 +222,13 @@ public abstract class AbstractModelFactory implements IModelFactory {
|
|||
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) {
|
||||
if (clazz == null)
|
||||
{
|
||||
|
|
|
@ -98,6 +98,12 @@ public abstract class AnnotationBasedColumnCalloutFactory extends AnnotationBase
|
|||
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,
|
||||
List<String> calloutClassNames) {
|
||||
for(String calloutClass : calloutClassNames) {
|
||||
|
@ -136,6 +142,11 @@ public abstract class AnnotationBasedColumnCalloutFactory extends AnnotationBase
|
|||
*/
|
||||
protected abstract String[] getPackages();
|
||||
|
||||
/**
|
||||
* Perform annotation scanning upon activation of component
|
||||
* @param context
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@Activate
|
||||
public void activate(ComponentContext context) throws ClassNotFoundException {
|
||||
long start = System.currentTimeMillis();
|
||||
|
@ -179,6 +190,11 @@ public abstract class AnnotationBasedColumnCalloutFactory extends AnnotationBase
|
|||
graph.scanAsync(getExecutorService(), getMaxThreads(), scanResultProcessor, getScanFailureHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
* Process class annotation and register column callout.
|
||||
* @param className
|
||||
* @param annotationInfo
|
||||
*/
|
||||
private void processAnnotation(String className, AnnotationInfo annotationInfo) {
|
||||
//not sure why but sometime ClassGraph return Object[] instead of the expected String[]
|
||||
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) {
|
||||
for (Object columnName : columnNames) {
|
||||
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) {
|
||||
List<String> callouts = columnNameMap.get("*");
|
||||
if (callouts == null ) {
|
||||
|
|
|
@ -215,6 +215,12 @@ public abstract class AnnotationBasedEventManager extends AnnotationBasedFactory
|
|||
scan(bundleContext, true, getPackages());
|
||||
}
|
||||
|
||||
/**
|
||||
* @param classLoader
|
||||
* @param className
|
||||
* @param filter
|
||||
* @return new SimpleEventHandler instance
|
||||
*/
|
||||
private EventHandler simpleEventDelegate(ClassLoader classLoader, String className, String filter) {
|
||||
try {
|
||||
@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) {
|
||||
try {
|
||||
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) {
|
||||
try {
|
||||
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) {
|
||||
try {
|
||||
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.Future;
|
||||
import java.util.concurrent.atomic.AtomicBoolean;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.util.CLogger;
|
||||
|
@ -66,14 +67,18 @@ public abstract class AnnotationBasedFactory {
|
|||
} catch (Exception e) { }
|
||||
}
|
||||
|
||||
/**
|
||||
* Wait for completion of annotation scanning
|
||||
*/
|
||||
protected void blockWhileScanning() {
|
||||
String className = this.getClass().getSimpleName();
|
||||
if(!scanCompleted.get())
|
||||
try {
|
||||
Instant start = Instant.now();
|
||||
threadBlockerFuture.get();
|
||||
s_log.fine(() -> String.format("%s waited %d(ms) for class scanning to end"
|
||||
, className, Duration.between(start, Instant.now()).toMillis()));
|
||||
if (s_log.isLoggable(Level.FINE))
|
||||
s_log.fine(() -> String.format("%s waited %d(ms) for class scanning to end"
|
||||
, className, Duration.between(start, Instant.now()).toMillis()));
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
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
|
||||
* {@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
|
||||
* discovery using SPI is preferred over reflection-based methods.
|
||||
* @author Saulo Gil
|
||||
|
@ -77,6 +77,11 @@ public class AnnotationBasedModelFactory extends AnnotationBasedFactory implemen
|
|||
return patterns;
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan annotation upon activation of component
|
||||
* @param context
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@Activate
|
||||
public void activate(ComponentContext context) throws ClassNotFoundException {
|
||||
long start = System.currentTimeMillis();
|
||||
|
@ -125,6 +130,11 @@ public class AnnotationBasedModelFactory extends AnnotationBasedFactory implemen
|
|||
graph.scanAsync(getExecutorService(), getMaxThreads(), scanResultProcessor, getScanFailureHandler());
|
||||
}
|
||||
|
||||
/**
|
||||
* Process annotation scan result
|
||||
* @param classLoader
|
||||
* @param scanResult
|
||||
*/
|
||||
private void processResults(ClassLoader classLoader, ScanResult scanResult ) {
|
||||
BiConsumer<String,ClassNotFoundException> exceptionHandler = (className, exception) ->
|
||||
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;
|
||||
|
||||
/**
|
||||
* 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
|
||||
* {@link Process} annotation to register a process class with an additional name (for e.g
|
||||
* to replace a core process class).
|
||||
|
@ -72,6 +72,11 @@ public abstract class AnnotationBasedProcessFactory extends AnnotationBasedFacto
|
|||
*/
|
||||
protected abstract String[] getPackages();
|
||||
|
||||
/**
|
||||
* Scan annotation upon activation of component
|
||||
* @param context
|
||||
* @throws ClassNotFoundException
|
||||
*/
|
||||
@Activate
|
||||
public void activate(ComponentContext context) throws ClassNotFoundException {
|
||||
long start = System.currentTimeMillis();
|
||||
|
@ -103,8 +108,9 @@ public abstract class AnnotationBasedProcessFactory extends AnnotationBasedFacto
|
|||
classCache.put(alternateName, className);
|
||||
}
|
||||
long end = System.currentTimeMillis();
|
||||
s_log.info(() -> this.getClass().getSimpleName() + " loaded " + classCache.size() + " classes in "
|
||||
+ ((end-start)/1000f) + "s");
|
||||
if (s_log.isLoggable(Level.INFO))
|
||||
s_log.info(() -> this.getClass().getSimpleName() + " loaded " + classCache.size() + " classes in "
|
||||
+ ((end-start)/1000f) + "s");
|
||||
signalScanCompletion(true);
|
||||
};
|
||||
|
||||
|
|
|
@ -59,7 +59,6 @@ public final class ColumnCalloutManager {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableName
|
||||
* @param columnName
|
||||
* @return list of {@link IColumnCallout} register for tableName.columnName
|
||||
|
@ -137,7 +136,6 @@ public final class ColumnCalloutManager {
|
|||
|
||||
// IDEMPIERE-2732
|
||||
/**
|
||||
*
|
||||
* @param className
|
||||
* @param methodName
|
||||
* @return {@link Callout} for className and methodName
|
||||
|
@ -172,8 +170,7 @@ public final class ColumnCalloutManager {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {@link IMappedColumnCalloutFactory}
|
||||
* @return {@link IMappedColumnCalloutFactory} instance
|
||||
*/
|
||||
public synchronized static IMappedColumnCalloutFactory getMappedColumnCalloutFactory() {
|
||||
IMappedColumnCalloutFactory factoryService = null;
|
||||
|
|
|
@ -33,6 +33,8 @@ import org.osgi.service.component.runtime.ServiceComponentRuntime;
|
|||
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
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -20,7 +20,8 @@ import org.adempiere.model.IAddressValidation;
|
|||
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
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -21,10 +21,9 @@ import org.compiere.model.Callout;
|
|||
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
|
||||
*
|
||||
* This is just a blueprint for creation of a CalloutFactory
|
||||
*
|
||||
*/
|
||||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -18,8 +18,9 @@ import java.util.List;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public class DefaultColumnCalloutFactory implements IColumnCalloutFactory {
|
||||
|
||||
|
|
|
@ -25,7 +25,8 @@ import org.compiere.util.CLogger;
|
|||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
*
|
||||
* Default {@link IDocFactory} implementation from core.<br/>
|
||||
* Load {@link Doc} instance from class path.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -26,9 +26,10 @@ import 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 hengsin
|
||||
*
|
||||
*/
|
||||
public class DefaultLookupFactory implements ILookupFactory{
|
||||
|
||||
|
|
|
@ -17,8 +17,9 @@ import org.adempiere.base.equinox.EquinoxExtensionLocator;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public class DefaultModelValidatorFactory implements IModelValidatorFactory {
|
||||
|
||||
|
|
|
@ -20,8 +20,9 @@ import org.compiere.util.CLogger;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public class DefaultPaymentExporterFactory implements IPaymentExporterFactory {
|
||||
|
||||
|
|
|
@ -20,8 +20,9 @@ import org.compiere.model.PaymentProcessor;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public class DefaultPaymentProcessorFactory implements IPaymentProcessorFactory {
|
||||
|
||||
|
|
|
@ -20,8 +20,9 @@ import org.compiere.process.ProcessCall;
|
|||
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
|
||||
*
|
||||
*/
|
||||
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;
|
||||
|
||||
import org.compiere.model.MProductPricing;
|
||||
|
||||
/**
|
||||
* Default {@link IProductPricingFactory} implementation for core. <br/>
|
||||
* Always return new {@link MProductPricing} instance.
|
||||
*/
|
||||
public class DefaultProductPricingFactory implements IProductPricingFactory {
|
||||
|
||||
/**
|
||||
|
|
|
@ -20,8 +20,9 @@ import org.adempiere.model.IShipmentProcessor;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public class DefaultShipmentProcessorFactory implements IShipmentProcessorFactory {
|
||||
|
||||
|
|
|
@ -31,8 +31,9 @@ import org.compiere.model.Tax;
|
|||
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
|
||||
*
|
||||
*/
|
||||
@Component(immediate = true, service = {ITaxLookup.class})
|
||||
public class DefaultTaxLookup implements ITaxLookup {
|
||||
|
|
|
@ -20,9 +20,9 @@ import org.adempiere.model.ITaxProvider;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public class DefaultTaxProviderFactory implements ITaxProviderFactory {
|
||||
|
||||
|
|
|
@ -34,7 +34,7 @@ public interface IBankStatementLoaderFactory {
|
|||
* want to use.
|
||||
*
|
||||
* @param className
|
||||
* @return BankStatementLoader instance
|
||||
* @return BankStatementLoaderInterface instance
|
||||
*/
|
||||
public BankStatementLoaderInterface newBankStatementLoaderInstance(String className);
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@ public interface IBankStatementMatcherFactory {
|
|||
* the fully qualified classname of the Loader class you want to use.
|
||||
*
|
||||
* @param className
|
||||
* @return BankStatementMatcher instance
|
||||
* @return BankStatementMatcherInterface instance
|
||||
*/
|
||||
public BankStatementMatcherInterface newBankStatementMatcherInstance(String className);
|
||||
}
|
||||
|
|
|
@ -16,17 +16,17 @@ package org.adempiere.base;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public interface ICalloutFactory {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param className
|
||||
* @param methodName
|
||||
* @return matching Callout
|
||||
* @return matching Callout instance
|
||||
*/
|
||||
public Callout getCallout(String className, String methodName);
|
||||
|
||||
|
|
|
@ -29,15 +29,15 @@ public interface IColumnCallout
|
|||
/**
|
||||
* Start Callout.
|
||||
* <p>
|
||||
* 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
|
||||
* 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.
|
||||
* <p>
|
||||
* When invoked, the Tab model has the new value!
|
||||
*
|
||||
* @param ctx Context
|
||||
* @param WindowNo current Window No
|
||||
* @param mTab Model Tab
|
||||
* @param mField Model Field
|
||||
* @param mTab Tab model
|
||||
* @param mField Field model
|
||||
* @param value The new value
|
||||
* @param oldValue The old value
|
||||
* @return Error message or ""
|
||||
|
|
|
@ -14,14 +14,14 @@
|
|||
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
|
||||
*
|
||||
*/
|
||||
public interface IColumnCalloutFactory {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param tableName
|
||||
* @param columnName
|
||||
* @return array of matching callouts
|
||||
|
|
|
@ -21,15 +21,22 @@ import org.compiere.model.X_AD_Package_Imp_Proc;
|
|||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
* A dictionary service provides for easy handling of dynamic Adempiere
|
||||
* dictionary.
|
||||
* Interface for import of Application Dictionary data.
|
||||
*
|
||||
* @author Joerg Viola
|
||||
*
|
||||
*/
|
||||
public interface IDictionaryService {
|
||||
/**
|
||||
* Import application dictionary package
|
||||
* @param context
|
||||
* @param packageFile Application Dictionary package
|
||||
* @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() {
|
||||
return null;
|
||||
};
|
||||
|
|
|
@ -18,40 +18,99 @@ import java.text.SimpleDateFormat;
|
|||
import org.compiere.util.Language;
|
||||
|
||||
/**
|
||||
* Interface for display type factory.
|
||||
* @author Jan Thielemann - jan.thielemann@evenos-consulting.de
|
||||
* @author evenos Consulting GmbH - www.evenos.org
|
||||
*/
|
||||
|
||||
public interface IDisplayTypeFactory {
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return true if displayType is of int ID type
|
||||
*/
|
||||
public boolean isID(int displayType);
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return true if displayType is of UUID type
|
||||
*/
|
||||
public default boolean isUUID(int displayType) {
|
||||
return false;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return true if displayType is of numeric type
|
||||
*/
|
||||
public boolean isNumeric(int displayType);
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return default numeric precision for displayType
|
||||
*/
|
||||
public Integer getDefaultPrecision(int displayType);
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return true if displayType is of text type
|
||||
*/
|
||||
public boolean isText(int displayType);
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return true if displayType is of date type
|
||||
*/
|
||||
public boolean isDate (int displayType);
|
||||
public default boolean isList (int displayType) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return true if displayType is of lookup type (usually a foreign key type)
|
||||
*/
|
||||
public boolean isLookup(int displayType);
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return true if displayType is of LOB type
|
||||
*/
|
||||
public boolean isLOB (int displayType);
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @param language
|
||||
* @param pattern
|
||||
* @return DecimalFormat
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @param yesNoAsBoolean
|
||||
* @return Java type for displayType
|
||||
*/
|
||||
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);
|
||||
|
||||
/**
|
||||
* @param displayType
|
||||
* @return description for displayType
|
||||
*/
|
||||
public String getDescription (int displayType);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -25,9 +25,8 @@ import org.compiere.util.DB;
|
|||
import org.compiere.util.Env;
|
||||
|
||||
/**
|
||||
*
|
||||
* Factory interface for {@link Doc}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IDocFactory {
|
||||
|
||||
|
|
|
@ -23,14 +23,13 @@ import org.adempiere.util.IProcessUI;
|
|||
import org.compiere.model.GridTab;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface to import data to {@link GridTab}.
|
||||
* @author Carlos Ruiz
|
||||
*
|
||||
*/
|
||||
public interface IGridTabImporter {
|
||||
|
||||
/**
|
||||
* export gridTab data to file
|
||||
* Import data from filestream to gridTab
|
||||
* @param gridTab
|
||||
* @param childs
|
||||
* @param filestream
|
||||
|
@ -39,14 +38,14 @@ public interface IGridTabImporter {
|
|||
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 childs
|
||||
* @param filestream
|
||||
* @param charset
|
||||
* @param importMode
|
||||
* @param processUI
|
||||
* @return
|
||||
* @return File for import log
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for key store
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public interface IKeyStore {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param AD_Client_ID
|
||||
* @return secret key
|
||||
*/
|
||||
|
|
|
@ -17,27 +17,27 @@ import org.compiere.model.InfoColumnVO;
|
|||
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 evenos Consulting GmbH - www.evenos.org
|
||||
*/
|
||||
public interface ILookupFactory {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gridFieldVO
|
||||
* @return lookup instance
|
||||
*/
|
||||
public Lookup getLookup (GridFieldVO gridFieldVO);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param gridFieldVO
|
||||
* @return true if the field's displaytype uses lookup
|
||||
*/
|
||||
public boolean isLookup(GridFieldVO gridFieldVO);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param infoColumnVO
|
||||
* @return true if the field's displaytype uses lookup
|
||||
*/
|
||||
|
|
|
@ -47,14 +47,12 @@ public interface IMappedByNameFactory<T> {
|
|||
public void removeMapping(String name);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param name
|
||||
* @return {@link Supplier}
|
||||
*/
|
||||
public Supplier<T> getSupplier(String name);
|
||||
|
||||
/**
|
||||
*
|
||||
* @param 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 org.adempiere.base.annotation.Callout;
|
||||
import org.osgi.framework.BundleContext;
|
||||
|
||||
/**
|
||||
*
|
||||
* Factory interface for mapping of tableName+columnName to {@link IColumnCallout} implementation.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
@ -52,7 +53,7 @@ public interface IMappedColumnCalloutFactory {
|
|||
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 packages
|
||||
*/
|
||||
|
|
|
@ -31,7 +31,7 @@ import org.compiere.acct.Doc;
|
|||
import org.compiere.model.MAcctSchema;
|
||||
|
||||
/**
|
||||
*
|
||||
* Factory interface for mapping between tableName+gaap to {@link Doc} implementation.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
@ -46,7 +46,7 @@ public interface IMappedDocumentFactory {
|
|||
public void addMapping(String gaap, String tableName, Function<Parameter, ? extends Doc> supplier);
|
||||
|
||||
/**
|
||||
*
|
||||
* Remove mapping
|
||||
* @param gaap
|
||||
* @param tableName
|
||||
*/
|
||||
|
|
|
@ -16,7 +16,7 @@ package org.adempiere.base;
|
|||
import org.compiere.model.ModelValidator;
|
||||
|
||||
/**
|
||||
*
|
||||
* Factory interface for {@link ModelValidator}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
@ -24,7 +24,7 @@ public interface IModelValidatorFactory {
|
|||
|
||||
/**
|
||||
* @param className
|
||||
* @return new modelvalidator intance
|
||||
* @return new ModelValidator instance
|
||||
*/
|
||||
public ModelValidator newModelValidatorInstance(String className);
|
||||
}
|
||||
|
|
|
@ -16,14 +16,14 @@ package org.adempiere.base;
|
|||
import org.compiere.util.PaymentExport;
|
||||
|
||||
/**
|
||||
* PaymentExporter factory interface.
|
||||
* Factory interface for {@link PaymentExport}.
|
||||
* @author mbozem
|
||||
*/
|
||||
public interface IPaymentExporterFactory {
|
||||
|
||||
/**
|
||||
* @param className
|
||||
* @return payment exporter instance
|
||||
* @return new PaymentExport instance
|
||||
*/
|
||||
public PaymentExport newPaymentExporterInstance(String className);
|
||||
}
|
||||
|
|
|
@ -16,15 +16,14 @@ package org.adempiere.base;
|
|||
import org.compiere.model.PaymentProcessor;
|
||||
|
||||
/**
|
||||
*
|
||||
* Factory interface for {@link PaymentProcessor}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IPaymentProcessorFactory {
|
||||
|
||||
/**
|
||||
* @param className
|
||||
* @return payment processor instance
|
||||
* @return new PaymentProcessor instance
|
||||
*/
|
||||
public PaymentProcessor newPaymentProcessorInstance(String className);
|
||||
}
|
||||
|
|
|
@ -16,16 +16,15 @@ package org.adempiere.base;
|
|||
import org.compiere.process.ProcessCall;
|
||||
|
||||
/**
|
||||
*
|
||||
* Factory interface for {@link ProcessCall}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IProcessFactory {
|
||||
|
||||
/**
|
||||
* Create new process instance
|
||||
* @param className
|
||||
* @return new process instance
|
||||
* @return new ProcessCall instance
|
||||
*/
|
||||
public ProcessCall newProcessInstance(String className);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ import org.compiere.model.I_M_RMALine;
|
|||
import org.compiere.model.I_M_RequisitionLine;
|
||||
|
||||
/**
|
||||
* Product Price Calculations
|
||||
* Interface for Product Price Calculations
|
||||
*/
|
||||
public interface IProductPricing {
|
||||
|
||||
|
|
|
@ -13,8 +13,14 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.base;
|
||||
|
||||
/**
|
||||
* Factory interface for {@link AbstractProductPricing}.
|
||||
*/
|
||||
public interface IProductPricingFactory {
|
||||
|
||||
/**
|
||||
* @return new AbstractProductPricing instance
|
||||
*/
|
||||
public AbstractProductPricing newProductPricingInstance();
|
||||
|
||||
}
|
||||
|
|
|
@ -11,9 +11,8 @@ import org.compiere.util.ReplenishInterface;
|
|||
public interface IReplenishFactory {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param className
|
||||
* @return Replenish instance
|
||||
* @return new ReplenishInterface instance
|
||||
*/
|
||||
public ReplenishInterface newReplenishInstance(String className);
|
||||
}
|
||||
|
|
|
@ -18,8 +18,15 @@ package org.adempiere.base;
|
|||
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Service interface to find resource by name
|
||||
*/
|
||||
public interface IResourceFinder {
|
||||
|
||||
/**
|
||||
* @param name
|
||||
* @return URL for resource found or null
|
||||
*/
|
||||
URL getResource(String name);
|
||||
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
package org.adempiere.base;
|
||||
|
||||
/**
|
||||
*
|
||||
* Holder interface for dynamic service
|
||||
* @author hengsin
|
||||
*
|
||||
* @param <T>
|
||||
|
|
|
@ -17,33 +17,30 @@
|
|||
package org.adempiere.base;
|
||||
|
||||
/**
|
||||
* A service locator looks up services.
|
||||
* This is the central authority for adempiere service definition,
|
||||
* 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
|
||||
* Interface for dynamic discovery of services.<br/>
|
||||
* This is the primary entry point for iDempiere service discovery.
|
||||
*
|
||||
* @author viola
|
||||
*
|
||||
*/
|
||||
public interface IServiceLocator {
|
||||
/**
|
||||
*
|
||||
* Locate matching service by type (order by service.ranking priority)
|
||||
* @param type service interface
|
||||
* @return holder for dynamic service
|
||||
*/
|
||||
<T> IServiceHolder<T> locate(Class<T> type);
|
||||
|
||||
/**
|
||||
*
|
||||
* Locate matching service by type and query expression
|
||||
* @param type
|
||||
* @param query
|
||||
* @return
|
||||
* @return holder for service
|
||||
*/
|
||||
<T> IServiceHolder<T> locate(Class<T> type, ServiceQuery query);
|
||||
|
||||
/**
|
||||
*
|
||||
* Locate matching service by component name and query expression
|
||||
* @param type
|
||||
* @param componentName service component name
|
||||
* @param query
|
||||
|
@ -52,14 +49,14 @@ public interface IServiceLocator {
|
|||
<T> IServiceHolder<T> locate(Class<T> type, String componentName, ServiceQuery query);
|
||||
|
||||
/**
|
||||
*
|
||||
* Find all matching services by type
|
||||
* @param type
|
||||
* @return holder for list of dynamic service
|
||||
*/
|
||||
<T> IServicesHolder<T> list(Class<T> type);
|
||||
|
||||
/**
|
||||
*
|
||||
* Find all matching services by type and query expression
|
||||
* @param type
|
||||
* @param query
|
||||
* @return holder for list of dynamic service
|
||||
|
@ -67,7 +64,7 @@ public interface IServiceLocator {
|
|||
<T> IServicesHolder<T> list(Class<T> type, ServiceQuery query);
|
||||
|
||||
/**
|
||||
*
|
||||
* Find all matching services by component name and query expression
|
||||
* @param type
|
||||
* @param componentName osgi service component name
|
||||
* @param query
|
||||
|
|
|
@ -27,8 +27,8 @@ package org.adempiere.base;
|
|||
import org.osgi.framework.ServiceReference;
|
||||
|
||||
/**
|
||||
* Dynamic service reference holder for a service object.
|
||||
* For cache usage, you should cache this instead of service object
|
||||
* Service reference holder for a service object. <br/>
|
||||
* For caching of service, you should cache this instead of the service object.
|
||||
* @author hengsin
|
||||
*
|
||||
* @param <T>
|
||||
|
|
|
@ -16,7 +16,7 @@ package org.adempiere.base;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
*
|
||||
* Holder interface for list of service
|
||||
* @author hengsin
|
||||
*
|
||||
* @param <T>
|
||||
|
|
|
@ -16,16 +16,15 @@ package org.adempiere.base;
|
|||
import org.adempiere.model.IShipmentProcessor;
|
||||
|
||||
/**
|
||||
*
|
||||
* Factory interface for {@link IShipmentProcessor}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IShipmentProcessorFactory {
|
||||
|
||||
/**
|
||||
* Create new shipment processor instance
|
||||
* @param className
|
||||
* @return shipment processor instance
|
||||
* @return new IShipmentProcessor instance
|
||||
*/
|
||||
public IShipmentProcessor newShipmentProcessorInstance(String className);
|
||||
}
|
||||
|
|
|
@ -28,9 +28,8 @@ import java.sql.Timestamp;
|
|||
import java.util.Properties;
|
||||
|
||||
/**
|
||||
* Interface to lookup C_Tax record id
|
||||
* Interface to lookup C_Tax record id (C_Tax_ID)
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface ITaxLookup {
|
||||
|
||||
|
|
|
@ -18,14 +18,13 @@ import org.adempiere.model.ITaxProvider;
|
|||
/**
|
||||
* Tax provider factory interface
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public interface ITaxProviderFactory {
|
||||
|
||||
/**
|
||||
* Create new tax provider instance
|
||||
* @param className
|
||||
* @return tax provider instance
|
||||
* @return new ITaxProvider instance
|
||||
*/
|
||||
public ITaxProvider newTaxProviderInstance(String className);
|
||||
}
|
||||
|
|
|
@ -45,9 +45,8 @@ import io.github.classgraph.ClassInfo;
|
|||
import io.github.classgraph.ScanResult;
|
||||
|
||||
/**
|
||||
*
|
||||
* Default implementation of {@link IMappedColumnCalloutFactory} for core.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
@Component(name = "org.adempiere.base.MappedColumnCalloutFactory",
|
||||
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
|
||||
public void scan(BundleContext context, String... packages) {
|
||||
ClassLoader classLoader = context.getBundle().adapt(BundleWiring.class).getClassLoader();
|
||||
|
|
|
@ -35,17 +35,16 @@ import org.compiere.util.Env;
|
|||
import org.compiere.util.Util;
|
||||
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.
|
||||
* Document factory backed by map between tablename + gaap and lambda function object.<br/>
|
||||
* If you create a subclass of this and register it as osgi service, don't register for the IMappedDocumentFactory interface.
|
||||
* @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 {
|
||||
|
||||
private final ConcurrentHashMap<String, Function<Parameter, ? extends Doc>> documentMap = new ConcurrentHashMap<>();
|
||||
|
|
|
@ -28,7 +28,7 @@ public @interface Model {
|
|||
|
||||
/**
|
||||
* Table name
|
||||
* @return
|
||||
* @return table name
|
||||
*/
|
||||
String table();
|
||||
|
||||
|
|
|
@ -29,8 +29,7 @@ public class Service {
|
|||
private static IServiceLocator theLocator = new DynamicServiceLocator();
|
||||
|
||||
/**
|
||||
*
|
||||
* @return service locator instance
|
||||
* @return IServiceLocator instance
|
||||
*/
|
||||
public static IServiceLocator locator() {
|
||||
return theLocator;
|
||||
|
|
|
@ -32,8 +32,9 @@ import java.lang.annotation.Retention;
|
|||
import java.lang.annotation.Target;
|
||||
|
||||
/**
|
||||
* Annotation for Column Callout. This should only be used with class that implements the IColumnCallout interface.
|
||||
* You can repeat the annotation multiple time for different table and column name combination
|
||||
* Annotation for Column Callout. <br/>
|
||||
* 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.
|
||||
* @author hengsin
|
||||
*
|
||||
|
|
|
@ -33,11 +33,9 @@ import java.lang.annotation.Target;
|
|||
import org.adempiere.base.event.annotations.EventDelegate;
|
||||
|
||||
/**
|
||||
*
|
||||
* Annotation for OSGi Event Topic Delegate.
|
||||
* Annotation for OSGi Event Topic Delegate.<br/>
|
||||
* Works with {@link EventDelegate} and its sub classes
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
@Retention(RUNTIME)
|
||||
@Target(ElementType.TYPE)
|
||||
|
|
|
@ -33,8 +33,8 @@ import java.lang.annotation.Target;
|
|||
import org.adempiere.base.event.annotations.imp.ImportEventDelegate;
|
||||
|
||||
/**
|
||||
* Define parameter for {@link ImportEventDelegate}
|
||||
* Works with classes with {@link EventTopicDelegate} annotation
|
||||
* Specify parameter for {@link ImportEventDelegate}.<br/>
|
||||
* Works with classes with {@link EventTopicDelegate} annotation.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -34,8 +34,8 @@ import org.adempiere.base.event.annotations.ModelEventDelegate;
|
|||
import org.compiere.model.PO;
|
||||
|
||||
/**
|
||||
* Specify parameter for {@link ModelEventDelegate}
|
||||
* Works with classes with {@link EventTopicDelegate} annotation
|
||||
* Specify parameter for {@link ModelEventDelegate}.<br/>
|
||||
* Works with classes with {@link EventTopicDelegate} annotation.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -22,16 +22,16 @@ import org.compiere.model.X_AD_Process_Para;
|
|||
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>
|
||||
* [1] If the parameter annotation has a name, then it must match exactly the process parameter
|
||||
* metadata definition. For example: <br>
|
||||
* <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>
|
||||
* [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:
|
||||
* <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:
|
||||
* <code>@Parameter Integer C_BPartner_ID</code> will match a parameter named <code>C_BPartner_ID</code>.
|
||||
* @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;
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE;
|
||||
|
|
|
@ -33,8 +33,8 @@ import java.lang.annotation.Target;
|
|||
import org.adempiere.base.event.annotations.process.ProcessEventDelegate;
|
||||
|
||||
/**
|
||||
* Define parameter for {@link ProcessEventDelegate}
|
||||
* Works with classes with {@link EventTopicDelegate} annotation
|
||||
* Specify parameter for {@link ProcessEventDelegate}.<br/>
|
||||
* Works with classes with {@link EventTopicDelegate} annotation.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
@ -43,7 +43,7 @@ import org.adempiere.base.event.annotations.process.ProcessEventDelegate;
|
|||
public @interface ProcessEventTopic {
|
||||
/**
|
||||
* AD_Process.AD_Process_UU (uuid) value for {@link ProcessEventDelegate}
|
||||
* @return process uuid
|
||||
* @return AD_Process_UU
|
||||
*/
|
||||
String processUUID();
|
||||
}
|
||||
|
|
|
@ -25,8 +25,8 @@ import org.osgi.framework.ServiceReference;
|
|||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
/**
|
||||
* Holder for OSGI service. Implemented using {@link ServiceTracker}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
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;
|
||||
|
||||
/**
|
||||
* Service locator implementation for OSGi service.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class DynamicServiceLocator implements IServiceLocator {
|
||||
|
||||
/**
|
||||
*
|
||||
* default constructor
|
||||
*/
|
||||
public DynamicServiceLocator() {
|
||||
}
|
||||
|
@ -109,6 +109,13 @@ public class DynamicServiceLocator implements IServiceLocator {
|
|||
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) {
|
||||
StringBuilder builder = new StringBuilder("(&(objectclass=");
|
||||
builder.append(type.getName()).append(")");
|
||||
|
|
|
@ -29,7 +29,7 @@ import org.osgi.framework.ServiceReference;
|
|||
import org.osgi.util.tracker.ServiceTracker;
|
||||
|
||||
/**
|
||||
* IServiceReferenceHolder implementation using ServiceTracker
|
||||
* IServiceReferenceHolder for OSGi service, implemented using {@link ServiceTracker}
|
||||
* @author hengsin
|
||||
*
|
||||
* @param <T>
|
||||
|
|
|
@ -31,13 +31,13 @@ import org.osgi.framework.Constants;
|
|||
import org.osgi.framework.ServiceReference;
|
||||
|
||||
/**
|
||||
* Service Reference Comparator.
|
||||
* Service Reference Comparator. <br/>
|
||||
* This comparator follows OSGi Ranking policy.
|
||||
* @author hengsin
|
||||
*/
|
||||
public final class ServiceRankingComparator implements Comparator<ServiceReference<?>>, Serializable {
|
||||
/**
|
||||
*
|
||||
* generated serial id
|
||||
*/
|
||||
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)
|
||||
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
|
||||
*/
|
||||
@Override
|
||||
public int compare(ServiceReference<?> serviceReference1, ServiceReference<?> serviceReference2) {
|
||||
if (serviceReference1.equals(serviceReference2)) { return 0; }
|
||||
|
||||
|
|
|
@ -16,6 +16,7 @@ package org.adempiere.base.equinox;
|
|||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Holder for list of Equinox extension.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -20,8 +20,8 @@ import org.adempiere.base.ServiceQuery;
|
|||
|
||||
|
||||
/**
|
||||
* This is the Equinox implementation of extension Locator.
|
||||
* It delegates work to the ExtensionList that lookups up extensions.
|
||||
* This is the Equinox implementation of extension Locator. <br/>
|
||||
* 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.
|
||||
*
|
||||
* @author viola
|
||||
|
@ -33,12 +33,14 @@ public class EquinoxExtensionLocator {
|
|||
|
||||
private EquinoxExtensionLocator() {}
|
||||
|
||||
/**
|
||||
* @return EquinoxExtensionLocator singleton instance
|
||||
*/
|
||||
public static EquinoxExtensionLocator instance() {
|
||||
return INSTANCE;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
|
@ -47,7 +49,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionPointId
|
||||
* @return equinox extension holder
|
||||
|
@ -58,7 +59,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param query
|
||||
* @return equinox extension holder
|
||||
|
@ -68,7 +68,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionId
|
||||
* @param query
|
||||
|
@ -80,7 +79,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionPointId
|
||||
* @param extensionId
|
||||
|
@ -94,7 +92,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @return equinox extension holder
|
||||
*/
|
||||
|
@ -103,7 +100,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionPointId
|
||||
* @return equinox extension holder
|
||||
|
@ -114,7 +110,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param query
|
||||
* @return equinox extension holder
|
||||
|
@ -124,7 +119,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionId
|
||||
* @param query
|
||||
|
@ -136,7 +130,6 @@ public class EquinoxExtensionLocator {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param type
|
||||
* @param extensionPointId
|
||||
* @param extensionId
|
||||
|
|
|
@ -29,11 +29,11 @@ import org.eclipse.core.runtime.IConfigurationElement;
|
|||
import org.eclipse.core.runtime.Platform;
|
||||
|
||||
/**
|
||||
* This List looks up services as extensions in equinox.
|
||||
* The extension point must be the class name of the service interface.
|
||||
* This List looks up services as extensions in equinox.<br/>
|
||||
* The extension point must be the class name of the service interface. <br/>
|
||||
* The query attributes are checked against the attributes
|
||||
* of the extension configuration element.
|
||||
*
|
||||
* <p>
|
||||
* In order to minimize equinox lookups, a filtering iterator is used.
|
||||
* @author viola
|
||||
*
|
||||
|
@ -41,15 +41,23 @@ import org.eclipse.core.runtime.Platform;
|
|||
*/
|
||||
public class ExtensionList<T> implements Iterable<T>{
|
||||
|
||||
/**
|
||||
* Iterator implementation for Equinox extension
|
||||
* @param <E>
|
||||
*/
|
||||
public class ExtensionIterator<E extends T> implements Iterator<T> {
|
||||
|
||||
private int index = 0;
|
||||
|
||||
@Override
|
||||
public boolean hasNext() {
|
||||
iterateUntilAccepted();
|
||||
return index<elements.length;
|
||||
}
|
||||
|
||||
/**
|
||||
* Increment {@link #index} until we found the next matching element
|
||||
*/
|
||||
private void iterateUntilAccepted() {
|
||||
while (index<elements.length) {
|
||||
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) {
|
||||
if (extensionId != null) {
|
||||
String id = element.getDeclaringExtension().getUniqueIdentifier();
|
||||
|
@ -74,6 +86,7 @@ public class ExtensionList<T> implements Iterable<T>{
|
|||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public E next() {
|
||||
iterateUntilAccepted();
|
||||
IConfigurationElement e = elements[index++];
|
||||
|
@ -95,6 +108,10 @@ public class ExtensionList<T> implements Iterable<T>{
|
|||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Not supported, will throw exception.
|
||||
*/
|
||||
@Override
|
||||
public void remove() {
|
||||
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) {
|
||||
this(type, extensionPointId);
|
||||
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) {
|
||||
IConfigurationElement[] result = elementArray;
|
||||
TreeMap<Integer, List<IConfigurationElement>> elementMap = new TreeMap<Integer, List<IConfigurationElement>>();
|
||||
|
@ -169,14 +197,25 @@ public class ExtensionList<T> implements Iterable<T>{
|
|||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Iterator
|
||||
*/
|
||||
public Iterator<T> iterator() {
|
||||
return new ExtensionIterator<T>();
|
||||
}
|
||||
|
||||
/**
|
||||
* add filter for discovery of extensions
|
||||
* @param attribute
|
||||
* @param value
|
||||
*/
|
||||
public void addFilter(String attribute, String value) {
|
||||
filters.put(attribute, value);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return first matching extension
|
||||
*/
|
||||
public T first() {
|
||||
Iterator<T> i = iterator();
|
||||
if (!i.hasNext())
|
||||
|
@ -184,6 +223,9 @@ public class ExtensionList<T> implements Iterable<T>{
|
|||
return i.next();
|
||||
}
|
||||
|
||||
/**
|
||||
* @return list of matching extension
|
||||
*/
|
||||
public List<T> asList() {
|
||||
List<T> result = new ArrayList<T>();
|
||||
for (T t : this) {
|
||||
|
|
|
@ -25,7 +25,7 @@ import org.eclipse.core.runtime.Platform;
|
|||
import org.eclipse.osgi.service.datalocation.Location;
|
||||
|
||||
/**
|
||||
*
|
||||
* Load extension priority from extensions-priorty.properties
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -19,16 +19,15 @@ import org.eclipse.osgi.framework.console.CommandProvider;
|
|||
import org.eclipse.osgi.framework.console.CommandInterpreter;
|
||||
|
||||
/**
|
||||
* OSGi console command for printing of stack trace.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class StackTraceCommand implements CommandProvider {
|
||||
|
||||
/**
|
||||
*
|
||||
* default constructor
|
||||
*/
|
||||
public StackTraceCommand() {
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
|
||||
/* (non-Javadoc)
|
||||
|
|
|
@ -23,6 +23,7 @@ import org.osgi.service.event.Event;
|
|||
import org.osgi.service.event.EventHandler;
|
||||
|
||||
/**
|
||||
* Base class to help simplify implementation of OSGi {@link EventHandler}.
|
||||
* @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
|
||||
*/
|
||||
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();
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ import org.compiere.util.CLogger;
|
|||
import org.osgi.service.event.Event;
|
||||
|
||||
/**
|
||||
* Helper methods for event handler
|
||||
* Helper methods for {@link AbstractEventHandler}.
|
||||
* @author hengsin
|
||||
*/
|
||||
public final class EventHelper {
|
||||
|
@ -66,7 +66,6 @@ public final class EventHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <T>
|
||||
* @param event
|
||||
*/
|
||||
|
@ -75,7 +74,6 @@ public final class EventHelper {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param <T>
|
||||
* @param event
|
||||
* @param property
|
||||
|
|
|
@ -43,7 +43,7 @@ import org.osgi.service.event.EventConstants;
|
|||
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
|
||||
* @author hengsin
|
||||
*
|
||||
|
|
|
@ -15,14 +15,14 @@ package org.adempiere.base.event;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.adempiere.base.event.annotations.doc.FactsValidateDelegate;
|
||||
import org.compiere.acct.Fact;
|
||||
import org.compiere.model.MAcctSchema;
|
||||
import org.compiere.model.PO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Event data for {@link FactsValidateDelegate}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class FactsEventData implements POEventData {
|
||||
private MAcctSchema acctSchema;
|
||||
|
|
|
@ -18,9 +18,8 @@ import org.osgi.service.event.Event;
|
|||
import org.osgi.service.event.EventHandler;
|
||||
|
||||
/**
|
||||
*
|
||||
* Interface for global event manager
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IEventManager {
|
||||
|
||||
|
|
|
@ -14,9 +14,8 @@
|
|||
package org.adempiere.base.event;
|
||||
|
||||
/**
|
||||
*
|
||||
* Event topic constants
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public interface IEventTopics {
|
||||
|
||||
|
@ -91,7 +90,7 @@ public interface IEventTopics {
|
|||
|
||||
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 BROADCAST_MESSAGE = "idempiere/broadcastMsg";
|
||||
|
|
|
@ -13,13 +13,13 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.base.event;
|
||||
|
||||
import org.adempiere.base.event.annotations.imp.ImportEventDelegate;
|
||||
import org.adempiere.process.ImportProcess;
|
||||
import org.compiere.model.PO;
|
||||
|
||||
/**
|
||||
*
|
||||
* Event data for {@link ImportEventDelegate}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class ImportEventData {
|
||||
private ImportProcess importProcess;
|
||||
|
@ -46,14 +46,14 @@ public class ImportEventData {
|
|||
}
|
||||
|
||||
/**
|
||||
* @return the source
|
||||
* @return the source PO
|
||||
*/
|
||||
public PO getSource() {
|
||||
return source;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return the target
|
||||
* @return the target PO
|
||||
*/
|
||||
public PO getTarget() {
|
||||
return target;
|
||||
|
|
|
@ -13,10 +13,11 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.base.event;
|
||||
|
||||
import org.adempiere.base.event.annotations.AfterLoginEventDelegate;
|
||||
|
||||
/**
|
||||
*
|
||||
* Event data for {@link AfterLoginEventDelegate}.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class LoginEventData {
|
||||
private int AD_Client_ID;
|
||||
|
|
|
@ -33,6 +33,9 @@ package org.adempiere.base.event;
|
|||
|
||||
import org.compiere.model.PrintInfo;
|
||||
|
||||
/**
|
||||
* Event data for {@link IEventTopics#REPORT_SEND_EMAIL} event topic.
|
||||
*/
|
||||
public class ReportSendEMailEventData {
|
||||
|
||||
public static final String CONTEXT_EMAIL_TO = "_EMAIL_TO_";
|
||||
|
@ -49,10 +52,25 @@ public class ReportSendEMailEventData {
|
|||
private int m_recordId;
|
||||
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) {
|
||||
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) {
|
||||
m_windowNo = windowNo;
|
||||
m_tableId = tableId;
|
||||
|
@ -62,50 +80,86 @@ public class ReportSendEMailEventData {
|
|||
m_subject = subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return window number
|
||||
*/
|
||||
public int getWindowNo() {
|
||||
return m_windowNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param windowNo
|
||||
*/
|
||||
public void setWindowNo(int windowNo) {
|
||||
m_windowNo = windowNo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return AD_Table_ID
|
||||
*/
|
||||
public int getTableId() {
|
||||
return m_tableId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param tableId AD_Table_ID
|
||||
*/
|
||||
public void setTableId(int tableId) {
|
||||
m_tableId = tableId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return record id
|
||||
*/
|
||||
public int getRecordId() {
|
||||
return m_recordId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recordId
|
||||
*/
|
||||
public void setRecordId(int recordId) {
|
||||
m_recordId = recordId;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return record uuid
|
||||
*/
|
||||
public String getRecordUU() {
|
||||
return m_recordUU;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param recordUU record uuid
|
||||
*/
|
||||
public void setRecordUU(String recordUU) {
|
||||
m_recordUU = recordUU;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return PrintInfo
|
||||
*/
|
||||
public PrintInfo getFrom() {
|
||||
return m_printInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param printInfo
|
||||
*/
|
||||
public void setFrom(PrintInfo printInfo) {
|
||||
m_printInfo = printInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return subject
|
||||
*/
|
||||
public String getSubject() {
|
||||
return m_subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param subject
|
||||
*/
|
||||
public void setSubject(String subject) {
|
||||
m_subject = subject;
|
||||
}
|
||||
|
|
|
@ -46,7 +46,7 @@ import org.osgi.service.cm.ManagedService;
|
|||
import org.osgi.service.event.Event;
|
||||
|
||||
/**
|
||||
* Request event handler
|
||||
* Event handler for R_Request table and REQUEST_SEND_EMAIL event topic.
|
||||
* @author Nur Yasmin
|
||||
*
|
||||
*/
|
||||
|
@ -100,6 +100,12 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
|||
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)
|
||||
{
|
||||
// New
|
||||
|
@ -212,6 +218,12 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
|||
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)
|
||||
{
|
||||
// Initial Mail
|
||||
|
@ -222,10 +234,10 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
|||
}
|
||||
|
||||
/**
|
||||
* Check for changes
|
||||
* Process changes
|
||||
* @param ra request action
|
||||
* @param columnName column
|
||||
* @return true if changes
|
||||
* @return true if columnName has changes
|
||||
*/
|
||||
public boolean checkChange (MRequest r, MRequestAction ra, String columnName)
|
||||
{
|
||||
|
@ -395,10 +407,10 @@ public class RequestEventHandler extends AbstractEventHandler implements Managed
|
|||
}
|
||||
} // sendNotice
|
||||
|
||||
/**************************************************************************
|
||||
* Get MailID
|
||||
/**
|
||||
* Get mail trailer text
|
||||
* @param serverAddress server address
|
||||
* @return Mail Trailer
|
||||
* @return Mail trailer text
|
||||
*/
|
||||
private String getMailTrailer(MRequest r, String serverAddress)
|
||||
{
|
||||
|
|
|
@ -32,9 +32,9 @@ import org.osgi.service.cm.Configuration;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public class RequestPropertyService {
|
||||
|
||||
|
@ -42,17 +42,30 @@ public class RequestPropertyService {
|
|||
|
||||
private static final CLogger logger = CLogger.getCLogger(RequestPropertyService.class);
|
||||
|
||||
/**
|
||||
* Default constructor
|
||||
*/
|
||||
public RequestPropertyService() {
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configurationAdmin
|
||||
*/
|
||||
public void bindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
|
||||
readProperties(configurationAdmin);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param configurationAdmin
|
||||
*/
|
||||
public void unbindConfigurationAdmin(ConfigurationAdmin configurationAdmin) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Load request property from requesteventhandler.properties
|
||||
* @param service
|
||||
*/
|
||||
private void readProperties(ConfigurationAdmin service) {
|
||||
File file = new File(Ini.getAdempiereHome(), REQUESTEVENTHANDLER_PROPERTIES);
|
||||
if (file.exists()) {
|
||||
|
|
|
@ -20,9 +20,8 @@ import org.compiere.model.MClient;
|
|||
import org.compiere.model.MUser;
|
||||
|
||||
/**
|
||||
*
|
||||
* Event data for {@link IEventTopics#REQUEST_SEND_EMAIL} event topic.
|
||||
* @author Elaine
|
||||
*
|
||||
*/
|
||||
public class RequestSendEMailEventData
|
||||
{
|
||||
|
@ -35,10 +34,29 @@ public class RequestSendEMailEventData
|
|||
private int requestID;
|
||||
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) {
|
||||
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) {
|
||||
setClient(client);
|
||||
setFrom(from);
|
||||
|
@ -50,66 +68,114 @@ public class RequestSendEMailEventData
|
|||
setHtml(isHtml);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return MClient
|
||||
*/
|
||||
public MClient getClient() {
|
||||
return client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param client
|
||||
*/
|
||||
public void setClient(MClient client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return from user
|
||||
*/
|
||||
public MUser getFrom() {
|
||||
return from;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param from from user
|
||||
*/
|
||||
public void setFrom(MUser from) {
|
||||
this.from = from;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return to user
|
||||
*/
|
||||
public MUser getTo() {
|
||||
return to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param to to user
|
||||
*/
|
||||
public void setTo(MUser to) {
|
||||
this.to = to;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return subject
|
||||
*/
|
||||
public String getSubject() {
|
||||
return subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param subject
|
||||
*/
|
||||
public void setSubject(String subject) {
|
||||
this.subject = subject;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return message
|
||||
*/
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param message
|
||||
*/
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return attachment file
|
||||
*/
|
||||
public File getAttachment() {
|
||||
return attachment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param attachment
|
||||
*/
|
||||
public void setAttachment(File attachment) {
|
||||
this.attachment = attachment;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return R_Request_ID
|
||||
*/
|
||||
public int getRequestID() {
|
||||
return requestID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param requestID R_Request_ID
|
||||
*/
|
||||
public void setRequestID(int requestID) {
|
||||
this.requestID = requestID;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if message is html text
|
||||
*/
|
||||
public boolean isHtml() {
|
||||
return isHtml;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isHtml
|
||||
*/
|
||||
public void setHtml(boolean isHtml) {
|
||||
this.isHtml = isHtml;
|
||||
}
|
||||
|
|
|
@ -29,9 +29,10 @@ import org.adempiere.base.event.LoginEventData;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public abstract class AfterLoginEventDelegate extends EventDelegate {
|
||||
|
||||
|
|
|
@ -29,26 +29,26 @@ import java.lang.reflect.Method;
|
|||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.adempiere.base.annotation.EventTopicDelegate;
|
||||
import org.adempiere.base.event.EventHelper;
|
||||
import org.osgi.service.event.Event;
|
||||
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.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public abstract class BaseEventHandler implements EventHandler {
|
||||
|
||||
//event topic to method mapping
|
||||
/** event topic:method */
|
||||
protected final Map<String, Method> eventTopicMap = new HashMap<String, Method>();
|
||||
private String filter;
|
||||
private Class<? extends EventDelegate> delegateClass;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param 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
|
||||
*/
|
||||
protected void createTopicMap(Class<?> delegateClass) {
|
||||
|
@ -80,7 +80,6 @@ public abstract class BaseEventHandler implements EventHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return arrays of event topic
|
||||
*/
|
||||
public String[] getTopics() {
|
||||
|
@ -91,7 +90,6 @@ public abstract class BaseEventHandler implements EventHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return event filter
|
||||
*/
|
||||
public String getFilter() {
|
||||
|
@ -107,7 +105,6 @@ public abstract class BaseEventHandler implements EventHandler {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param propertyName
|
||||
* @param value
|
||||
*/
|
||||
|
@ -153,7 +150,7 @@ public abstract class BaseEventHandler implements EventHandler {
|
|||
/**
|
||||
* create new instance of event delegate
|
||||
* @param event
|
||||
* @return {@link EventDelegate}
|
||||
* @return new {@link EventDelegate} instance
|
||||
*/
|
||||
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}.
|
||||
* Subclass implementation doesn't have to be thread safe as event delegate is create and throw away for each event call.
|
||||
* 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.<br/>
|
||||
* Subclass should use {@link EventTopic} or one of its derived annotation to define the event topic to handle
|
||||
* @author hengsin
|
||||
*
|
||||
|
@ -39,7 +39,6 @@ public class EventDelegate {
|
|||
protected Event event;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param event
|
||||
*/
|
||||
public EventDelegate(Event event) {
|
||||
|
@ -47,7 +46,6 @@ public class EventDelegate {
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {@link Event}
|
||||
*/
|
||||
protected Event getEvent() {
|
||||
|
|
|
@ -28,8 +28,9 @@ import org.compiere.model.PO;
|
|||
import org.osgi.service.event.Event;
|
||||
|
||||
/**
|
||||
*
|
||||
* event delegate for PO related event (po_before_change, doc_before_complete, etc)
|
||||
* Event delegate for PO related event.<br/>
|
||||
* 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
|
||||
*
|
||||
* @param <T>
|
||||
|
@ -39,7 +40,6 @@ public class ModelEventDelegate<T extends PO> extends EventDelegate {
|
|||
private T model;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param po
|
||||
* @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() {
|
||||
return model;
|
||||
|
|
|
@ -34,11 +34,10 @@ import org.compiere.model.PO;
|
|||
import org.osgi.service.event.Event;
|
||||
|
||||
/**
|
||||
*
|
||||
* Event handler for PO related events (po_before_change, doc_before_complete, etc).
|
||||
* Delegate to {@link ModelEventDelegate} instance created for each event call
|
||||
* Event handler for PO related events. <br/>
|
||||
* Developers usually don't have to use this class directly; instead, the recommended approach is
|
||||
* to subclass {@link ModelEventDelegate} and use model event topic annotations.
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
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 delegateClass
|
||||
* @param supplier
|
||||
*/
|
||||
public ModelEventHandler(Class<T> modelClassType, Class<? extends ModelEventDelegate<T>> delegateClass,
|
||||
BiFunction<T, Event, ? extends ModelEventDelegate<T>> supplier) {
|
||||
|
@ -57,6 +58,9 @@ public final class ModelEventHandler<T extends PO> extends BaseEventHandler {
|
|||
findTableName();
|
||||
}
|
||||
|
||||
/**
|
||||
* Find table name property from annotation or static field (Table_Name).
|
||||
*/
|
||||
private void findTableName() {
|
||||
try {
|
||||
Model model = modelClassType.getSuperclass().getAnnotation(Model.class);
|
||||
|
|
|
@ -29,7 +29,8 @@ import org.adempiere.base.event.RequestSendEMailEventData;
|
|||
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
|
||||
*
|
||||
*/
|
||||
|
|
|
@ -29,8 +29,7 @@ import java.util.function.Function;
|
|||
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
|
||||
*
|
||||
*/
|
||||
|
@ -39,7 +38,6 @@ public final class SimpleEventHandler extends BaseEventHandler {
|
|||
private Function<Event, ? extends EventDelegate> supplier;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param delegateClass
|
||||
* @param supplier
|
||||
*/
|
||||
|
|
|
@ -31,14 +31,14 @@ import org.compiere.model.PO;
|
|||
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
|
||||
*
|
||||
*/
|
||||
public abstract class FactsValidateDelegate<T extends PO> extends ModelEventDelegate<T> {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param po
|
||||
* @param event
|
||||
*/
|
||||
|
@ -47,7 +47,6 @@ public abstract class FactsValidateDelegate<T extends PO> extends ModelEventDele
|
|||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @return {@link FactsEventData}
|
||||
*/
|
||||
protected FactsEventData getFactsEventData() {
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue