use of org.camunda.bpm.engine.impl.persistence.entity.IdentityInfoEntity in project camunda-bpm-platform by camunda.
the class DeleteUserPictureCmd method execute.
public Void execute(CommandContext commandContext) {
ensureNotNull("UserId", userId);
IdentityInfoEntity infoEntity = commandContext.getIdentityInfoManager().findUserInfoByUserIdAndKey(userId, "picture");
if (infoEntity != null) {
String byteArrayId = infoEntity.getValue();
if (byteArrayId != null) {
commandContext.getByteArrayManager().deleteByteArrayById(byteArrayId);
}
commandContext.getIdentityInfoManager().delete(infoEntity);
}
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.IdentityInfoEntity in project camunda-bpm-platform by camunda.
the class SetUserPictureCmd method execute.
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());
commandContext.getDbEntityManager().insert(byteArrayEntity);
pictureInfo.setValue(byteArrayEntity.getId());
return null;
}
use of org.camunda.bpm.engine.impl.persistence.entity.IdentityInfoEntity in project camunda-bpm-platform by camunda.
the class GetUserPictureCmd method execute.
public Picture execute(CommandContext commandContext) {
ensureNotNull("userId", userId);
IdentityInfoEntity pictureInfo = commandContext.getIdentityInfoManager().findUserInfoByUserIdAndKey(userId, "picture");
if (pictureInfo != null) {
String pictureByteArrayId = pictureInfo.getValue();
if (pictureByteArrayId != null) {
ByteArrayEntity byteArray = commandContext.getDbEntityManager().selectById(ByteArrayEntity.class, pictureByteArrayId);
return new Picture(byteArray.getBytes(), byteArray.getName());
}
}
return null;
}
Aggregations