use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class UDIUtils method createUdiCheckedTreeSelectionDialog.
/**
* DOC xqliu Comment method "createUdiCheckedTreeSelectionDialog".
*
* @param meIndicator
* @return
*/
public static CheckedTreeSelectionDialog createUdiCheckedTreeSelectionDialog(ModelElementIndicator meIndicator) {
CheckedTreeSelectionDialog dialog = new CheckedTreeSelectionDialog(null, new DQRepositoryViewLabelProvider(), new ResourceViewContentProvider());
dialog.addFilter(new FolderObjFilter());
DQRepositoryNode udiDialogInputData = AnalysisUtils.getSelectDialogInputData(EResourceConstant.USER_DEFINED_INDICATORS);
dialog.setInput(udiDialogInputData);
dialog.setValidator(new ISelectionStatusValidator() {
public IStatus validate(Object[] selection) {
for (Object patte : selection) {
if (patte instanceof SysIndicatorDefinitionRepNode) {
SysIndicatorDefinitionRepNode udiNode = (SysIndicatorDefinitionRepNode) patte;
IndicatorDefinition indicatorDefinition = udiNode.getIndicatorDefinition();
boolean validStatus = TaggedValueHelper.getValidStatus(indicatorDefinition);
if (!validStatus) {
return new Status(IStatus.ERROR, CorePlugin.PLUGIN_ID, DefaultMessagesImpl.getString(// $NON-NLS-1$
"AnalysisColumnTreeViewer.chooseValidUdis"));
}
}
}
return new // $NON-NLS-1$
Status(// $NON-NLS-1$
IStatus.OK, // $NON-NLS-1$
PlatformUI.PLUGIN_ID, // $NON-NLS-1$
IStatus.OK, // $NON-NLS-1$
"", null);
}
});
dialog.setContainerMode(true);
dialog.setInitialSelections(getUDIFilesByIndicator(udiDialogInputData, meIndicator));
// $NON-NLS-1$
dialog.setTitle(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udiSelector"));
// $NON-NLS-1$
dialog.setMessage(DefaultMessagesImpl.getString("AnalysisColumnTreeViewer.udis"));
dialog.setSize(80, 30);
return dialog;
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class FileSystemImportWriter method checkDependency.
/**
* DOC bZhou Comment method "checkDependency".
*
* @param record
*/
private void checkDependency(ItemRecord record) {
for (File depFile : record.getDependencySet()) {
ModelElement melement = ItemRecord.getElement(depFile);
if (melement != null && melement.eIsProxy()) {
// TDQ-12410: if the dependency comes from reference project, we ingore it.
if (!DqFileUtils.isFileUnderBasePath(depFile, getBasePath())) {
continue;
}
// Indicator, don't add it into errors even if it is not exist
if (melement instanceof IndicatorDefinition) {
String uuid = ResourceHelper.getUUID(melement);
if (IndicatorDefinitionFileHelper.isTechnialIndicator(uuid)) {
continue;
}
}
InternalEObject inObject = (InternalEObject) melement;
// $NON-NLS-1$ //$NON-NLS-2$
record.addError("\"" + record.getName() + "\" missing dependented file : " + inObject.eProxyURI().toFileString());
}
}
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class ImportWizardPage method getElements.
/**
* DOC bZhou Comment method "getElements".
*
* @return
*/
public ItemRecord[] getElements() {
List<ItemRecord> itemRecords = new ArrayList<ItemRecord>();
Object[] checkedElements = repositoryTree.getCheckedElements();
for (Object obj : checkedElements) {
if (obj instanceof ItemRecord) {
ItemRecord record = (ItemRecord) obj;
// MOD qiongli 2012-4-20,add related subreport jrxml/jasper file to elements.
File file = record.getFile();
if (file.isFile()) {
itemRecords.add(record);
if (file.getName().endsWith(FactoriesUtil.JRXML)) {
addSubRepToElements(record, itemRecords);
}
// if it is Mean Indicator, import it's dependency Sum Indicator also
// $NON-NLS-1$
String meanIndicatorUuid = "_ccI48RF2Ed2PKb6nEJEvhw";
ModelElement element = record.getElement();
if (element != null && element instanceof IndicatorDefinition && meanIndicatorUuid.equals(ResourceHelper.getUUID(element))) {
File sumIndicatorFile = getSumIndicatorFile(element);
if (sumIndicatorFile != null) {
itemRecords.add(new ItemRecord(sumIndicatorFile, record.getRootFolderPath()));
}
}
}
}
}
return itemRecords.toArray(new ItemRecord[itemRecords.size()]);
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class UDIHelperTest method testContainsJavaUDI1.
/**
* Test method for
* {@link org.talend.dq.helper.UDIHelper#containsJavaUDI(org.talend.dataquality.indicators.definition.IndicatorDefinition)}
* .
*/
@Test
public void testContainsJavaUDI1() {
// prepare data
IndicatorDefinition javaIndicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
// $NON-NLS-1$
TaggedValue calssNameTaggedValue = TaggedValueHelper.createTaggedValue(TaggedValueHelper.CLASS_NAME_TEXT, "calssName");
// $NON-NLS-1$
TaggedValue jarPathTaggedValue = TaggedValueHelper.createTaggedValue(TaggedValueHelper.CLASS_NAME_TEXT, "jarPath");
javaIndicatorDefinition.getTaggedValue().add(calssNameTaggedValue);
javaIndicatorDefinition.getTaggedValue().add(jarPathTaggedValue);
// testMethod
assertTrue(UDIHelper.containsJavaUDI(javaIndicatorDefinition));
}
use of org.talend.dataquality.indicators.definition.IndicatorDefinition in project tdq-studio-se by Talend.
the class UDIHelperTest method testContainsJavaUDI2.
/**
* Test method for
* {@link org.talend.dq.helper.UDIHelper#containsJavaUDI(org.talend.dataquality.indicators.definition.IndicatorDefinition)}
* .
*/
@Test
public void testContainsJavaUDI2() {
// prepare data
IndicatorDefinition javaIndicatorDefinition = DefinitionFactory.eINSTANCE.createIndicatorDefinition();
// $NON-NLS-1$
TaggedValue calssNameTaggedValue = TaggedValueHelper.createTaggedValue(TaggedValueHelper.CLASS_NAME_TEXT, "calssName");
javaIndicatorDefinition.getTaggedValue().add(calssNameTaggedValue);
// testMethod
assertFalse(UDIHelper.containsJavaUDI(javaIndicatorDefinition));
}
Aggregations