예제 #1
0
 @PermitAll
 @PUT
 @Consumes({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
 @Mapped(namespaceMap = {@XmlNsMap(namespace = "http://emf-rest.com/proxy", jsonName = "proxy")})
 public void updateDaughter(DaughterImpl object) {
   resourceSaver.put(EcoreUtil.getIdentification(instance), object);
 }
예제 #2
0
 private EObject getEObjectByID(String id) {
   TreeIterator<EObject> eAllContents = resourceLoader.getResource().getAllContents();
   while (eAllContents.hasNext()) {
     EObject next = eAllContents.next();
     if (EcoreUtil.getIdentification(next).equals(id)) return next;
   }
   throw new WebApplicationException(Response.Status.NOT_FOUND);
 }
  public String getObjectLabel(EObject eObject) {
    if (eObject == null) {
      return String.valueOf(eObject);
    }
    if (eObject instanceof EStructuralFeature) {
      return getFeatureLabel((EStructuralFeature) eObject);
    } else if (eObject instanceof ENamedElement) {
      return qualifiedName((ENamedElement) eObject, new StringBuffer()).toString();
    }

    String displayName = toDisplayName(eObject);
    return (displayName != null) ? displayName : EcoreUtil.getIdentification(eObject);
  }
 private String toDisplayName(EObject eObject) {
   IItemLabelProvider labelAdapter =
       (IItemLabelProvider)
           EcoreUtil.getRegisteredAdapter(
               EcorePackage.eINSTANCE.getEAnnotation(), IItemLabelProvider.class);
   if (labelAdapter == null) {
     labelAdapter =
         (IItemLabelProvider) ecoreLabelProviderFactory.adapt(eObject, IItemLabelProvider.class);
   }
   String label = null;
   try {
     label = labelAdapter.getText(eObject);
   } catch (RuntimeException e) {
     // Ensure fault isolation of the item provider
     label = EcoreUtil.getIdentification(eObject);
   }
   return label;
 }
예제 #5
0
 @PermitAll
 @DELETE
 @Mapped(namespaceMap = {@XmlNsMap(namespace = "http://emf-rest.com/proxy", jsonName = "proxy")})
 public void deleteDaughter() {
   resourceSaver.remove(EcoreUtil.getIdentification(instance));
 }