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 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); } }
nextObject = catalogFacade.getObject(meta.getId()); } catch (CatalogException e) { throw new RuntimeException("CatalogException while retrieving next bwmeta from catalog", e);
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) {
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; }
@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; }
YElement ancestorElement = null; try { CatalogObject<String> catObject = this.catalogFacade.getObject(new YaddaObjectID(ancestorId)); if(catObject == null) return null;
cmo=catalogFacade.getObject(new YaddaObjectID(extId,null,null)); } catch (CatalogException e) { log2.warn("Object with id=" + extId + " could'nt be read", e);
@Override public String readMetadata(String id) { try { CatalogObject<String> object = catalogFacadeProvider.getCatalogFacade().getObject(new YaddaObjectID(id)); if (object != null) { CatalogObjectPart<String> part = findPreferedPart(object.getParts()); if (part != null) { return part.getData(); } } else { problemHandler.handleProblem(LogSeverity.WARN, id, ImporterConstants.PROBLEM_ERROR_READ_BWMETA, "Object not found in the YADDA repository"); } } catch (Exception e) { logger.error("Exception while processing attachments from yadda", e); problemHandler.handleProblem(LogSeverity.WARN, id, ImporterConstants.PROBLEM_ERROR_READ_BWMETA, e); } return null; }
public Object resolveObject(String id) throws ReferenceResolutionException { try { CatalogObject<String> object = catalogFacade.getObject(new YaddaObjectID(id)); if (object == null) throw new ReferenceResolutionException("Object not found (id=" + id + ")"); for (String type : supportedPartTypes) { CatalogObjectPart<String> part = object.getPart(type); if (part != null) return serializer.toObject(id, part.getData()); } String types = StringUtils.join(object.getPartTypes(), ";"); throw new ReferenceResolutionException("Unknown object types:" + types); } catch (CatalogException e) { throw new ReferenceResolutionException("Access to catalog failed", 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 public synchronized DocMetadata fetch(final DocId id) throws MetadataIndexException { if (id == null) { return null; } if (!MetadataIndexConstants.D_EXTID.equals(id.getDomain())) { throw new IllegalArgumentException(); } try { final CatalogObject<String> object = catalogFacade.getObject(new YaddaObjectID(id.getId())); if (object == null) { return null; } final CatalogObjectPart<String> part = object.getPart(MetadataIndexConstants.T_REFMETA); if (part == null) { return null; } return (DocMetadata) metadataSerialization.restore(part.getData()); } catch (final CatalogException e) { throw new MetadataIndexException(e); } catch (final JDOMException e) { throw new MetadataIndexException(e); } catch (final IOException e) { throw new MetadataIndexException(e); } }
private boolean checkNextElement(){ if (next!=null) return true; if (lastCheck) { while (iterator.hasNext() && next==null) { catToS.logTick(); CatalogObjectMeta meta = iterator.next(); try { CatalogObject<String> object = catalogFacade.getObject(meta.getId()); CatalogObjectPart<String> part = object.getPart(catToS.getPartType()); if (part != null) { next = part.getData(); } } catch (CatalogException e) { log.warn("Cannot process " + meta.getId()); } } } lastCheck=(next!=null); return(next!=null); }
if (StringUtils.isNotEmpty(contributor.getExtId())) { try { CatalogObject<String> catalogObject = catalogFacade.getObject(new YaddaObjectID(contributor.getExtId())); if (catalogObject != null && catalogObject.getPart(CatalogParamConstants.TYPE_BWMETA1) != null) { String objectData = catalogObject.getPart(CatalogParamConstants.TYPE_BWMETA1).getData(); for (String referenceExtId:relation.getReferenceExtIds()) { try { CatalogObject<String> catalogObject = catalogFacade.getObject(new YaddaObjectID(referenceExtId)); if (catalogObject != null && catalogObject.getPart(CatalogParamConstants.TYPE_BWMETA1) != null) { String objectData = catalogObject.getPart(CatalogParamConstants.TYPE_BWMETA1).getData();
case ONLY_LOW_LEVELS: try { CatalogObject<String> co = catalogFacade.getObject(new YaddaObjectID((ified).getExtId())); if (co != null) { CatalogObjectPart<String> part = catalogFacade.getPart(new YaddaObjectID((ified).getExtId()), case IF_OLDER: try { CatalogObject<String> co = catalogFacade.getObject(new YaddaObjectID((ified).getExtId())); if (co != null) { CatalogObjectPart<String> part = catalogFacade.getPart(new YaddaObjectID((ified).getExtId()), case NEVER: if (catalogFacade.getObject(new YaddaObjectID((ified).getExtId())) != null) { return;
public synchronized DocMetadata fetch(final String id) throws MetadataIndexException { if (id == null) { return null; } try { final CatalogObject<String> object = catalogFacade.getObject(new YaddaObjectID(id)); if (object == null) { return null; } final CatalogObjectPart<String> part = object.getPart(MetadataIndexConstants.T_REFMETA); if (part == null) { return null; } return (DocMetadata) metadataSerialization.restore(part.getData()); } catch (final CatalogException e) { throw new MetadataIndexException(e); } catch (final JDOMException e) { throw new MetadataIndexException(e); } catch (final IOException e) { throw new MetadataIndexException(e); } }
private Serializable[] buildTuple(final Category category) throws CatalogException { //does category tuple building Category c = category; final List<CategoryInfo> cis = new ArrayList<CategoryInfo>(); do { final String peid = c.getParentExtId(); if (peid == null) { break; } //fetch object final CatalogObject<String> object = catalogFacade.getObject(new YaddaObjectID( peid)); if (object == null || object.getPart( CatalogParamConstants.TYPE_BWMETA1) == null) { break; } final String s = object.getPart( CatalogParamConstants.TYPE_BWMETA1).getData(); c = (Category) new BwmetaSerializer105().toObject( peid, s); final CategoryInfo pcifo = new CategoryInfo(c.getName(), c.getCode(), c.getCategoryClassExtId()); pcifo.setExtId(c.getExtId()); cis.add(pcifo); } while (c != null && cis.size() < CategoryView.ANCESTOR_PATH_LENGTH); return CategoryView.asTuple(category, cis); } }
case IF_OLDER: try { CatalogObject<String> co = catalogFacade.getObject(new YaddaObjectID((ified).getExtId())); if (co != null) { CatalogObjectPart<String> part = catalogFacade.getPart(new YaddaObjectID((ified).getExtId()), CatalogObject<?> co=catalogFacade.getObject(new YaddaObjectID((ified).getExtId())); if (co != null && (co.getStatus()!=YaddaObjectMeta.STATUS.DELETED) && case NEVER: if (catalogFacade.getObject(new YaddaObjectID((ified).getExtId())) != null) { return;
protected NamedObject loadObject(String name, SecurityObjectType type) throws CatalogException { CatalogObject<String> co = catalog.getObject(new YaddaObjectID( idMapper.getExtId(type, name))); if (co == null) { return null; } CatalogObjectPart<String> st = co.getPart(partType); if (st != null) { // TODO: wh - store user profile under different part type? if (SecurityObjectType.USER_PROFILE.equals(type)) { UserProfile profile = new UserProfile(name); profile.setStruct(structSerializer.toObject(st.getData())); return profile; } else { return (NamedObject) serializer.toObject(name, st.getData()); } } else { return null; } }
case MY_NEW: YaddaObjectID oid = new YaddaObjectID(data.getSourceMeta().getId()); targetEditor.merge(sourceCatalog.getObject(data.getSourceMeta().getId()), oid); break; case MY_FIRST: