use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AbstractAnalysisWizard method openEditor.
/*
* (non-Javadoc)
*
* @see org.talend.dataprofiler.core.ui.wizard.AbstractWizard#openEditor(org.talend.repository.model.IRepositoryNode)
*/
@Override
public void openEditor(IRepositoryNode repNode) {
String editorID = null;
AnalysisItemEditorInput analysisEditorInput = new AnalysisItemEditorInput(repNode);
IRepositoryNode connectionRepNode = getParameter().getConnectionRepNode();
analysisEditorInput.setConnectionNode(connectionRepNode);
// add support for match analysis editor
Analysis analysis = (Analysis) analysisEditorInput.getModel();
if (analysis.getParameters() != null && analysis.getParameters().getAnalysisType().equals(AnalysisType.MATCH_ANALYSIS)) {
editorID = MatchAnalysisEditor.class.getName();
} else {
editorID = AnalysisEditor.class.getName();
}
CorePlugin.getDefault().openEditor(analysisEditorInput, editorID);
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AbstractAnalysisWizard method createAndSaveCWMFile.
public TypedReturnCode<Object> createAndSaveCWMFile(ModelElement cwmElement) {
Analysis analysis = (Analysis) cwmElement;
IFolder folder = parameter.getFolderProvider().getFolderResource();
AnalysisWriter analysisWriter = ElementWriterFactory.getInstance().createAnalysisWrite();
return analysisWriter.create(analysis, folder);
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class ReportSubFolderRepNode method buildChildrenAnalysis.
/**
* build RepositoryNode(Analysis) children according to IResource array.
*
* @param analyses
* @return
*/
private List<IRepositoryNode> buildChildrenAnalysis(List<Analysis> analyses) {
List<IRepositoryNode> nodes = new ArrayList<IRepositoryNode>();
for (Analysis analysis : analyses) {
// MOD gdbu 2011-8-18 TDQ-3301
Property anaEleProperty = PropertyHelper.getProperty(analysis);
IRepositoryViewObject viewObject = null;
if (anaEleProperty != null) {
viewObject = new RepositoryViewObject(anaEleProperty);
} else {
// $NON-NLS-1$//$NON-NLS-2$
log.error("Analysis [" + analysis.getName() + "] is proxy");
}
if (null == viewObject) {
continue;
}
// ~TDQ-3301
ReportAnalysisRepNode node = new ReportAnalysisRepNode(viewObject, this, ENodeType.TDQ_REPOSITORY_ELEMENT, getProject());
node.setReport(this.getReport());
node.setId(this.getReport().getName() + analysis.getName());
nodes.add(node);
}
// MOD qiongli TDQ-4773,should clear outside the "if" conditon.
this.getReportSubFolderChildren().clear();
if (nodes.size() > 0) {
this.getReportSubFolderChildren().addAll(nodes);
}
return this.getReportSubFolderChildren();
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AnalysisSubFolderRepNode method getCount.
public String getCount() {
IRepositoryViewObject anaViewObject = this.getParent().getObject();
if (anaViewObject.getProperty() != null) {
TDQAnalysisItem item = (TDQAnalysisItem) anaViewObject.getProperty().getItem();
Analysis analysis = item.getAnalysis();
AnalysisContext context = analysis.getContext();
EList<ModelElement> analysedElements = context.getAnalysedElements();
if (analysedElements.size() == 1) {
ModelElement modelElement = analysedElements.get(0);
if (modelElement instanceof DatabaseConnection) {
EList<Package> dataPackage = ((DatabaseConnection) modelElement).getDataPackage();
// $NON-NLS-1$ //$NON-NLS-2$
return "(" + dataPackage.size() + ")";
}
}
// $NON-NLS-1$ //$NON-NLS-2$
return "(" + analysedElements.size() + ")";
}
// $NON-NLS-1$
return "(0)";
}
use of org.talend.dataquality.analysis.Analysis in project tdq-studio-se by Talend.
the class AnalysisWriter method removeDependencies.
/*
* (non-Javadoc)
*
* @see org.talend.dq.writer.AElementPersistance#removeDependencies(org.talend.core.model.properties.Item)
*/
@Override
protected ReturnCode removeDependencies(Item item) {
ReturnCode rc = new ReturnCode();
TDQAnalysisItem anaItem = (TDQAnalysisItem) item;
Analysis analysis = anaItem.getAnalysis();
List<Property> clintDependency = DependenciesHandler.getInstance().getClintDependency(anaItem.getProperty());
List<ModelElement> clientDepListByResultList = DependenciesHandler.getInstance().getClientDepListByResult(analysis);
for (Property currentClient : clintDependency) {
ModelElement modelElement = PropertyHelper.getModelElement(currentClient);
if (!clientDepListByResultList.contains(modelElement)) {
boolean isSuccess = DependenciesHandler.getInstance().removeDependenciesBetweenModel(analysis, modelElement);
if (isSuccess) {
try {
ProxyRepositoryFactory.getInstance().getRepositoryFactoryFromProvider().getResourceManager().saveResource(modelElement.eResource());
} catch (PersistenceException e) {
log.error(e, e);
rc.setOk(false);
rc.setMessage(e.getMessage());
}
} else {
rc.setOk(false);
rc.setMessage(// $NON-NLS-1$
Messages.getString(// $NON-NLS-1$
"AnalysisWriter.CanNotFindDependencyElement", // $NON-NLS-1$
analysis.getName(), modelElement.getName()));
}
}
}
return rc;
}
Aggregations