use of org.talend.repository.model.ItemVersionObject 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.repository.model.ItemVersionObject 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.repository.model.ItemVersionObject in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method refreshCheckedTreeView.
protected void refreshCheckedTreeView() {
List<RepositoryNode> nodes = new ArrayList<RepositoryNode>();
for (TableItem item : itemTable.getItems()) {
Object data = item.getData();
if (data instanceof ItemVersionObject) {
nodes.add(((ItemVersionObject) data).getRepositoryNode());
}
}
treeViewer.setCheckedElements(nodes.toArray());
// treeViewer.refresh();
}
use of org.talend.repository.model.ItemVersionObject in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method processItems.
protected void processItems(List<ItemVersionObject> objects, RepositoryNode node) {
if (node == null) {
return;
}
// if the root node of type is not init, force init.
IProjectRepositoryNode root = node.getRoot();
if (root instanceof ProjectRepositoryNode) {
((ProjectRepositoryNode) root).initNode(node);
}
if (node.getType() == ENodeType.REPOSITORY_ELEMENT) {
if (node.getObject() != null) {
Property property = node.getObject().getProperty();
Item item = property.getItem();
if (item != null && filterRepositoryNode(node)) {
// must be item
ItemVersionObject object = createItemVersionObject(node, property);
objects.add(object);
}
}
} else {
IContentProvider contentProvider = treeViewer.getContentProvider();
if (contentProvider instanceof NavigatorContentServiceContentProvider) {
NavigatorContentServiceContentProvider navigatorProvider = (NavigatorContentServiceContentProvider) contentProvider;
Object[] children = navigatorProvider.getChildren(node);
for (Object child : children) {
if (child instanceof RepositoryNode) {
processItems(objects, (RepositoryNode) child);
}
}
} else {
for (IRepositoryNode child : node.getChildren()) {
processItems(objects, (RepositoryNode) child);
}
}
}
}
use of org.talend.repository.model.ItemVersionObject in project tdi-studio-se by Talend.
the class AbstractVersionManagementProjectSettingPage method okPressed.
protected void okPressed() {
if (fixedVersionText == null) {
return;
}
boolean modified = false;
String newVersion = null;
for (ItemVersionObject object : checkedObjects) {
newVersion = getNewVersionWithOption(object);
if (!newVersion.equals(object.getOldVersion())) {
isApplied = false;
modified = true;
break;
}
}
if (modified) {
boolean confirm = false;
if (fixedVersionButton.getSelection()) {
confirm = //$NON-NLS-1$
MessageDialog.openConfirm(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.ConfirmTitle"), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.ConfirmMessage", newVersion));
if (confirm && newVersion != null) {
// set all items for new version
for (ItemVersionObject object : checkedObjects) {
object.setNewVersion(newVersion);
}
}
} else {
ItemsVersionConfirmDialog chanedDialog = new ItemsVersionConfirmDialog(getShell(), checkedObjects);
confirm = (chanedDialog.open() == Window.OK);
}
if (confirm) {
updateItemsVersion();
}
} else {
if (!checkedObjects.isEmpty() && !isApplied) {
//$NON-NLS-1$
MessageDialog.openWarning(//$NON-NLS-1$
getShell(), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.WarningTitle"), //$NON-NLS-1$
Messages.getString("VersionManagementDialog.WarningMessages"));
}
}
}
Aggregations