@Override public boolean equals(Object o) { if (o instanceof Site) { Site other = (Site) o; return applicationId.equals(other.applicationId); } return false; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final ImmutableApplicationLink that = (ImmutableApplicationLink) o; return applicationId != null ? applicationId.equals(that.applicationId) : that.applicationId == null; }
@Override public boolean equals(Object o) { if (this == o) return true; if (o == null || getClass() != o.getClass()) return false; FishEyeInstanceImpl that = (FishEyeInstanceImpl) o; if (applicationId != null ? !applicationId.equals(that.applicationId) : that.applicationId != null) return false; return true; }
@Override public boolean equals(final Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } final DefaultApplicationLink that = (DefaultApplicationLink) o; if (id != null ? !id.equals(that.id) : that.id != null) { return false; } return true; }
public boolean refersTo(final String key, final TypeId type, final ApplicationId applicationId) { return this.key.equals(key) && this.type.equals(type) && this.applicationId.equals(applicationId); }
@Nonnull public static Predicate<ApplinkRow> hasApplinkWithId(@Nonnull final ApplicationId id) { checkNotNull(id, "id"); return row -> id.equals(row.getId()); }
@Override public boolean apply(final ReadOnlyApplicationLink input) { return applicationId.equals(input.getId()); } };
@Nonnull public static Predicate<ReadOnlyApplicationLink> withId(@Nonnull final ApplicationId applicationId) { checkNotNull(applicationId, "applicationId"); return link -> link != null && applicationId.equals(link.getId()); }
@Override public boolean apply(@Nullable EntityLink entityLink) { return entityLink != null && entityLink.getApplicationLink().getId().equals(applicationId); } });
public boolean apply(ApplicationLink appLink) { return appLink.getName().equals(name) && !appLink.getId().equals(id); } });
@Override public boolean apply(@Nullable EntityLink entityLink) { return entityLink != null && applicationId.equals(entityLink.getApplicationLink().getId()) && remoteKey.equals (entityLink.getKey()); } };
private static boolean equivalent(final EntityLink a, final String key, final Class<? extends EntityType> type, final ApplicationId applicationId) { return a.getKey().equals(key) && a.getType().getClass().equals(type) && a.getApplicationLink().getId().equals(applicationId); }
public boolean apply(final EntityLink input) { if (applicationLink.getId().equals(input.getApplicationLink().getId())) { return true; } else { return false; } } }));
/** * The URL is passed in a path parameter by old client code, so we must accept requests of that form. * New clients should use the query parameter which survives proxies better. If the query parameter * is present, use it and ignore the path parameter. (APL-663) */ @GET @Path("id/{applinkId}/url/{url:.*$}") public Response rpcUrlIsReachable(@PathParam("applinkId") String applicationId, @PathParam("url") URI uri, @QueryParam("url") URI qUrl) { if (qUrl != null) { uri = qUrl; } try { final Manifest manifest = downloader.download(uri); if (manifest.getId().equals(new ApplicationId(applicationId))) { return ok(); } else { return notFound(""); } } catch (ManifestNotFoundException e) { return notFound(""); } } }
/** * Returns all local entities that have links to entities in the supplied * application link. This is used by the upgrade wizard when it needs to * create a decent description for the reciprocate-entity-links checkbox. * The generated wording contains the internationalised names of the local * entity types. * * @param id the id of a local applink. * @return all {@link EntityReference}s that have entity links to the given applink. */ @GET @Path("localEntitiesWithLinksTo/{applinkId}") public Response getLocalEntitiesWithLinksToApplication(@PathParam("applinkId") final ApplicationId id) { final Set<EntityReference> linkedLocalEntities = new HashSet<EntityReference>(); for (EntityReference ref : internalHostApplication.getLocalEntities()) // correctly returns only the visible ones { for (EntityLink link : entityLinkService.getEntityLinksForKey(ref.getKey(), ref.getType().getClass())) { if (id.equals(link.getApplicationLink().getId())) { linkedLocalEntities.add(ref); } } } return ok(new ReferenceEntityList(linkedLocalEntities)); }
private ApplicationLink getApplicationLinkByIdOrName(String id) throws TypeNotInstalledException { ApplicationId appId = null; try { appId = new ApplicationId(id); } catch (IllegalArgumentException ex) { // not a valid id, try for name; } for (ApplicationLink link : appLinkService.getApplicationLinks()) { if ((appId == null && link.getName().equals(id)) || (appId != null && link.getId().equals(appId))) { return link; } } return null; }
public void makePrimary(final ApplicationId id) throws TypeNotInstalledException { applicationIdsLock.lock(); if (LOG.isDebugEnabled()) { LOG.debug("Making application link id [{}] primary", id.get()); } try { final InternalApplicationLink internalApplicationLink = getApplicationLink(id); if (internalApplicationLink == null) { throw new IllegalArgumentException("No application link with ID=" + id); } final Iterable<InternalApplicationLink> applicationLinksOfType = getInternalApplicationLinks(internalApplicationLink.getType().getClass()); for (final InternalApplicationLink link : applicationLinksOfType) { if (link.getId().equals(id)) { link.setPrimaryFlag(true); } else { link.setPrimaryFlag(false); } } eventPublisher.publish(new ApplicationLinkMadePrimaryEvent(internalApplicationLink)); } finally { applicationIdsLock.unlock(); } }
public boolean apply(final EntityLink input) { if (link.getId().equals(input.getApplicationLink().getId())) { // we're going to delete this - check if it is a primary link we're going to need to reassign if (!typesForWhichToReassignPrimaries.contains(input.getType().getClass())) { final PrimaryRef primary = getPrimaryRef(localEntity.getKey(), getTypeId(localEntity.getType()), getTypeId(input.getType())); if (primary.refersTo(input)) { typesForWhichToReassignPrimaries.add(input.getType().getClass()); } } removedEntityLinks.add(input); return false; } else { //this is not the link you are looking for, move along return true; } } }));
public void update(FishEyeInstance updatedFishEyeInstance) { FishEyeInstance oldInstance = fishEyeInstanceStore.getFishEyeInstance(checkNotNull(updatedFishEyeInstance.getId())); if (oldInstance == null) { throw new IllegalArgumentException(String.format("Cannot update an instance that does not exist: [%s]", updatedFishEyeInstance)); } if (!oldInstance.getApplicationId().equals(updatedFishEyeInstance.getApplicationId())) { applicationLinkIdMapper.dissociate(updatedFishEyeInstance.getId(), oldInstance.getApplicationId()); applicationLinkIdMapper.associate(updatedFishEyeInstance.getId(), updatedFishEyeInstance.getApplicationId()); } fishEyeInstanceStore.updateFishEyeInstance(updatedFishEyeInstance); fishEyeManager.refreshConfig(); }
@Override public ApplicationLinkState callWithContext() throws Exception { if (manifestRetriever.getApplicationStatus(applicationLink.getRpcUrl(), applicationLink.getType()) == ApplicationStatus.UNAVAILABLE) { return ApplicationLinkState.OFFLINE; } else { try { final Manifest manifest = manifestRetriever.getManifest(applicationLink.getRpcUrl(), applicationLink.getType()); if (!applicationLink.getId().equals(manifest.getId())) { if (manifest.getAppLinksVersion() != null && manifest.getAppLinksVersion().getMajor() >= 3) { return ApplicationLinkState.UPGRADED_TO_UAL; } else { return ApplicationLinkState.UPGRADED; } } } catch (ManifestNotFoundException e) { // unknown application type LOG.error("The {} application type failed to produce a " + "Manifest for Application Link {}, so we cannot " + "determine the link status.", TypeId.getTypeId( applicationLink.getType()).toString(), applicationLink.getId().toString()); } return ApplicationLinkState.OK; } } });