@Override final public SystemAndCustomAvatars getAvatars(final ApplicationUser remoteUser, final String owningObjectId) { final List<Avatar> systemAvatars = avatarManager.getAllSystemAvatars(type); final List<Avatar> avatarsForOwner = avatarManager.getCustomAvatarsForOwner(type, owningObjectId); return new SystemAndCustomAvatars(systemAvatars, avatarsForOwner); }
public RemoteAvatar[] getProjectAvatars(final User user, final String projectKey, final boolean includeSystemAvatars, final String size) throws RemoteException, RemotePermissionException { final boolean large = "large".equalsIgnoreCase(size); final Project project = retrieveProjectByKey(projectKey, user); final ArrayList<Avatar> avatars = new ArrayList<Avatar>(); if (includeSystemAvatars) { avatars.addAll(avatarManager.getAllSystemAvatars(Avatar.Type.PROJECT)); } avatars.addAll(avatarManager.getCustomAvatarsForOwner(PROJECT, project.getId().toString())); RemoteAvatar[] remoteAvatars = new RemoteAvatar[avatars.size()]; for (int i = 0; i < avatars.size(); i++) { remoteAvatars[i] = createRemoteAvatar(avatars.get(i), large, new Base64InputStreamConsumer(true)); } return remoteAvatars; }
/** * Returns all system avatars of the given type. * * @param type - Type of avatars (User or Project) * @return all system avatars for the given type * * @response.representation.200.qname * avatars * * @response.representation.200.mediaType * application/json * * @response.representation.200.doc * Returns a map containing a list of system avatars. A map is returned to be consistent with the shape of the * {link #getAllAvatars} method. * * @response.representation.200.example * {@link AvatarBean#DOC_EXAMPLE_SYSTEM_LIST} * * @response.representation.500.doc * Returned if an error occurs while retrieving the list of avatars. */ public Response getAllSystemAvatars(final Avatar.Type type) { Map<String, List<AvatarBean>> avatars = new HashMap<String, List<AvatarBean>>(); AvatarBeanFactory avatarBeanFactory = new AvatarBeanFactory(jiraAvatarSupport); final List<AvatarBean> systemAvatarBeans = avatarBeanFactory.createAvatarBeans(avatarManager.getAllSystemAvatars(type), null); avatars.put("system", systemAvatarBeans); return Response.ok(avatars).cacheControl(NO_CACHE).build(); }
List<Avatar> existingSystemProjectAvatars = avatarManager.getAllSystemAvatars(Avatar.Type.PROJECT); List<String> avatarsToCreate = new ArrayList<String>(newSystemProjectAvatars);
final List<Avatar> allSystemAvatars = avatarManager.getAllSystemAvatars(type); final List<AvatarBean> systemAvatarBeans = avatarBeanFactory.createAvatarBeans(allSystemAvatars, avatarUser); setSelectedAvatar(selectedAvatarId, systemAvatarBeans);
for (Avatar avatar : avatarManager.getAllSystemAvatars(Avatar.Type.USER))
public void doUpgrade(boolean setupMode) throws Exception { // first check if there are any existing system avatars. and get rid of them just in case! for (Avatar avatar : avatarManager.getAllSystemAvatars(Avatar.Type.USER)) { log.info("Deleting existing system avatar"); avatarManager.delete(avatar.getId()); } // for each system avatar file, add the system avatar createAvatar("angel.png"); createAvatar("businessman.png"); createAvatar("businessman2.png"); createAvatar("devil.png"); createAvatar("doctor.png"); createAvatar("dude1.png"); createAvatar("dude2.png"); createAvatar("dude3.png"); createAvatar("dude4.png"); createAvatar("dude5.png"); createAvatar("ghost.png"); createAvatar("security_agent.png"); createAvatar("user1.png"); createAvatar("user2.png"); createAvatar("user3.png"); createAvatar("user_headphones.png"); Avatar a = createAvatar("userprofile_silhouette.png"); applicationProperties.setString(APKeys.JIRA_DEFAULT_USER_AVATAR_ID, a.getId().toString()); }