@Override public void removeUserProfile(String userId) { try { storage.deleteObject(new YaddaObjectID(userId)); } catch (NotFoundException e) { // it is OK, profile not found so not removed } catch (ServiceException e) { String message = "Removing user profile for user " + userId + " not successfull."; logger.error(message, e); throw new RuntimeException(message, e); } }
@Override protected void consume(List<StorageOperation> item) throws Exception { if (item!=null && item.size()>0) { log.debug("Updating tags with " + item.size() + " operations..."); long start = System.currentTimeMillis(); storageFacade.batch(item, IStorage.EXECUTION_MODE.TRANSACTIONAL); log.debug("Updating tags took " + (System.currentTimeMillis() - start) + " ms"); } else { log.debug("got no storage operations to process!"); } }
@Override public boolean removeProfilePart(String userId, String partType) { boolean partExists = false; try { ArchiveObjectFacade archiveObject; archiveObject = archive.getObjectWithAllParts(new YaddaObjectID(userId), false); Collection<ArchiveContentPartFacade> archiveParts = archiveObject.getParts(); for (ArchiveContentPartFacade archivePart : archiveParts) { if (archivePart.getType().equals(partType)) { partExists = true; archiveParts.remove(archivePart); break; } } if (partExists) { storage.saveObject(generateStorePath(userId), archiveObject, new String[] { partType }, null); } return partExists; } catch (NotFoundException e) { return partExists; } catch (ServiceException e) { String message = "Fetching user profile for user " + userId + " not successfull."; logger.error(message, e); throw new RuntimeException(message, e); } }
result.add(storageFacade.buildSaveOperation( uri, archObjFacade, null, tagOp.getTagsToRemove())); } else {
@Override public void addProfilePart(String userId, ProfilePart part) throws UserProfileNotFoundException { try { ArchiveObjectFacade archiveObject; archiveObject = archive.getObject(new YaddaObjectID(userId), null, false); archiveObject.addPart(part.getType(), USER_PROFILE_PART_GENERIC_MIMETYPE, new ByteArrayInputStream(part.getContent())); storage.saveObject(generateStorePath(userId), archiveObject, null, null); } catch (NotFoundException e) { logger.error("User profile for user " + userId + " does not exist.", e); throw new UserProfileNotFoundException(userId); } catch (ServiceException e) { String message = "Fetching user profile for user " + userId + " not successfull."; logger.error(message, e); throw new RuntimeException(message, e); } }
@Override public boolean addUserProfile(String userId) { try { archive.getObject(new YaddaObjectID(userId), null, false); return false; } catch (NotFoundException e) { ArchiveObjectFacade archiveObject; archiveObject = new ArchiveObjectFacade(); archiveObject.setId(new YaddaObjectID(userId)); archiveObject.setType(USER_PROFILE_TYPE); try { storage.saveObject(generateStorePath(userId), archiveObject, null, null); } catch (ServiceException e1) { String message = "Adding user profile for user " + userId + " not successfull."; logger.error(message, e1); throw new RuntimeException(message, e1); } return true; } catch (ServiceException e) { String message = "Fetching user profile for user " + userId + " not successfull."; logger.error(message, e); throw new RuntimeException(message, e); } }
public void removeDump(String dumpId) throws Exception { ArchiveObject2Meta dumpMeta = archiveFacade.queryUniqueObject(dumpId, false); if (dumpMeta == null) return; storageFacade.deleteObject(dumpMeta.getId()); }
@Override protected Chunk doProcessChunk(final Chunk data, final Map<String, Serializable> context, final IProcessListener processListener, final ProcessingStats stats) throws Exception { storageFacade.batch(data.getCustomStorageOperations(), IStorage.EXECUTION_MODE.TRANSACTIONAL); return data; }
new ArchiveObject2Meta(SYSTEM_OBJECT_PATH.getRootId(), SYSTEM_OBJECT_TYPE, "nothing", null)); storageFacade.saveObject(SYSTEM_OBJECT_PATH.encode(), object, null, null); new ArchiveObject2Meta(new YaddaObjectID(new UUIDGenerator().generate(null)), ERROR_DUMPS_TYPE, "nothing", null)); storageFacade.saveObject(ERROR_DUMP_OBJECT_PATH.encode(), object, null, null); storageFacade.saveObject(path.encode(), object, null, null);