Compare commits

...

3 Commits

View File

@@ -51,6 +51,7 @@ import org.talend.designer.core.model.utils.emf.talendfile.NodeType;
import org.talend.designer.core.model.utils.emf.talendfile.ProcessType;
import org.talend.repository.ProjectManager;
import org.talend.repository.model.IProxyRepositoryFactory;
import org.talend.repository.model.IRepositoryNode;
/**
* This class store all relationships between jobs/joblets and other items from the repository. Be sure to update the
@@ -493,7 +494,7 @@ public class RelationshipItemBuilder {
}
private Set<Relation> getItemsRelatedTo(Map<Relation, Set<Relation>> itemsRelations, String itemId, String version,
String relationType) {
String relationType) {
Relation itemToTest = new Relation();
itemId = ProcessUtils.getPureItemId(itemId);
@@ -929,7 +930,10 @@ public class RelationshipItemBuilder {
}
}
private void addRelationShip(Item baseItem, String relatedId, String relatedVersion, String type) {
public void addRelationShip(Item baseItem, String relatedId, String relatedVersion, String type) {
if (!loaded) {
loadRelations();
}
Relation relation = new Relation();
relation.setId(baseItem.getProperty().getId());
relation.setType(getTypeFromItem(baseItem));
@@ -945,8 +949,32 @@ public class RelationshipItemBuilder {
itemRelations.put(relation, new HashSet<Relation>());
}
itemRelations.get(relation).add(addedRelation);
autoSaveRelations();
}
public Set<Relation> getBeanRelations(Collection<Item> items) {
Set<Relation> relationships = new HashSet<Relation>();
for (Item item : items) {
Relation relation = new Relation();
relation.setId(item.getProperty().getId());
relation.setType(getTypeFromItem(item));
relation.setVersion(item.getProperty().getVersion());
Map<Relation, Set<Relation>> itemRelations = getRelatedRelations(item);
Set<Relation> repositoryNode = (Set<Relation>) itemRelations.get(relation);
for (Relation rel : repositoryNode) {
if (rel.getType().equals("Beans")) {
relationships.add(rel);
}
}
}
return relationships;
}
private Map<Relation, Set<Relation>> getRelatedRelations(Item baseItem) {
Map<Relation, Set<Relation>> itemRelations = currentProjectItemsRelations;
if (!ProjectManager.getInstance().isInMainProject(getAimProject(), baseItem)) {
@@ -1022,7 +1050,7 @@ public class RelationshipItemBuilder {
ExceptionHandler.process(e);
}
}
private List<ERepositoryObjectType> allSupportedTypes() {
List<ERepositoryObjectType> toReturn = new ArrayList<ERepositoryObjectType>();
toReturn.addAll(ERepositoryObjectType.getAllTypesOfProcess());
@@ -1494,4 +1522,5 @@ public class RelationshipItemBuilder {
return 0;
}
}
}