public EntityTypeEntity(final EntityType type) { this.typeId = TypeId.getTypeId(type); }
/** * @param localType the {@link Class} of the {@link EntityType} to resolve an {@link TypeId} for * @return the {@link TypeId} of the specified {@link EntityType} * @throws IllegalStateException if the supplied class does not have an enabled implementation registered via the * {@code applinks-entity-link} module descriptor */ private TypeId lookUpTypeId(final Class<? extends EntityType> localType) { final EntityType type = typeAccessor.getEntityType(localType); if (type == null) { throw new IllegalStateException("Couldn't load " + localType.getName() + ", type not installed?"); } return TypeId.getTypeId(type); }
public String apply(@Nullable EntityType from) { return TypeId.getTypeId(from).get(); } }));
public String apply(@Nullable final EntityType from) { return TypeId.getTypeId(from).get(); } });
public String apply(@Nullable final EntityType from) { return TypeId.getTypeId(from).get(); } });
public String apply(@Nullable EntityType from) { return TypeId.getTypeId(from).get(); } }));
public String getApplicationType() { return TypeId.getTypeId(internalHostApplication.getType()).get(); }
public String getApplicationType() { return TypeId.getTypeId(internalHostApplication.getType()).get(); }
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 checkTargetIsSupportedJira(URI remoteUrl) { final Manifest manifest; try { manifest = manifestRetriever.getManifest(remoteUrl); } catch (ManifestNotFoundException e) { LOG.info("Failed to retrieve manifest from " + remoteUrl, e); return false; } if (!manifest.getTypeId().equals(TypeId.getTypeId(typeAccessor.getApplicationType(JiraApplicationType.class)))) { LOG.info(remoteUrl + " is not Jira"); return false; } // we don't need to test the version String as (lucky for us) JIRA 4.3 was the first version to ship UAL. return true; }
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); }
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 ReferenceEntity apply(final EntityReference from) { return new ReferenceEntity( from.getKey(), from.getName(), TypeId.getTypeId(from.getType()), IconUriResolver.resolveIconUri(from.getType()), from.getType().getIconUrl()); } }));
public ApplicationOption apply(final ApplicationLink from) { boolean isUal = false; try { isUal = manifestRetriever.getManifest( from.getRpcUrl(), from.getType()).getAppLinksVersion() != null; } catch (ManifestNotFoundException e) { } catch (Exception ex) { log.error("Could not retrieve manifest for applink, ignoring applink : {}", from); log.warn("Stack trace: ", ex); return null; } return new ApplicationOption( from.getId(), from.getName(), TypeId.getTypeId(from.getType()), from.getType().getI18nKey(), isUal, IconUriResolver.resolveIconUri(from.getType()) == null ? null : IconUriResolver.resolveIconUri(from.getType()).toString()); } }
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 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()); }