private ModelAndView showElementInfo(String elementId, String partId, String format) { Map<String, Object> model = new HashMap<String, Object>(); try { CatalogObject<String> object = catalogFacade .getObject(new YaddaObjectID(elementId, null, null)); model.put("objectData", object); if (object != null && StringUtils.isNotBlank(partId)) { CatalogObjectPart<String> part = catalogFacade.getPart( object.getId(), partId, null); if (part != null && part.getData() != null) { model.put("partId", part.getType()); model.put("part", part.getData()); } else { model.put("part", ""); } } } catch (CatalogException e) { throw new SystemException(Modules.CATALOG, e.getMessage(), e); } ModelAndView mdv; if (format != null && format.equals("raw")) { mdv = new ModelAndView(rawView, "catalog", model); } else { mdv = new ModelAndView(catalogView, "catalog", model); } return mdv; }
public CatalogBwmetaIterator(ICatalogFacade<String> catalogFacade, Date from, Date to, String collection) throws CatalogException { this.catalogFacade = catalogFacade; String[] tags = null; if (collection!=null) { tags = new String[] { CatalogParamConstants.TAG_COLLECTION_PREFIX+collection }; } metaIterator = catalogFacade.iterateObjects(BWMETA_TYPE, from, to, tags, false); }
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); } }
/** * Initializes memory copy of roles directory * @throws CatalogException */ protected void fetchRoles() throws CatalogException { List<CatalogObjectMeta> roleObjects = catalogFacade.listObjects(new String[]{PART_TYPE_ROLE}, null, null, null, false); for (CatalogObjectMeta item : roleObjects) { if (!item.getStatus().isDeleted()) { CatalogObjectPart<String> part = catalogFacade.getPart(item.getId(), PART_TYPE_ROLE, null); Role role = (Role)serializer.toObject(item.getId().getId(), part.getData()); roles.put(role.getExtId(), role); } } }
protected Date fetchDirtyObject() throws Exception { CatalogObject<String> dirtyObject = catalogFacade.getObject(new YaddaObjectID(DIRTY_DATA_OBJECT_ID)); if (dirtyObject != null && dirtyObject.getPart(DIRTY_DATA_PART_NAME) != null) { return ISODateTimeFormat.dateTimeParser().parseDateTime(dirtyObject.getPart(DIRTY_DATA_PART_NAME).getData()).toDate(); } else { return null; } }
public void showElementPart(String id, String partType) { try { CatalogObjectPart<String> part = catalogFacade.getPart(new YaddaObjectID(id), partType, null); if (part == null) { os.println("Part doesn't exist"); } else { os.println(part.getData()); } } catch (CatalogException e) { e.printStackTrace(os); } }
if (typedCtxPathDTO.isExtId()) { CatalogObjectPart<String> catalogObjectPart = catalogFacade.getPart( new YaddaObjectID(typedCtxPathDTO.getField()), typedCtxPathDTO.getType(), null); Iterator<CatalogObjectMeta> it = catalogFacade.findObjects(spec); List<String> foundResults = new ArrayList<String>(); while (it.hasNext()) { CatalogObjectPart<String> catalogObjectPart = null; if (meta.getId()!=null && meta.getId().getId()!=null) { catalogObjectPart = catalogFacade.getPart( new YaddaObjectID(meta.getId().getId()), typedCtxPathDTO.getType(), null);
long startTime = System.currentTimeMillis(); try { comIt = catalogFacade.iterateObjects(catalogFacade.types(), ti.lastElDate, ti.dUntil, null, true); } catch (CatalogException e) { log.error(e.getMessage(), e);
/** * 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); } }
IEditorFacade<?> ef = (IEditorFacade<?>) getBean(bf, CommonContextHelper.BEAN_EDITOR_FACADE, "EditorFacade"); CountingIterator<CatalogObjectMeta> it = cf.findObjects(new MatchCriteria().until(cleanBefore).tags(tag)); int elementsToClean=0; while (it.hasNext()) {
nextObject = catalogFacade.getObject(meta.getId()); } catch (CatalogException e) { throw new RuntimeException("CatalogException while retrieving next bwmeta from catalog", e);
elementId = request.getParameter("id"); CatalogObjectPart<String> part = catalogFacade.getPart( new YaddaObjectID(elementId), partName, null);
/** * Initializes memory copy of users directory */ protected void fetchUsers() throws CatalogException { List<CatalogObjectMeta> userObjects = catalogFacade.listObjects(new String[]{PART_TYPE_USER}, null, null, null, false); for (CatalogObjectMeta item : userObjects) { if (!item.getStatus().isDeleted()) { CatalogObjectPart<String> part = catalogFacade.getPart(item.getId(), PART_TYPE_USER, null); User user = (User)serializer.toObject(item.getId().getId(), part.getData()); usersByLogin.put(user.getLogin(), user); usersById.put(user.getExtId(), user); } } }
/** * 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); } }
private void findObject(Identified ified) { DuplicatesPackPreprocessorStats localStats = (DuplicatesPackPreprocessorStats) stats; if (ified instanceof Element) { if (!ID_LEVEL_JOURNAL_JOURNAL.equals(((Element) ified).getLevelId(ID_HIERARACHY_JOURNAL))) { return; } } try { CatalogObject<String> co = catalogFacade.getObject(new YaddaObjectID((ified).getExtId())); if (co != null) { CatalogObjectPart<String> part = catalogFacade.getPart(new YaddaObjectID((ified).getExtId()), BWMETA1, null); if (part != null) { Identified existingElement = (Identified) reader105.read(part.getData()).get(0); if (!existingElement.getName().equals(ified.getName())) { // the name has changed localStats.duplicateFound(existingElement.getName(), ified.getName()); } } } } catch (Exception e) { log.warn("Exception caught", e); } stats = localStats; }
@Override protected ObjectHistory doProcess(ObjectHistory data, Map<String, Serializable> context, IProcessListener listener, ProcessingStats stats) throws Exception { if (data.getRelationship() == ObjectHistory.Ancestor.CONFLICT) { CatalogObject<String> sourceData = sourceCatalog.getObject(data.getSourceMeta().getId()); //TODO CatalogObject<String> targetData = data.getTargetMeta() != null ? targetCatalog.getObject(data.targetMeta.getId()) : null; //TODO What to do if object not found ? IConflictResolver.Solution<CatalogObject<String>> solution = conflictResolver.resolve(sourceData, targetData); data.setSolution(solution); } return data; }
throws ACLProviderException { try { CatalogObjectPart<String> ancestorsPart = catalogFacade.getPart( source, CatalogParamConstants.TYPE_ELEMENT_ANCESTORS3, null); if (ancestorsPart!=null && ancestorsPart.getData()!=null) { for (Ancestor currentAncestor : currentHierAncestors) { CatalogObjectPart<String> aclPart = catalogFacade.getPart( new YaddaObjectID(currentAncestor.getExtid()), ACLConstants.ACL_PART_NAME, null);
List<YExportable> entities = new ArrayList<YExportable>(); CatalogObjectMeta meta = catalogFacade.getObjectMetadata(new YaddaObjectID(id)); if (meta!=null) { CatalogObject<String> object = catalogFacade.getObject(meta.getId()); CatalogObjectPart<String> part = object.getPart(partType); if (part != null) { while (!additional.isEmpty()) { for (String s : additional) { object = catalogFacade.getObject(new YaddaObjectID(s)); part = object.getPart(partType); if (part != null) {
@SuppressWarnings("unchecked") public FlatElementIterator(ICatalogFacade<String> catalogFacade, String[] tags) throws CatalogException{ super(catalogFacade); CountingIterator<CatalogObjectMeta> metas = catalogFacade.iterateObjects(new String[]{CatalogParamConstants.TYPE_BWMETA1}, new Date(0), new Date(), tags, false); count = metas.count(); //TODO what about counting deleted ones ? iterator = new FilterIterator(metas, new Predicate() { @Override public boolean evaluate(Object o) { CatalogObjectMeta item = (CatalogObjectMeta)o; return !item.getStatus().isDeleted(); } }); }
catalogFacade.listObjects(new String[]{PART_TYPE_GROUP}, null, null, null, false); catalogFacade.getPart(item.getId(), PART_TYPE_GROUP, null);