use of org.talend.core.repository.model.ItemReferenceBean in project tesb-studio-se by Talend.
the class CheckRouteResourceDeleteReference method collect.
private Collection<ItemReferenceBean> collect(IProxyRepositoryFactory factory, IRepositoryViewObject object, ERepositoryObjectType type) {
final Item nodeItem = object.getProperty().getItem();
final Set<ItemReferenceBean> list = new HashSet<ItemReferenceBean>();
try {
for (IRepositoryViewObject obj : factory.getAll(type)) {
final Property property = obj.getProperty();
final Item routeItem = property.getItem();
for (ResourceDependencyModel model : RouteResourceUtil.getResourceDependencies((ProcessItem) routeItem)) {
if (nodeItem.getProperty().getId().equals(model.getItem().getProperty().getId())) {
final ItemReferenceBean bean = new ItemReferenceBean();
bean.setItemName(object.getProperty().getLabel());
bean.setItemVersion(model.getSelectedVersion());
bean.setItemType(CamelRepositoryNodeType.repositoryRouteResourceType);
bean.setItemDeleted(object.isDeleted());
bean.setReferenceItemName(property.getLabel());
bean.setReferenceItemVersion(property.getVersion());
bean.setReferenceItemType(type);
bean.setReferenceItemPath(routeItem.getState().getPath());
bean.setReferenceProjectName(obj.getProjectLabel());
bean.setReferenceItemDeleted(obj.isDeleted());
if (!list.add(bean)) {
for (ItemReferenceBean b : list) {
if (b.equals(bean)) {
b.addNodeNum();
break;
}
}
}
}
}
}
} catch (PersistenceException e) {
ExceptionHandler.process(e);
}
return list;
}
Aggregations