@Override public CatalogObjectPart<String> mapRow(ResultSet rs, int rowNum) throws SQLException { return new CatalogObjectPart<String>( rs.getString(PART_TYPE), rs.getString(PART_DATA)); } };
public CatalogObjectPart<String> mapRow(ResultSet rs, int rowNum) throws SQLException { return new CatalogObjectPart<String>( rs.getString(PART_TYPE), new Date(rs.getTimestamp(PART_STAMP).getTime()), rs.getString(PART_DATA)); } };
public CatalogObjectPart<String> mapRow(ResultSet rs, int rowNum) throws SQLException { return new CatalogObjectPart<String>( rs.getString(PART_TYPE), new Date(rs.getTimestamp(PART_STAMP).getTime()), rs.getString(PART_DATA)); } };
public CatalogObjectPart<String> mapRow(ResultSet rs, int rowNum) throws SQLException { return new CatalogObjectPart<String>( rs.getString(PART_TYPE), new Date(rs.getTimestamp(PART_STAMP).getTime()), rs.getString(PART_DATA)); } };
public CatalogObjectPart<String> mapRow(ResultSet rs, int rowNum) throws SQLException { return new CatalogObjectPart<String>( rs.getString(PART_TYPE), new Date(rs.getTimestamp(PART_STAMP).getTime()), rs.getString(PART_DATA)); } };
@Override public List<CatalogObject<String>> process(List<YElement> yelist, ProcessContext ctx) throws TransformationException{ synchronized (this) { List<CatalogObject<String>> col = new LinkedList<CatalogObject<String>>(); int i = 0; for(YElement yelement : yelist){ i++; log.info("[process] yelement={}", yelement); String bwmetaStr; bwmetaStr = yElementToBwMetaString(yelement); log.info("[process] bwmetaStr={}", bwmetaStr); YaddaObjectID id = new YaddaObjectID(yelement.getId()); CatalogObject<String> co = new CatalogObject<String>(id); CatalogObjectPart<String> part = new CatalogObjectPart<String>(CatalogParamConstants.TYPE_BWMETA2, bwmetaStr); co.addPart(part); log.info("[process] co={}", co); col.add(co); } return col; } }
@Override public CatalogObject<String> process(YElement yelement, ProcessContext ctx) throws Exception { synchronized (this) { log.info("[process] yelement={}", yelement); String bwmetaStr = yElementToBwMetaString(yelement); log.info("[process] bwmetaStr={}", bwmetaStr); YaddaObjectID id = new YaddaObjectID(yelement.getId()); CatalogObject<String> co = new CatalogObject<String>(id); CatalogObjectPart<String> part = new CatalogObjectPart<String>(CatalogParamConstants.TYPE_BWMETA2, bwmetaStr); co.addPart(part); log.info("[process] co={}", co); return co; } }
catalogObject.addPart(new CatalogObjectPart<String>(partType, sb.toString())); editorFacade.save(catalogObject, null);
public List<CatalogObject<String>> process(List<YElement> yelist, ProcessContext ctx) throws TransformationException{ synchronized (NlmYToCatObjProcessingNode.class) { List<CatalogObject<String>> col = new LinkedList<CatalogObject<String>>(); for(YElement yelement : yelist){ String bwmetaStr; bwmetaStr = yElementToBwMetaString(yelement); YaddaObjectID id = new YaddaObjectID(yelement.getId()); CatalogObject<String> co = new CatalogObject<String>(id); CatalogObjectPart<String> part = new CatalogObjectPart<String>(CatalogParamConstants.TYPE_BWMETA2, bwmetaStr); co.addPart(part); col.add(co); } return col; } }
/** * Crates and stores in the catalog an unique identifier for this catalog/editor. */ protected void createUUID() { SaveOperation<String> op = new SaveOperation<String>(); CatalogObject<String> object = new CatalogObject<String>(new YaddaObjectID(ID_CATALOG_META)); CatalogObjectPart<String> part = new CatalogObjectPart<String>(TYPE_UUID, UUID.randomUUID().toString()); object.addPart(part); op.setObject(object); execute(null, op); // no transaction id because this is an internal operation not to be reported //FIXME: if we keep this, protect this object from modifications }
protected void saveDictionary(Dictionary dictionary) throws ServiceException { CatalogObject<String> object = new CatalogObject<String>(); object.setId(new YaddaObjectID(licenceObjectName)); String encodedObject = xStream.toXML(dictionary); object.addPart(new CatalogObjectPart<String>(licenceObjectType, encodedObject)); try { editorFacade.save(object, null); } catch (EditorException e) { throw new ServiceException(e); } }
public void storeGroup(Group group) throws CatalogException { YaddaObjectID newId = new YaddaObjectID(group.getExtId()); String encodedGroup = serializer.toString(group.getExtId(), group); CatalogObject<String> groupObject = new CatalogObject<String>(newId); groupObject.addPart( new CatalogObjectPart<String>(PART_TYPE_GROUP, encodedGroup)); editorFacade.save(groupObject, new String[0]); groups.put(group.getExtId(), group); for (ExternalReference<User> userRef : group.getUsers()) { if (groupsForUser.get(userRef.getExtId()) == null) { groupsForUser.put(userRef.getExtId(), new HashSet<Group>()); } groupsForUser.get(userRef.getExtId()).add(group); } }
private void saveObject(String id, Object object, YExportable exportable, String[] tags, boolean noSavingHistory) throws Exception { String content1 = writer105.write(Arrays.asList(new Identified[]{(Identified) object}), YaddaTransformers.NO_BWMETA_ROOT); // serializer1.toString(id, object); CatalogObject<String> c = new CatalogObject<String>(new YaddaObjectID(id)); c.setTags(tags); c.addPart(new CatalogObjectPart<String>(BWMETA1, content1)); if (exportable != null) { String content2 = serializer2.write(exportable); c.addPart(new CatalogObjectPart<String>(BWMETA2, content2)); } SaveOperation<String> op = new SaveOperation<String>(c, noSavingHistory); op.setPreservingTags(preserveTags); editorOperations.add(op); flushIfNecessary(); }
public void storeUser(User user) throws CatalogException { YaddaObjectID newId = new YaddaObjectID(user.getExtId()); String encodedUser = serializer.toString(user.getExtId(), user); CatalogObject<String> userObject = new CatalogObject<String>(newId); userObject.addPart( new CatalogObjectPart<String>(PART_TYPE_USER, encodedUser)); editorFacade.save(userObject, new String[0]); usersByLogin.put(user.getLogin(), user); usersById.put(user.getExtId(), user); }
private SaveOperation buildSaveOperationForElement(YElement element, Ancestors ancestors, WebUserDetails userDetails) throws TransformationException, IOException { SaveOperation saveOperation = buildSaveOperationForElement(element,userDetails); final String elementExtId = element.getId(); final String serializedAncestors = ancestorsSerializer.toString(elementExtId, ancestors); saveOperation.getObject().addPart(new CatalogObjectPart<>(CatalogParamConstants.TYPE_ELEMENT_ANCESTORS3, serializedAncestors)); return saveOperation; }
@Override protected void finishProcess(ProcessContext context) { try { Date dirtyDate = (Date)context.get(Constants.PARAM_PROCESSED_THERESHOLD); if (dirtyDate != null) { String serializedDate = ISODateTimeFormat.dateTime().print(new DateTime(dirtyDate)); CatalogObject<String> catalogObject = new CatalogObject<String>(new YaddaObjectID(DIRTY_DATA_OBJECT_ID)); catalogObject.addPart(new CatalogObjectPart<String>(DIRTY_DATA_PART_NAME, serializedDate)); editorFacade.save(catalogObject, null); } } catch (Exception e) { if (context != null) { context.getListener().notifyEvent("rebuildMeta.finish", new String[]{}, EventResultCode.ERROR, StackTraceUtil.getStackTrace(e)); } log.error("Exception caught", e); } finally { super.finishProcess(context); } }
public void storeRole(Role role) throws Exception { YaddaObjectID newId = new YaddaObjectID(role.getExtId()); String encodedRole = serializer.toString(role.getExtId(), role); CatalogObject<String> roleObject = new CatalogObject<String>(newId); roleObject.addPart( new CatalogObjectPart<String>(PART_TYPE_ROLE, encodedRole)); editorFacade.save(roleObject, new String[0]); roles.put(role.getExtId(), role); }
@Override protected Chunk doProcessChunk(Chunk data, Map<String, Serializable> context, IProcessListener processListener, ProcessingStats stats) throws Exception { for (WriteStatusRequest ce : data.getWriteStatusRequests()) { String serializedElementStatus = xStream.toXML(ce.getNewStatus()); YaddaObjectID id = new YaddaObjectID(ce.getExtId().getId()); if (!data.getObjectsToWrite().containsKey(ce.getExtId().getId())) { data.getObjectsToWrite().put(ce.getExtId().getId(), new CatalogObject<String>(id)); } CatalogObjectPart<String> elementStatusPart = new CatalogObjectPart<String>( CatalogParamConstants.TYPE_ELEMENT_PROCESSING_STATUS, serializedElementStatus); data.getObjectsToWrite().get(ce.getExtId().getId()).addPart(elementStatusPart); } return data; }
CatalogObjectPart<String> ancestorsPart = new CatalogObjectPart<String>( CatalogParamConstants.TYPE_ELEMENT_CHILDREN3, serialized); data.getObjectsToWrite().get(parentExtId).addPart(ancestorsPart);
protected void storeObject(NamedObject object) throws EditorException { String id = idMapper.getExtId(SecurityObjectType.identifyType(object), object.getName()); CatalogObject<String> os = new CatalogObject<String>(new YaddaObjectID( id)); // TODO: wh - store user profile under different part type? if (object instanceof UserProfile) { UserProfile usrProfile = (UserProfile) object; os.addPart(new CatalogObjectPart<String>(partType, structSerializer.toString(usrProfile.getStruct()))); } else { os.addPart(new CatalogObjectPart<String>(partType, serializer.toString( object.getName(), object))); } editor.save(os, new String[0]); }