/** * @return the globally unique, immutable ID of the server at the other * end of this link. */ public ApplicationId getApplicationId() { return entityLink.getApplicationLink().getId(); }
/** * @return the type of the application e.g. "fecru" */ public ApplicationType getApplicationType() { return entityLink.getApplicationLink().getType(); }
private FishEyeRepository createRepository(EntityLink link) { return createRepository( link.getApplicationLink().getId(), link.getApplicationLink(), link.getKey() ); }
private Iterable<String> getJiraEntityLinkKeys(ApplicationLink appLink, Object entity) { List<String> keys = new LinkedList<>(); Iterable<EntityLink> entityLinks = entityLinkService.getEntityLinks(entity, JiraProjectEntityType.class); for (EntityLink link : entityLinks) { if (link.getApplicationLink().equals(appLink)) { keys.add(link.getKey()); } } return keys; } }
@Override public boolean apply(@Nullable EntityLink entityLink) { return entityLink != null && entityLink.getApplicationLink().getId().equals(applicationId); } });
public EntityLink makePrimary(final String localKey, final Class<? extends EntityType> localType, final EntityLink newPrimary) { checkNotNull(localKey); checkNotNull(localType); checkNotNull(newPrimary); //confirm that the entity is actually linked to from the specified local entity if (getEntityLink(localKey, localType, newPrimary.getKey(), newPrimary.getType().getClass(), newPrimary.getApplicationLink().getId()) == null) { throw new IllegalArgumentException(String.format( "Can not make %s the new primary, not linked to from local entity %s:%s", newPrimary, localType, localKey)); } makePrimaryImpl(localKey, localType, newPrimary); return newPrimary; }
public void createEntityLinkFrom(final EntityLink entityLink, final EntityType localType, final String localKey) throws ReciprocalActionException, CredentialsRequiredException { createEntityLinkFrom(entityLink, localType, localKey, entityLink.getApplicationLink().createAuthenticatedRequestFactory()); }
@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); }
where.append(" OR "); where.append("(site.").append(SiteMapping.APPLINK_ID).append(" = '").append(entityLink.getApplicationLink().getId().get()) .append("' AND job.").append(NAME).append(" = '").append(entityLink.getKey()).append("')");
public String apply(final EntityLink from) { final Map<String, String> propertyMap = new HashMap<String, String>(); propertyMap.put(KEY, from.getKey()); propertyMap.put(NAME, from.getName()); propertyMap.put(TYPE, getTypeId(from.getType()).get()); propertyMap.put(TYPE_I18N, from.getType().getI18nKey()); propertyMap.put(APPLICATION_ID, from.getApplicationLink().getId().get()); final StringWriter sw = new StringWriter(); try { new JSONObject(propertyMap).write(sw); } catch (JSONException e) { throw new RuntimeException(e); } return sw.getBuffer().toString(); } }));
public boolean apply(final EntityLink input) { if (applicationLink.getId().equals(input.getApplicationLink().getId())) { return true; } else { return false; } } }));
private static boolean equivalent(final EntityLink a, final EntityLink b) { return equivalent(a, b.getKey(), b.getType().getClass(), b.getApplicationLink().getId()); }
private void makePrimaryImpl(final String localKey, final Class<? extends EntityType> localType, final EntityLink newEntity) { final String primaryPropertyKey = primaryPropertyKey(getTypeId(newEntity.getType())); final Properties primary = new Properties(); primary.put(KEY, newEntity.getKey()); primary.put(APPLICATION_ID, newEntity.getApplicationLink().getId().get()); if (LOG.isDebugEnabled()) { String message = String.format("Set primary link for [%s] [%s] as [%s]", localKey, lookUpTypeId(localType), primary); LOG.debug(message); } propertyService.getLocalEntityProperties(localKey, lookUpTypeId(localType)).putProperty(primaryPropertyKey, primary); }
/** * 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)); }
@Override public EntityLinkReference apply(@Nullable EntityLink link) { if (link == null) { return null; } else { return new EntityLinkReference(link.getKey(), link.getName(), link.getApplicationLink().getId().get(), link.isPrimary()); } } }));
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 boolean refersTo(final EntityLink link) { return refersTo(link.getKey(), getTypeId(link.getType()), link.getApplicationLink().getId()); } }
private String key(final EntityLink entity) { return String.format("%s.%s.%s.%s", ENTITY_PREFIX, escape(entity.getApplicationLink().getId().get()), escape(getTypeId(entity.getType()).get()), escape(entity.getKey()) ); }
public EntityLinkEntity(final EntityLink entity) { this(entity.getApplicationLink().getId(), entity.getKey(), TypeId.getTypeId(entity.getType()), entity.getName(), entity.getDisplayUrl(), IconUriResolver.resolveIconUri(entity.getType()), entity.getType().getIconUrl(), entity.isPrimary()); }