use of org.talend.core.model.properties.JobletDocumentationItem in project tdi-studio-se by Talend.
the class ImportItemWizardPage method populateItems.
/**
* DOC hcw Comment method "populateItems".
*/
private void populateItems() {
selectedItems.clear();
final Collection<ItemRecord> items = new ArrayList<ItemRecord>();
IRunnableWithProgress op = new IRunnableWithProgress() {
@Override
public void run(IProgressMonitor monitor) throws InvocationTargetException, InterruptedException {
repositoryUtil.clearAllData();
items.addAll(totalItemRecords = repositoryUtil.populateItems(manager, overwrite, monitor));
}
};
try {
new ProgressMonitorDialog(getShell()).run(true, true, op);
} catch (Exception e) {
// ignore me
}
errors.clear();
for (ItemRecord itemRecord : items) {
// bug 21738
if (itemRecord.getExistingItemWithSameId() != null && itemRecord.getExistingItemWithSameId() instanceof RepositoryViewObject) {
RepositoryViewObject reObject = (RepositoryViewObject) itemRecord.getExistingItemWithSameId();
if (itemRecord.getProperty() != null && reObject != null) {
if (itemRecord.getProperty().getId().equals(reObject.getId()) && itemRecord.getProperty().getLabel().equals(reObject.getLabel()) && itemRecord.getProperty().getVersion().equals(reObject.getVersion())) {
for (String error : itemRecord.getErrors()) {
//$NON-NLS-1$ //$NON-NLS-2$
errors.add("'" + itemRecord.getItemName() + "' " + error);
}
} else if (itemRecord.getProperty().getId().equals(reObject.getId()) && itemRecord.getProperty().getLabel().equals(reObject.getLabel()) && !itemRecord.getProperty().getVersion().equals(reObject.getVersion())) {
for (String error : itemRecord.getErrors()) {
//$NON-NLS-1$ //$NON-NLS-2$
errors.add("'" + itemRecord.getItemName() + "' " + Messages.getString("ImportItemWizardPage.ErrorsMessage", reObject.getVersion()));
}
} else {
// TDI-21399,TDI-21401
// if item is locked, cannot overwrite
ERepositoryStatus status = reObject.getRepositoryStatus();
if (status == ERepositoryStatus.LOCK_BY_OTHER || status == ERepositoryStatus.LOCK_BY_USER) {
for (String error : itemRecord.getErrors()) {
//$NON-NLS-1$ //$NON-NLS-2$
errors.add("'" + itemRecord.getItemName() + "' " + error);
}
}
}
}
} else {
if (itemRecord.getProperty() != null) {
Item item = itemRecord.getProperty().getItem();
if (item != null && (item instanceof JobDocumentationItem || item instanceof JobletDocumentationItem)) {
continue;
}
for (String error : itemRecord.getErrors()) {
//$NON-NLS-1$ //$NON-NLS-2$
errors.add("'" + itemRecord.getItemName() + "' " + error);
}
}
}
}
if (errorsList != null) {
errorsList.refresh();
}
selectedItems.addAll(items);
checkTreeViewer.refresh(true);
checkTreeViewer.expandAll();
filteredCheckboxTree.resetCheckedElements();
checkValidItems();
updateFinishStatus();
// see feature 0004170: Unselect all items to import
// itemsList.setCheckedElements(checkValidItems());
}
Aggregations