use of org.talend.core.model.relationship.Relation in project tdi-studio-se by Talend.
the class GenericUpdateManager method updateGenericConnection.
public static boolean updateGenericConnection(ConnectionItem connectionItem, List<IMetadataTable> oldMetadataTable, boolean show, final boolean onlySimpleShow) {
List<Relation> relations = RelationshipItemBuilder.getInstance().getItemsRelatedTo(connectionItem.getProperty().getId(), RelationshipItemBuilder.LATEST_VERSION, RelationshipItemBuilder.PROPERTY_RELATION);
RepositoryUpdateManager repositoryUpdateManager = new GenericUpdateManager(connectionItem, oldMetadataTable, relations);
return repositoryUpdateManager.doWork(true, false);
}
use of org.talend.core.model.relationship.Relation in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method selectSubjob.
protected void selectSubjob() {
List<ItemVersionObject> jobList = new ArrayList<ItemVersionObject>();
for (ItemVersionObject object : checkedObjects) {
if (MavenVersionUtils.isHasSubjobType(ERepositoryObjectType.getItemType(object.getItem()))) {
jobList.add(object);
}
}
for (ItemVersionObject object : jobList) {
if (object.getRepositoryNode() != null) {
List<Relation> relations = builder.getItemsJobRelatedTo(object.getRepositoryNode().getId(), object.getItem().getProperty().getVersion(), RelationshipItemBuilder.JOB_RELATION);
for (Relation relation : relations) {
try {
IRepositoryViewObject obj = FACTORY.getLastVersion(relation.getId());
if (obj != null) {
for (ItemVersionObject obj2 : versionObjects) {
if (obj2.getItem() == obj.getProperty().getItem()) {
ItemVersionObject relat = obj2;
if (!checkedObjects.contains(relat)) {
checkedObjects.add(relat);
checkAllVerSionLatest(checkedObjects, relat);
}
break;
}
}
}
} catch (PersistenceException et) {
ExceptionHandler.process(et);
}
}
}
}
refreshTableItems();
refreshCheckedTreeView();
}
use of org.talend.core.model.relationship.Relation in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method checkAllVerSionLatest.
protected void checkAllVerSionLatest(List<ItemVersionObject> tableList, ItemVersionObject object) {
if (object.getRepositoryNode() != null) {
List<Relation> relations = builder.getItemsJobRelatedTo(object.getRepositoryNode().getId(), object.getItem().getProperty().getVersion(), RelationshipItemBuilder.JOB_RELATION);
for (Relation relation : relations) {
try {
IRepositoryViewObject obj = FACTORY.getLastVersion(relation.getId());
if (obj != null) {
for (ItemVersionObject obj2 : versionObjects) {
if (obj2.getItem() == obj.getProperty().getItem()) {
ItemVersionObject relat = obj2;
if (!tableList.contains(relat)) {
tableList.add(relat);
checkAllVerSionLatest(tableList, relat);
}
break;
}
}
}
} catch (PersistenceException et) {
ExceptionHandler.process(et);
}
}
}
}
use of org.talend.core.model.relationship.Relation in project tdi-studio-se by Talend.
the class SQLPatternComposite method getAllSqlPatterns.
private List<SQLPatternInfor> getAllSqlPatterns(List<Map> tableInput, boolean modifySQL) {
IElementParameter elementParam = element.getElementParameter(EParameterName.SQLPATTERN_DB_NAME.getName());
if (elementParam == null) {
return Collections.EMPTY_LIST;
}
// String dbName = (String) elementParam.getValue();
List<SQLPatternInfor> patternInfor = new ArrayList<SQLPatternInfor>();
try {
List<IRepositoryViewObject> list = null;
if (isItemIndexChecked() && modifySQL) {
List<Relation> relations = new ArrayList<Relation>();
IProxyRepositoryFactory factory = CorePlugin.getDefault().getProxyRepositoryFactory();
List<IRepositoryViewObject> updateList = new ArrayList<IRepositoryViewObject>();
for (Map map : tableInput) {
String id = (String) map.get(SQLPatternUtils.SQLPATTERNLIST);
relations.addAll(RelationshipItemBuilder.getInstance().getItemsRelatedTo(id, ItemCacheManager.LATEST_VERSION, RelationshipItemBuilder.SQLPATTERN_RELATION));
}
for (Relation relation : relations) {
try {
IRepositoryViewObject obj = factory.getLastVersion(relation.getId());
if (obj != null) {
updateList.add(obj);
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
}
list = updateList;
} else {
list = DesignerPlugin.getDefault().getRepositoryService().getProxyRepositoryFactory().getAll(ERepositoryObjectType.SQLPATTERNS, false);
// add reference sql pattern
addReferencedSQLTemplate(list, ProjectManager.getInstance().getCurrentProject());
}
for (IRepositoryViewObject repositoryObject : list) {
Item item = repositoryObject.getProperty().getItem();
if (item instanceof SQLPatternItem) {
SQLPatternItem sqlitem = (SQLPatternItem) repositoryObject.getProperty().getItem();
// disable this test as there is now only Generic ELT components
// if (item.getEltName().equals(dbName)) {
patternInfor.add(new SQLPatternInfor(sqlitem.getProperty().getId() + SQLPatternUtils.ID_SEPARATOR + sqlitem.getProperty().getLabel(), sqlitem.getProperty().getLabel()));
// }
}
}
} catch (Exception e) {
ExceptionHandler.process(e);
}
return patternInfor;
}
use of org.talend.core.model.relationship.Relation in project tdi-studio-se by Talend.
the class VersionManagementPage method versionLatest.
private void versionLatest() {
List<ItemVersionObject> tableList = new ArrayList<ItemVersionObject>();
tableList.addAll(checkedObjects);
for (ItemVersionObject object : checkedObjects) {
if (object.getRepositoryNode() != null) {
List<Relation> relations = builder.getItemsJobRelatedTo(object.getRepositoryNode().getId(), object.getOldVersion(), RelationshipItemBuilder.JOB_RELATION);
for (Relation relation : relations) {
try {
IRepositoryViewObject obj = FACTORY.getLastVersion(relation.getId());
if (obj != null) {
for (ItemVersionObject obj2 : versionObjects) {
if (obj2.getItem() == obj.getProperty().getItem()) {
ItemVersionObject relat = obj2;
if (!tableList.contains(relat)) {
tableList.add(relat);
checkAllVerSionLatest(tableList, relat);
}
break;
}
}
}
} catch (PersistenceException et) {
ExceptionHandler.process(et);
}
}
}
}
removeItemElements(checkedObjects);
checkedObjects.clear();
checkedObjects.addAll(tableList);
refreshTableItems();
refreshCheckedTreeView();
}
Aggregations