use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class IndicatorSelectDialog method updateIndicatorInfo.
public void updateIndicatorInfo(GridItem item) {
// $NON-NLS-1$
String DESCRIPTION = DefaultMessagesImpl.getString("IndicatorSelectDialog.description");
// $NON-NLS-1$
String PURPOSE = DefaultMessagesImpl.getString("IndicatorSelectDialog.purpose");
IIndicatorNode indicatorNode = ((IIndicatorNode) item.getData());
if (indicatorNode != null) {
Indicator indicator = indicatorNode.getIndicatorInstance();
if (indicator != null) {
IndicatorDefinition indicatorDefinition = indicator.getIndicatorDefinition();
if ("".equals(MetadataHelper.getPurpose(indicatorDefinition))) {
purposeLabel.setText(PURPOSE + " " + indicator.getName());
} else {
purposeLabel.setText(PURPOSE + " " + MetadataHelper.getPurpose(indicatorDefinition));
}
String description = DESCRIPTION + " " + MetadataHelper.getDescription(indicatorDefinition);
descriptionLabel.setText(description);
return;
}
}
purposeLabel.setText(PURPOSE + " " + item.getText());
descriptionLabel.setText(DESCRIPTION + " " + item.getText());
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class IndicatorDefinitionWriter method checkNameUpdate.
/**
* when the udi name is changed, it will be losted in the indicator selection dialog. so need to reload(TDQ-14249)
*
* @param oldName
* @param item
*/
private void checkNameUpdate(String oldName, Item item) {
String newName = item.getProperty().getLabel();
if (!StringUtils.equals(newName, oldName)) {
IndicatorDefinition oldIndicatorDefinition = DefinitionHandler.getInstance().getIndicatorDefinition(oldName);
IndicatorDefinition newIndicatorDefinition = DefinitionHandler.getInstance().getIndicatorDefinition(newName);
if (newIndicatorDefinition == null && oldIndicatorDefinition != null) {
DefinitionHandler.getInstance().reloadAllUDIs();
}
}
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class IndicatorDefinitionWriter method updateDependencies.
/*
* (non-Javadoc)
*
* @see org.talend.dq.writer.AElementPersistance#updateDependencies(orgomg.cwm.objectmodel.core.ModelElement)
*/
// @Override
protected void updateDependencies(ModelElement element) {
// update client dependency
// if IndicatorDefinition have client depencency, add codes here
IndicatorDefinition definition = (IndicatorDefinition) element;
Property property = PropertyHelper.getProperty(definition);
List<IRepositoryViewObject> listIndicatorDependency = DependenciesHandler.getInstance().getIndicatorDependency(new RepositoryViewObject(property));
for (IRepositoryViewObject viewObject : listIndicatorDependency) {
Item item = viewObject.getProperty().getItem();
if (item instanceof TDQAnalysisItem) {
try {
ProxyRepositoryFactory.getInstance().save(item);
} catch (PersistenceException e) {
log.error(e, e);
}
}
}
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class IndicatorDefinitionWriter method save.
@Override
public ReturnCode save(final Item item, final boolean careDependency) {
ReturnCode rc = new ReturnCode();
RepositoryWorkUnit<Object> repositoryWorkUnit = new // $NON-NLS-1$
RepositoryWorkUnit<Object>(// $NON-NLS-1$
"save Indicator Definition item") {
@Override
protected void run() throws LoginException, PersistenceException {
TDQIndicatorDefinitionItem indicatorItem = (TDQIndicatorDefinitionItem) item;
IndicatorDefinition indiDefinition = indicatorItem.getIndicatorDefinition();
String oldName = indiDefinition.getLabel();
indiDefinition.setLabel(indiDefinition.getName());
// MOD yyi 2012-02-07 TDQ-4621:Update dependencies when careDependency is true.
if (careDependency) {
saveWithDependencies(indicatorItem, indiDefinition);
} else {
saveWithoutDependencies(indicatorItem, indiDefinition);
}
updateDependencies(indiDefinition);
checkNameUpdate(oldName, item);
}
};
repositoryWorkUnit.setAvoidUnloadResources(true);
ProxyRepositoryFactory.getInstance().executeRepositoryWorkUnit(repositoryWorkUnit);
try {
repositoryWorkUnit.throwPersistenceExceptionIfAny();
} catch (PersistenceException e) {
log.error(e, e);
rc.setOk(Boolean.FALSE);
rc.setMessage(e.getMessage());
}
return rc;
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class DQRuleUtilities method createIndicatorUnit.
/**
* DOC xqliu Comment method "createIndicatorUnit".
*
* @param fe
* @param tableIndicator
* @param analysis
* @return
*/
public static TableIndicatorUnit createIndicatorUnit(RuleRepNode ruleRepNode, TableIndicator tableIndicator, Analysis analysis) {
IndicatorDefinition whereRule = ruleRepNode.getRule();
for (Indicator indicator : tableIndicator.getIndicators()) {
if (whereRule.getName().equals(indicator.getName())) {
return null;
}
}
WhereRuleIndicator[] compositeWhereRuleIndicator = createCompositeWhereRuleIndicator(tableIndicator.getColumnSet(), whereRule);
IndicatorEnum type = IndicatorEnum.findIndicatorEnum(compositeWhereRuleIndicator[0].eClass());
TableIndicatorUnit addIndicatorUnit = tableIndicator.addSpecialIndicator(whereRule, type, compositeWhereRuleIndicator[0]);
DependenciesHandler.getInstance().setUsageDependencyOn(analysis, whereRule);
return addIndicatorUnit;
}
Aggregations