use of org.eclipse.emf.ecore.impl.EFactoryImpl in project tdq-studio-se by Talend.
the class ModelElementIndicatorImpl method createTempSpecialIndicatorUnit.
private IndicatorUnit createTempSpecialIndicatorUnit(IndicatorEnum indicatorEnum, Indicator indicator) {
Indicator tempIndicator = indicator;
if (tempIndicator == null) {
EFactoryImpl factory = (EFactoryImpl) indicatorEnum.getIndicatorType().getEPackage().getEFactoryInstance();
tempIndicator = (Indicator) factory.create(indicatorEnum.getIndicatorType());
// MOD scorreia 2008-09-18: bug 5131 fixed: set indicator's definition when the indicator is created.
if (!DefinitionHandler.getInstance().setDefaultIndicatorDefinition(tempIndicator)) {
// $NON-NLS-1$
log.error(DefaultMessagesImpl.getString("ModelElementIndicatorImpl_COULDNOTSETDEF_GIVEN_IND0") + tempIndicator.getName());
}
}
// }
if (this.specialIndicatorUnitList == null) {
this.specialIndicatorUnitList = new ArrayList<IndicatorUnit>();
}
for (IndicatorUnit currentUnit : tempSpecialIndicatorUnitList) {
if (tempIndicator.getName().equalsIgnoreCase(currentUnit.getIndicator().getName())) {
return currentUnit;
}
}
IndicatorUnit indicatorUnit = new ColumnIndicatorUnit(indicatorEnum, tempIndicator, this);
tempSpecialIndicatorUnitList.add(indicatorUnit);
this.specialIndicatorUnitMap.put(tempIndicator.getName(), indicatorUnit);
return indicatorUnit;
}
use of org.eclipse.emf.ecore.impl.EFactoryImpl in project tdq-studio-se by Talend.
the class ModelElementIndicatorImpl method createPlainIndicatorUnit.
/**
* Create a new IndicatorUnit according to indicatorEnum and indicator, if the parameter indicator is null, will
* create a new indicator .
*
* @param indicatorEnum
* @param indicator
* @return
*/
private IndicatorUnit createPlainIndicatorUnit(IndicatorEnum indicatorEnum, Indicator indicator) {
Indicator tempIndicator = indicator;
if (tempIndicator == null) {
EFactoryImpl factory = (EFactoryImpl) indicatorEnum.getIndicatorType().getEPackage().getEFactoryInstance();
tempIndicator = (Indicator) factory.create(indicatorEnum.getIndicatorType());
// MOD scorreia 2008-09-18: bug 5131 fixed: set indicator's definition when the indicator is created.
if (!DefinitionHandler.getInstance().setDefaultIndicatorDefinition(tempIndicator)) {
// $NON-NLS-1$
log.error("Could not set the definition of the given indicator :" + tempIndicator.getName());
}
// for 4225, the frequency indicator need be initialized
int sqlType = getJavaType();
if (tempIndicator instanceof FrequencyIndicator && Java2SqlType.isDateInSQL(sqlType)) {
IndicatorParameters parameters = tempIndicator.getParameters();
if (parameters == null) {
parameters = IndicatorsFactory.eINSTANCE.createIndicatorParameters();
tempIndicator.setParameters(parameters);
}
DateParameters dateParameters = parameters.getDateParameters();
// "Year Frequency Table" when applying on "Time" type
if (dateParameters == null && !(indicatorEnum == IndicatorEnum.PatternFreqIndicatorEnum || indicatorEnum == IndicatorEnum.PatternLowFreqIndicatorEnum || indicatorEnum == IndicatorEnum.FrequencyIndicatorEnum || indicatorEnum == IndicatorEnum.LowFrequencyIndicatorEnum)) {
dateParameters = IndicatorsFactory.eINSTANCE.createDateParameters();
parameters.setDateParameters(dateParameters);
}
// TDQ-5357~
// MOD scorreia 2008-06-19 default is already set in the model
// dateParameters.setDateAggregationType(DateGrain.YEAR);
}
}
IndicatorUnit indicatorUnit = new ColumnIndicatorUnit(indicatorEnum, tempIndicator, this);
this.plainIndicatorUnitMap.put(indicatorEnum, indicatorUnit);
return indicatorUnit;
}
use of org.eclipse.emf.ecore.impl.EFactoryImpl in project tdq-studio-se by Talend.
the class AbstractNode method createNewIndicatorInstance.
/*
* (non-Javadoc)
*
* @see org.talend.dq.nodes.indicator.IIndicatorNode#createNewIndicatorInstance()
*/
public Indicator createNewIndicatorInstance() {
EFactoryImpl factory = (EFactoryImpl) indicatorEnum.getIndicatorType().getEPackage().getEFactoryInstance();
Indicator indicatorInstance = (Indicator) factory.create(indicatorEnum.getIndicatorType());
// special Enum is can not handle the name of indicator
if (indicatorInstance.getName() == indicatorInstance.eClass().getName() && IndicatorEnum.isSpecialIndicatorEnum(indicatorEnum)) {
indicatorInstance.setName(this.getLabel());
}
DefinitionHandler.getInstance().setDefaultIndicatorDefinition(indicatorInstance);
return indicatorInstance;
}
use of org.eclipse.emf.ecore.impl.EFactoryImpl in project tdq-studio-se by Talend.
the class ModelElementIndicatorImpl method createSpecialIndicatorUnit.
private IndicatorUnit createSpecialIndicatorUnit(IndicatorEnum indicatorEnum, Indicator indicator) {
Indicator tempIndicator = indicator;
if (tempIndicator == null) {
EFactoryImpl factory = (EFactoryImpl) indicatorEnum.getIndicatorType().getEPackage().getEFactoryInstance();
tempIndicator = (Indicator) factory.create(indicatorEnum.getIndicatorType());
// MOD scorreia 2008-09-18: bug 5131 fixed: set indicator's definition when the indicator is created.
if (!DefinitionHandler.getInstance().setDefaultIndicatorDefinition(tempIndicator)) {
// $NON-NLS-1$
log.error(DefaultMessagesImpl.getString("ModelElementIndicatorImpl_COULDNOTSETDEF_GIVEN_IND0") + tempIndicator.getName());
}
}
// }
if (this.specialIndicatorUnitList == null) {
this.specialIndicatorUnitList = new ArrayList<IndicatorUnit>();
}
IndicatorUnit indicatorUnit = new ColumnIndicatorUnit(indicatorEnum, tempIndicator, this);
specialIndicatorUnitList.add(indicatorUnit);
this.specialIndicatorUnitMap.put(tempIndicator.getName(), indicatorUnit);
return indicatorUnit;
}
Aggregations