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;
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;
}
}