public static AvatarImpl createCustomAvatar(final String fileName, final ApplicationUser owner) { return createCustomAvatar(fileName, IMAGE_PNG, owner.getKey(), Type.USER); }
public static AvatarImpl createCustomAvatar(final String fileName, final String contentType, final String ownerId, final Type type) { return new AvatarImpl(null, toTaggedFilename(fileName), contentType, type, ownerId, false); }
private Avatar createAvatar(final String fileName) { log.info("Creating system project avatar " + fileName); return avatarManager.create(AvatarImpl.createSystemAvatar(fileName, "image/png", Avatar.Type.PROJECT)); }
AvatarImpl(final Long id, final String fileName, final String contentType, final Avatar.Type avatarType, final String owner, final boolean systemAvatar) { this.id = id; this.fileName = Assertions.notNull("fileName", fileName); this.contentType = Assertions.notNull("contentType", contentType); this.avatarType = Assertions.notNull("avatarType", avatarType); this.systemAvatar = systemAvatar; // system avatars have no owner. if (!isSystemAvatar() && !isOldSystemAvatar(this.avatarType, this.fileName)) { Assertions.notNull("owner", owner); this.owner = owner; } else if (owner != null) { throw new IllegalArgumentException("owner must be null for system avatars"); } else { this.owner = null; } }
/** * Factory method for creating a system Avatar to be created by {@link com.atlassian.jira.avatar.AvatarManager}. */ public static AvatarImpl createSystemAvatar(final String fileName, final String contentType, final Avatar.Type avatarType) { return new AvatarImpl(null, fileName, IMAGE_PNG, avatarType, null, true); }
Avatar gvToAvatar(final GenericValue gv) { return new AvatarImpl(gv.getLong(ID), gv.getString(FILE_NAME), gv.getString(CONTENT_TYPE), Avatar.Type.getByName(gv.getString(AVATAR_TYPE)), gv.getString(OWNER), gv.getInteger(SYSTEM_AVATAR) != 0); }
public static AvatarImpl createCustomAvatar(final String fileName, final String contentType, final Project owner) { return createCustomAvatar(fileName, contentType, owner.getId().toString(), Type.PROJECT); }
private Avatar createAvatar(final String fileName) { log.info("Creating system user avatar " + fileName); return avatarManager.create(AvatarImpl.createSystemAvatar(fileName, "image/png", Avatar.Type.USER)); }
Assertions.notNull("imageDataProvider", imageDataProvider); Avatar avatarStub = new AvatarImpl( null, avatarImageDataStorage.getNextFilenameStub() + ".png",
private Avatar getAvatar(final TemporaryAvatar temporaryAvatar, final Avatar.Type type, final String ownerId) { return AvatarImpl.createCustomAvatar(temporaryAvatar.getOriginalFilename(), temporaryAvatar.getTemporaryContentType(), ownerId, type); }
private Avatar createAvatar(final String fileName) { log.info("Creating system user avatar " + fileName); return avatarManager.create(AvatarImpl.createSystemAvatar(fileName, "image/png", Avatar.Type.USER)); }
@Override @Nonnull public Avatar create(String fileName, String contentType, ApplicationUser owner, InputStream imageData, Selection croppingSelection) throws DataAccessException, IOException { Assertions.notNull("fileName", fileName); Assertions.notNull("avatar", contentType); Assertions.notNull("owner", owner); Assertions.notNull("imageData", imageData); return create(AvatarImpl.createCustomAvatar(fileName, owner), imageData, croppingSelection); }
@Override @Nonnull public Avatar create(String fileName, String contentType, Project owner, InputStream imageData, Selection croppingSelection) throws DataAccessException, IOException { Assertions.notNull("fileName", fileName); Assertions.notNull("avatar", contentType); Assertions.notNull("owner", owner); Assertions.notNull("imageData", imageData); return create(AvatarImpl.createCustomAvatar(fileName, contentType, owner), imageData, croppingSelection); }
final Avatar toCreate = AvatarImpl.createCustomAvatar(AVATAR_DEFAULT_BASE_FILENAME, contentType, project); Avatar createdAvatar = avatarManager.create(toCreate, bais, AvatarManager.ImageSize.LARGE.getOriginSelection()); IOUtil.shutdownStream(bais);