/** * Finds collection id in catalog object. * @param catalogObjId * @return collection id * @throws ACLProviderException */ protected String findCollectionTagInCatalog(YaddaObjectID catalogObjId) throws ACLProviderException { try { CatalogObjectMeta catalogMeta = catalogFacade.getObjectMetadata( catalogObjId); if (catalogMeta!=null) { for (String currentTag : catalogMeta.getTags()) { if (currentTag.startsWith(ACLConstants.COLLECTION_TAG_PREFIX)) { return currentTag; } } return null; } else { throw new ACLProviderException("couldn't find catalog object " + "for id: " + catalogObjId); } } catch (CatalogException e) { throw new ACLProviderException("exception occured when " + "finding catalog object for id: " + catalogObjId, e); } }
public List<EditorOperation> prepareRemoveFromCatalog(final List<String> toRemove) throws MetadataIndexException { try { final List<EditorOperation> operations = new ArrayList<EditorOperation>(); for (final String extId : toRemove) { final CatalogObjectMeta meta = catalogFacade.getObjectMetadata(new YaddaObjectID(extId)); if (!Arrays.asList(meta.getPartTypes()).contains(MetadataIndexConstants.T_REFMETA)) { continue; } final CatalogObject<String> object = catalogFacade.getObject(new YaddaObjectID(extId)); if (object == null) { continue; } log.debug("Prepare to remove {}", extId); operations.add(new SaveOperation<String>(object, new String[] { MetadataIndexConstants.T_REFMETA }, true)); operations.add(new TagOperation(object.getId(), new String[] {}, new String[] { MetadataIndexConstants.C_IMPORTED, MetadataIndexConstants.C_MATCHED })); } return operations; } catch (final CatalogException e) { throw new MetadataIndexException(e); } }
/** * Finds collection id in catalog object. * @param catalogObjId * @return collection id * @throws IndeterminateException */ protected String findCollectionTagInCatalog(String catalogObjId) throws IndeterminateException { try { CatalogObjectMeta catalogMeta = catalogFacade.getObjectMetadata( new YaddaObjectID(catalogObjId)); if (catalogMeta!=null) { for (String currentTag : catalogMeta.getTags()) { if (currentTag.startsWith(ACLConstants.COLLECTION_TAG_PREFIX)) { return currentTag; } } return null; } else { throw new IndeterminateException("couldn't find catalog object " + "for id: " + catalogObjId); } } catch (CatalogException e) { throw new IndeterminateException("exception occured when " + "finding catalog object for id: " + catalogObjId, e); } }
List<YExportable> entities = new ArrayList<YExportable>(); CatalogObjectMeta meta = catalogFacade.getObjectMetadata(new YaddaObjectID(id)); if (meta!=null) { CatalogObject<String> object = catalogFacade.getObject(meta.getId());
@Override protected void processElement(Element<CatalogObjectMeta> element) throws Exception { if (!element.getData().isHistorical()) { CatalogObjectMeta meta = targetCatalog.getObjectMetadata(new YaddaObjectID(element.getData().getId().getId())); ObjectHistory.Ancestor relation = resolveRelation(element.getData(), meta); if (relation == ObjectHistory.Ancestor.SAME || relation == ObjectHistory.Ancestor.MY_FIRST) { //Do nothing } else { ObjectHistory resolvedObject = new ObjectHistory(element.getData(), meta, relation); target.process(resolvedObject); } } }