use of orgomg.cwm.objectmodel.core.Dependency in project tdq-studio-se by Talend.
the class ColumnCorrelationAnalysisHandler method addIndicator.
/**
* The resources that are connected to this analysis and that are potentially modified.
*/
// private Collection<Resource> modifiedResources = new HashSet<Resource>();
/**
* Method "addColumnToAnalyze".
*
* @param column
* @return
*/
public boolean addIndicator(List<TdColumn> columns, Indicator indicator) {
for (ModelElement tdColumn : columns) {
if (!analysis.getContext().getAnalysedElements().contains(tdColumn)) {
analysis.getContext().getAnalysedElements().add(tdColumn);
}
}
// store first level of indicators in result.
analysis.getResults().getIndicators().add(indicator);
initializeIndicator(indicator, columns);
DataManager connection = analysis.getContext().getConnection();
if (connection == null) {
// try to get one
for (ModelElement element : columns) {
TdColumn tdColumn = SwitchHelpers.COLUMN_SWITCH.doSwitch(element);
// $NON-NLS-1$
log.error(Messages.getString("ColumnCorrelationAnalysisHandler.CONNNOTBEENSETINANALYSIS"));
connection = ConnectionHelper.getTdDataProvider(tdColumn);
if (connection != null) {
analysis.getContext().setConnection(connection);
}
}
}
TypedReturnCode<Dependency> rc = DependenciesHandler.getInstance().setDependencyOn(analysis, connection);
return rc.isOk();
}
use of orgomg.cwm.objectmodel.core.Dependency in project tdq-studio-se by Talend.
the class TableAnalysisHandler method addIndicator.
public boolean addIndicator(NamedColumnSet set, Indicator... indicators) {
if (!analysis.getContext().getAnalysedElements().contains(set)) {
analysis.getContext().getAnalysedElements().add(set);
}
for (Indicator indicator : indicators) {
// store first level of indicators in result.
analysis.getResults().getIndicators().add(indicator);
initializeIndicator(indicator, set);
}
DataManager connection = analysis.getContext().getConnection();
if (connection == null) {
// try to get one
// $NON-NLS-1$
log.error(Messages.getString("ColumnCorrelationAnalysisHandler.CONNNOTBEENSETINANALYSIS"));
connection = ConnectionHelper.getTdDataProvider(PackageHelper.getParentPackage((MetadataTable) set));
analysis.getContext().setConnection(connection);
}
TypedReturnCode<Dependency> rc = DependenciesHandler.getInstance().setDependencyOn(analysis, connection);
return rc.isOk();
}
use of orgomg.cwm.objectmodel.core.Dependency in project tdq-studio-se by Talend.
the class DependenciesHandler method getSupplierDependency.
/**
* @param object
* @return SupplierDependency
*
* getSupplierDependency
*/
public List<IRepositoryViewObject> getSupplierDependency(IRepositoryViewObject object) {
List<IRepositoryViewObject> listViewObject = new ArrayList<IRepositoryViewObject>();
ModelElement modelElement = PropertyHelper.getModelElement(object.getProperty());
if (object.getProperty().getItem() instanceof TDQFileItem) {
return listViewObject;
}
if (modelElement instanceof IndicatorDefinition) {
listViewObject.addAll(getIndicatorDependency(object));
} else {
EList<Dependency> supplierDependency = modelElement.getSupplierDependency();
for (Dependency supplier : supplierDependency) {
for (ModelElement depencyModelElement : supplier.getClient()) {
if (depencyModelElement.eIsProxy()) {
// the depency ModelElement is proxy means it is not exist in current project, so need not to do
// anyting, just skip it
} else {
Property property = PropertyHelper.getProperty(depencyModelElement);
IRepositoryViewObject repositoryViewObject = new RepositoryViewObject(property);
listViewObject.add(repositoryViewObject);
}
}
}
}
return listViewObject;
}
use of orgomg.cwm.objectmodel.core.Dependency in project tdq-studio-se by Talend.
the class DependenciesHandler method removeDependenciesBetweenModels.
/**
* Method "removeDependenciesBetweenModels" is to be used before a model dependency(elementToRemove) removed from
* the elementFromRemove. The elementToRemove not truly to deleted, not a file to deleted, just remove the
* dependency between elementFromRemove and elementToRemove,
*
* @param elementFromRemove
* @param elementToRemove
* @return
*/
public List<Resource> removeDependenciesBetweenModels(ModelElement elementFromRemove, List<? extends ModelElement> elementToRemove) {
EList<Dependency> clientDependencies;
List<Resource> toRemoveResources = new ArrayList<Resource>();
for (ModelElement modelElement : elementToRemove) {
toRemoveResources.add(modelElement.eResource());
}
// get the client dependencies (
clientDependencies = elementFromRemove.getClientDependency();
// locate resource of each Dependency object
List<Resource> modifiedResources = new ArrayList<Resource>();
if (clientDependencies != null) {
Iterator<Dependency> dependencyIterator = clientDependencies.iterator();
while (dependencyIterator.hasNext()) {
Dependency dependency = dependencyIterator.next();
Resource dependencyResource = dependency.eResource();
if (!toRemoveResources.contains(dependencyResource)) {
continue;
}
if (dependencyResource != null) {
modifiedResources.add(dependencyResource);
dependencyIterator.remove();
}
}
}
return modifiedResources;
}
use of orgomg.cwm.objectmodel.core.Dependency in project tdq-studio-se by Talend.
the class DependenciesHandler method createUsageDependencyOn.
/**
* Method "createUsageDependencyOn".
*
* @param clientElement the analysis that depends on the data provider.
* @param dataManager the data provider
* @return a true return code if the dependency has been correctly added to the resource of the supplier element.
* Return false otherwise. In any case, the dependency is created and the getObject() method returns it.
*/
TypedReturnCode<Dependency> createUsageDependencyOn(ModelElement clientElement, ModelElement dataManager) {
assert dataManager != null;
Dependency dependency = createDependencyOn(USAGE, clientElement, dataManager);
TypedReturnCode<Dependency> rc = new TypedReturnCode<Dependency>();
rc.setObject(dependency);
return rc;
}
Aggregations