本文整理了Java中com.atlassian.jira.project.Project.getAvatar()
方法的一些代码示例,展示了Project.getAvatar()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Project.getAvatar()
方法的具体详情如下:
包路径:com.atlassian.jira.project.Project
类名称:Project
方法名:getAvatar
[英]Gives the currently-configured com.atlassian.jira.avatar.Avatar for this project.
[中]提供当前配置的com。大西洋的。吉拉。阿凡达这个项目的头像。
代码示例来源:origin: com.atlassian.jira/jira-api
public Long getOldAvatarId() {
return project.getAvatar().getId();
}
代码示例来源:origin: com.atlassian.jira/jira-core
public boolean hasDefaultAvatar(Project project)
{
final Long avatarId = project.getAvatar().getId();
return avatarId == null || avatarId.equals(PROJECT_DEFAULT_AVATAR_ID);
}
代码示例来源:origin: com.atlassian.jira/jira-api
public static Map<String, String> getAvatarUrls(final Project project)
{
AvatarService avatarService = ComponentAccessor.getAvatarService();
final Avatar avatar = project.getAvatar();
if (avatar == null) return null;
final Map<String, String> avatarUrls = new HashMap<String, String>();
for (Avatar.Size size : Avatar.Size.values())
{
final int px = size.getPixels();
final String sizeName = String.format("%dx%d",px,px);
if (px > 48) continue; // TODO JRADEV-20790 - Don't output higher res URLs in our REST endpoints until we start using them ourselves.
avatarUrls.put(sizeName, avatarService.getProjectAvatarAbsoluteURL(project, size).toString());
}
return avatarUrls;
}
代码示例来源:origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin
public RemoteAvatar getProjectAvatar(final User user, final String projectKey, final String size) throws RemoteException, RemotePermissionException
{
boolean large = "large".equalsIgnoreCase(size);
final Project project = retrieveProjectByKey(projectKey, user);
return createRemoteAvatar(project.getAvatar(), large, new Base64InputStreamConsumer(true));
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
@Override
public Response apply(final Project project)
{
final Avatar selectedAvatar = project.getAvatar();
final Long selectedAvatarId = selectedAvatar.getId();
return responses.okNoCache(avatarResourceHelper.getAllAvatars(Avatar.Type.PROJECT, project.getId().toString(), selectedAvatarId));
}
});
代码示例来源:origin: com.atlassian.jira/jira-core
public String getAvatarUrl()
{
return ActionContext.getRequest().getContextPath() + "/secure/projectavatar?pid=" + getPid() + "&size=large&avatarId="
+ getProjectObject().getAvatar().getId();
}
代码示例来源:origin: com.atlassian.jira/jira-api
/**
* Build an Avatar representation for a local project avatar.
*
* @param project the project
* @return the RemoteAvatar representation of this local project avatar.
*/
public static RemoteAvatar from(final Project project)
{
Long avatarId = project.getAvatar().getId();
if (avatarId == null)
return null;
String baseUrl = ComponentAccessor.getComponent(JiraBaseUrls.class).baseUrl() + "/secure/projectavatar?avatarId=" + avatarId;
return new RemoteAvatar(baseUrl + "&size=xsmall",
baseUrl + "&size=small",
baseUrl + "&size=medium",
baseUrl
);
}
代码示例来源:origin: com.atlassian.jira/jira-core
@Override
protected Long validateInput(String projectId, Long avatarId, final HttpServletResponse response) throws IOException
{
if (StringUtils.isBlank(projectId))
{
// no project id - send default avatar for project
return getAvatarManager().getDefaultAvatarId(Avatar.Type.PROJECT);
}
else
{
final Project project = getProjectManager().getProjectObj(Long.parseLong(projectId));
if (project == null)
{
response.sendError(HttpServletResponse.SC_NOT_FOUND, "Unknown project");
return null;
}
if (!getAvatarManager().hasPermissionToView(getAuthenticationContext().getUser(), project))
{
// no permission to see any avatar for this project
response.sendError(HttpServletResponse.SC_FORBIDDEN, "Unknown project");
return null;
}
if (avatarId == null)
{
return project.getAvatar().getId();
}
}
return avatarId;
}
代码示例来源:origin: com.atlassian.jira/jira-core
private URI getProjectAvatarURLImpl(final Project project, final Avatar.Size size, final String baseUrl)
{
final Avatar avatar = project.getAvatar();
final Long avatarId = avatar == null ? null : avatar.getId();
if (avatarManager.getDefaultAvatarId(Avatar.Type.PROJECT).equals(avatarId))
{
return getProjectDefaultAvatarURLImpl(size, baseUrl);
}
UrlBuilder urlBuilder = new UrlBuilder(baseUrl + "/secure/projectavatar", applicationProperties.getEncoding(), false);
if (size != null && !size.isDefault)
{
urlBuilder.addParameter("size", size.param);
}
urlBuilder.addParameter("pid", project.getId());
if (avatarId != null)
{
urlBuilder.addParameter("avatarId", avatarId.toString());
}
return urlBuilder.asURI();
}
代码示例来源:origin: com.atlassian.jira/jira-core
if (project.getGenericValue().getLong("avatar") != null)
final Avatar avatar = project.getAvatar();
iconUrl = baseUrl + "/secure/projectavatar?pid=" + projectId + "&avatarId=" + avatar.getId() + "&size=small";
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
final Avatar avatar = project.getAvatar();
final ProjectBean projectBean = new ProjectBean(project.getId(), project.getName(), project.getKey(), relevantConfig.getId(), avatar == null ? null : avatar.getId());
recentProjectBeans.add(projectBean);
final FieldConfig relevantConfig = configScheme.getOneAndOnlyConfig();
relevantConfigs.add(relevantConfig);
final Avatar avatar = project.getAvatar();
final ProjectBean projectBean = new ProjectBean(project.getId(), project.getName(), project.getKey(), relevantConfig.getId(), avatar == null ? null : avatar.getId());
projectBeans.add(projectBean);
代码示例来源:origin: com.atlassian.jira/jira-gadgets-plugin
private DetailedProjectData getProjectDataNoPermissionCheck(ApplicationUser user, Project project, boolean showStats)
{
List<OpenIssuesData> openIssues = null;
String projectDescription = null;
boolean showOpen = false;
boolean showDescription = false;
if (showStats && isPriorityFieldVisible(project))
{
openIssues = getOpenIssuesData(project);
showOpen = true;
}
if (showStats && StringUtils.isNotBlank(project.getDescription()))
{
projectDescription = projectDescriptionRenderer.getViewHtml(project.getDescription());
showDescription = true;
}
final ApplicationUser lead = project.getLead();
return new DetailedProjectData(project.getId(), project.getKey(), project.getName(), project.getLeadUserName(), lead == null ? null : lead.getDisplayName(), openIssues, projectDescription, showOpen, showDescription,
project.getAvatar());
}
代码示例来源:origin: com.atlassian.jira.plugins/atlassian-jira-rpc-plugin
public void deleteProjectAvatar(final User user, final long avatarId) throws RemoteException
{
final Avatar avatar = avatarManager.getById(avatarId);
// only when the avtatar is system, the owner is null, but we check either since we cannot proceed either way
if (avatar == null || avatar.isSystemAvatar() || avatar.getOwner() == null)
{
throw new RemoteException("No such custom Avatar with id " + avatarId);
}
Project project = retrieveProjectForAdministration(user, Long.valueOf(avatar.getOwner()));
final boolean deletingTheCurrentAvatar = project.getAvatar().getId() == avatarId;
if (deletingTheCurrentAvatar)
{
// deleting the current one need to switch current avatar to default
final Long defaultAvatarId = avatarManager.getDefaultAvatarId(Avatar.Type.PROJECT);
final com.atlassian.jira.bc.project.ProjectService.UpdateProjectValidationResult updateProjectValidationResult = validateSetAvatar(user, project, defaultAvatarId);
if (updateProjectValidationResult.isValid())
{
projectService.updateProject(updateProjectValidationResult);
avatarManager.delete(avatarId, true);
}
}
else
{
avatarManager.delete(avatarId, true);
}
}
代码示例来源:origin: com.atlassian.jira/jira-core
public String doDefault() throws Exception
{
// check if the project exists:
if (getProjectObject() == null)
{
return handleProjectDoesNotExist();
}
if (!(hasProjectAdminPermission() || hasAdminPermission()))
{
return "securitybreach";
}
setName(getProjectObject().getName());
setAvatarId(getProjectObject().getAvatar() != null ? getProjectObject().getAvatar().getId() : null);
setLead(getProjectObject().getLeadUserName());
setUrl(getProjectObject().getUrl());
setDescription(getProjectObject().getDescription());
setAssigneeType(getProjectObject().getAssigneeType());
return INPUT;
}
代码示例来源:origin: com.atlassian.jira/jira-core
if (updatedProject.getAvatar() == null ||
!avatarId.equals(updatedProject.getAvatar().getId())) {
projectAvatarUpdateEvent = new ProjectAvatarUpdateEvent(updatedProject, avatarId);
代码示例来源:origin: com.atlassian.jira/jira-core
public String doDefault() throws Exception
{
// check if the project exists:
final Project projectObject = getProjectObject();
if (projectObject == null)
{
return handleProjectDoesNotExist();
}
if (!(hasProjectAdminPermission() || hasAdminPermission()))
{
return "securitybreach";
}
setName(projectObject.getName());
setLead(userKeyService.getUsernameForKey(projectObject.getLeadUserKey()));
setKeyEdited(false);
final String key = projectObject.getKey();
setKey(key);
setOriginalKey(key);
setUrl(projectObject.getUrl());
setDescription(projectObject.getDescription());
setAssigneeType(projectObject.getAssigneeType());
setAvatarId(projectObject.getAvatar().getId());
return INPUT;
}
代码示例来源:origin: com.atlassian.jira/jira-rest-plugin
firstIfNotNull(updateData.getUrl(), projectToEdit.getUrl()),
firstIfNotNull(updateData.getAssigneeTypeOrNull(), projectToEdit.getAssigneeType()),
firstIfNotNull(updateData.getAvatarId(), projectToEdit.getAvatar().getId()));
if (basicValidationResult.isValid())
内容来源于网络,如有侵权,请联系作者删除!