/** * create ByteArrayEntity with specified name and payload and make sure it's * persisted * * used in Jobs and ExternalTasks * * @param name - type\source of the exception * @param byteArray - payload of the exception * @param type - resource type of the exception * @return persisted entity */ public static ByteArrayEntity createExceptionByteArray(String name, byte[] byteArray, ResourceType type) { ByteArrayEntity result = null; if (byteArray != null) { result = new ByteArrayEntity(name, byteArray, type); Context.getCommandContext() .getByteArrayManager() .insertByteArray(result); } return result; }
/** * create ByteArrayEntity with specified name and payload and make sure it's * persisted * * used in Jobs and ExternalTasks * * @param name - type\source of the exception * @param byteArray - payload of the exception * @param type - resource type of the exception * @return persisted entity */ public static ByteArrayEntity createExceptionByteArray(String name, byte[] byteArray, ResourceType type) { ByteArrayEntity result = null; if (byteArray != null) { result = new ByteArrayEntity(name, byteArray, type); Context.getCommandContext() .getByteArrayManager() .insertByteArray(result); } return result; }
public void setByteArrayValue(byte[] bytes, boolean isTransient) { if (bytes != null) { // note: there can be cases where byteArrayId is not null // but the corresponding byte array entity has been removed in parallel; // thus we also need to check if the actual byte array entity still exists if (this.byteArrayId != null && getByteArrayEntity() != null) { byteArrayValue.setBytes(bytes); } else { deleteByteArrayValue(); byteArrayValue = new ByteArrayEntity(nameProvider.getName(), bytes, type, rootProcessInstanceId, removalTime); // avoid insert of byte array value for a transient variable if (!isTransient) { Context. getCommandContext() .getByteArrayManager() .insertByteArray(byteArrayValue); byteArrayId = byteArrayValue.getId(); } } } else { deleteByteArrayValue(); } }
public void setByteArrayValue(byte[] bytes, boolean isTransient) { if (bytes != null) { // note: there can be cases where byteArrayId is not null // but the corresponding byte array entity has been removed in parallel; // thus we also need to check if the actual byte array entity still exists if (this.byteArrayId != null && getByteArrayEntity() != null) { byteArrayValue.setBytes(bytes); } else { deleteByteArrayValue(); byteArrayValue = new ByteArrayEntity(nameProvider.getName(), bytes, type, rootProcessInstanceId, removalTime); // avoid insert of byte array value for a transient variable if (!isTransient) { Context. getCommandContext() .getByteArrayManager() .insertByteArray(byteArrayValue); byteArrayId = byteArrayValue.getId(); } } } else { deleteByteArrayValue(); } }
public Void execute(CommandContext commandContext) { ensureNotNull("userId", userId); IdentityInfoEntity pictureInfo = commandContext.getIdentityInfoManager() .findUserInfoByUserIdAndKey(userId, "picture"); if (pictureInfo != null) { String byteArrayId = pictureInfo.getValue(); if (byteArrayId != null) { commandContext.getByteArrayManager() .deleteByteArrayById(byteArrayId); } } else { pictureInfo = new IdentityInfoEntity(); pictureInfo.setUserId(userId); pictureInfo.setKey("picture"); commandContext.getDbEntityManager().insert(pictureInfo); } ByteArrayEntity byteArrayEntity = new ByteArrayEntity(picture.getMimeType(), picture.getBytes(), ResourceTypes.REPOSITORY); commandContext.getByteArrayManager() .insertByteArray(byteArrayEntity); pictureInfo.setValue(byteArrayEntity.getId()); return null; }
public Void execute(CommandContext commandContext) { ensureNotNull("userId", userId); IdentityInfoEntity pictureInfo = commandContext.getIdentityInfoManager() .findUserInfoByUserIdAndKey(userId, "picture"); if (pictureInfo != null) { String byteArrayId = pictureInfo.getValue(); if (byteArrayId != null) { commandContext.getByteArrayManager() .deleteByteArrayById(byteArrayId); } } else { pictureInfo = new IdentityInfoEntity(); pictureInfo.setUserId(userId); pictureInfo.setKey("picture"); commandContext.getDbEntityManager().insert(pictureInfo); } ByteArrayEntity byteArrayEntity = new ByteArrayEntity(picture.getMimeType(), picture.getBytes(), ResourceTypes.REPOSITORY); commandContext.getByteArrayManager() .insertByteArray(byteArrayEntity); pictureInfo.setValue(byteArrayEntity.getId()); return null; }
byteArray.setRemovalTime(attachment.getRemovalTime()); commandContext.getByteArrayManager().insertByteArray(byteArray); attachment.setContentId(byteArray.getId());
.getCommandContext() .getByteArrayManager() .insertByteArray(byteArrayEntity); historyEvent.setByteArrayId(byteArrayEntity.getId());
byteArray.setRemovalTime(attachment.getRemovalTime()); commandContext.getByteArrayManager().insertByteArray(byteArray); attachment.setContentId(byteArray.getId());
.getCommandContext() .getByteArrayManager() .insertByteArray(byteArrayEntity); historyEvent.setByteArrayId(byteArrayEntity.getId());
/** * create ByteArrayEntity with specified name and payload and make sure it's * persisted * * used in Jobs and ExternalTasks * * @param name - type\source of the exception * @param byteArray - payload of the exception * @param type - resource type of the exception * @return persisted entity */ public static ByteArrayEntity createExceptionByteArray(String name, byte[] byteArray, ResourceType type) { ByteArrayEntity result = null; if (byteArray != null) { result = new ByteArrayEntity(name, byteArray, type); Context.getCommandContext() .getByteArrayManager() .insertByteArray(result); } return result; }
public void setByteArrayValue(byte[] bytes, boolean isTransient) { if (bytes != null) { // note: there can be cases where byteArrayId is not null // but the corresponding byte array entity has been removed in parallel; // thus we also need to check if the actual byte array entity still exists if (this.byteArrayId != null && getByteArrayEntity() != null) { byteArrayValue.setBytes(bytes); } else { deleteByteArrayValue(); byteArrayValue = new ByteArrayEntity(nameProvider.getName(), bytes, type, rootProcessInstanceId, removalTime); // avoid insert of byte array value for a transient variable if (!isTransient) { Context. getCommandContext() .getByteArrayManager() .insertByteArray(byteArrayValue); byteArrayId = byteArrayValue.getId(); } } } else { deleteByteArrayValue(); } }
public Void execute(CommandContext commandContext) { ensureNotNull("userId", userId); IdentityInfoEntity pictureInfo = commandContext.getIdentityInfoManager() .findUserInfoByUserIdAndKey(userId, "picture"); if (pictureInfo != null) { String byteArrayId = pictureInfo.getValue(); if (byteArrayId != null) { commandContext.getByteArrayManager() .deleteByteArrayById(byteArrayId); } } else { pictureInfo = new IdentityInfoEntity(); pictureInfo.setUserId(userId); pictureInfo.setKey("picture"); commandContext.getDbEntityManager().insert(pictureInfo); } ByteArrayEntity byteArrayEntity = new ByteArrayEntity(picture.getMimeType(), picture.getBytes(), ResourceTypes.REPOSITORY); commandContext.getByteArrayManager() .insertByteArray(byteArrayEntity); pictureInfo.setValue(byteArrayEntity.getId()); return null; }
byteArray.setRemovalTime(attachment.getRemovalTime()); commandContext.getByteArrayManager().insertByteArray(byteArray); attachment.setContentId(byteArray.getId());
.getCommandContext() .getByteArrayManager() .insertByteArray(byteArrayEntity); historyEvent.setByteArrayId(byteArrayEntity.getId());