public int compare(final ApplicationLink applicationLink, final ApplicationLink applicationLink1) { if (applicationLink.isPrimary()) { return -1; } return 1; } });
public RestApplicationLink(@Nonnull ApplicationLink link) { super(link); this.system = link.isSystem(); this.primary = link.isPrimary(); }
public ApplicationLink getPrimaryApplicationLink(final Class<? extends ApplicationType> type) { final Iterator<ApplicationLink> iterator = getApplicationLinks(type).iterator(); if (!iterator.hasNext()) { // no applications of this type configured return null; } while (iterator.hasNext()) { final ApplicationLink application = iterator.next(); if (application.isPrimary()) { return application; } } throw new IllegalStateException("There are application links of type " + type + " configured, but none are " + "marked as primary"); }
public List<FishEyeInstance> getAuxiliaryFishEyeInstances() { Iterable<ApplicationLink> links = getAllFisheyeApplicationLinks(); List<ApplicationLink> auxLinks = new ArrayList<ApplicationLink>(); for (ApplicationLink l : links) { if (!l.isPrimary()) { auxLinks.add(l); } } return getFishEyeInstances(auxLinks); }
/** * Returns the {@link ApplicationLink} that corresponds to the given Confluence page uri. * @param pageUri The uri for the Confluence page. * @return The corresponding ApplicationLink for the given page uri, if there is any. */ public Option<ApplicationLink> forPage(final URI pageUri) { List<ApplicationLink> candidateAppLinks = getCandidateAppLinksForPage(pageUri); if (candidateAppLinks.isEmpty()) { return Option.none(); } for (ApplicationLink matchingAppLink : candidateAppLinks) { if (matchingAppLink.isPrimary()) { return Option.some(matchingAppLink); } } return Option.some(candidateAppLinks.get(0)); }
public ImmutableApplicationLink(final ApplicationLink that, final ApplicationLinkRequestFactoryFactory requestFactoryFactory) { checkNotNull(that, "that"); checkNotNull(requestFactoryFactory, "requestFactoryFactory"); this.applicationId = that.getId(); this.applicationType = that.getType(); this.name = that.getName(); this.displayUrl = that.getDisplayUrl(); this.rpcUrl = that.getRpcUrl(); this.isPrimary = that.isPrimary(); this.isSystem = that.isSystem(); this.requestFactoryFactory = requestFactoryFactory; }
/** * Creates a new {@link com.atlassian.applinks.spi.link.ApplicationLinkDetails.Builder} * initialized with the state from the supplied * {@link com.atlassian.applinks.api.ApplicationLink} instance. */ public static Builder builder(final ApplicationLink applicationLink) { final Builder builder = new Builder(); builder.displayUrl = applicationLink.getDisplayUrl(); builder.rpcUrl = applicationLink.getRpcUrl(); builder.name = applicationLink.getName(); builder.isPrimary = applicationLink.isPrimary(); return builder; }
private void addApplicationLinkInformation(SupportInfoBuilder builder) { for (ApplicationLink link : linkService.getApplicationLinks()) { SupportInfoBuilder linkBuilder = builder.addCategory(LINK); linkBuilder.addValue(LINK_NAME, link.getName()); linkBuilder.addValue(LINK_PRIMARY, String.valueOf(link.isPrimary())); linkBuilder.addValue(LINK_TYPE, link.getType().getI18nKey()); linkBuilder.addValue(LINK_DISPLAY_URL, link.getDisplayUrl().toString()); linkBuilder.addValue(LINK_RPC_URL, link.getRpcUrl().toString()); linkBuilder.addContext(link); } }
final ApplicationLinkProperties appLinkProperties = propertyService.getApplicationLinkProperties(link.getId()); TypeId typeId = appLinkProperties.getType(); boolean wasPrimary = link.isPrimary(); try { eventPublisher.publish(new BeforeApplicationLinkDeletedEvent(link));
public ApplicationLinkEntity(final ApplicationLink applicationLink, final Link self) { this(applicationLink.getId(), TypeId.getTypeId(applicationLink.getType()), applicationLink.getName(), applicationLink.getDisplayUrl(), applicationLink.getType().getIconUrl(), resolveIconUri(applicationLink.getType()), applicationLink.getRpcUrl(), applicationLink.isPrimary(), applicationLink.isSystem(), self); }
public ApplicationLinkEntity(final ApplicationId id, final TypeId typeId, final String name, final URI displayUrl, final URI iconUrl, final URI iconUri, final URI rpcUrl, final Boolean primary, final Boolean isSystem, final Link self) { this.id = id; this.typeId = typeId; this.name = name; this.displayUrl = displayUrl; this.iconUrl = iconUrl; this.iconUri = iconUri; this.isPrimary = primary; this.isSystem = isSystem; this.iconUri = iconUri; if (!isSystem()) { this.rpcUrl = rpcUrl; } addLink(self); }