@Override
  public EClass eClass() {
    if (eClass == null) {
      ePackage = EcoreFactory.eINSTANCE.createEPackage();
      eClass = EcoreFactory.eINSTANCE.createEClass();
      ePackage.getEClassifiers().add(eClass);

      eClass.setName("StringWrapper"); // $NON-NLS-1$
      eClass.getESuperTypes().add(XMLTypePackage.eINSTANCE.getAnyType());
      ExtendedMetaData.INSTANCE.setName(eClass, ""); // $NON-NLS-1$
      eClass.setInstanceClass(AnyType.class);

      EAttribute eAttribute = EcoreFactory.eINSTANCE.createEAttribute();
      eAttribute.setName("value"); // $NON-NLS-1$
      eAttribute.setChangeable(true);
      eAttribute.setUnsettable(true);
      eAttribute.setEType(EcorePackage.eINSTANCE.getEClassifier("EString")); // $NON-NLS-1$
      eClass.getEStructuralFeatures().add(eAttribute);

      //			ExtendedMetaData.INSTANCE.setNamespace(eAttribute, ePackage.getNsURI());
      ExtendedMetaData.INSTANCE.setFeatureKind(eAttribute, ExtendedMetaData.ATTRIBUTE_FEATURE);
      ExtendedMetaData.INSTANCE.setName(eAttribute, "value"); // $NON-NLS-1$
    }
    return eClass;
  }
 @Override
 public FeatureId getIdentifier() {
   //
   // Create id?
   //
   if (eID == null) {
     //
     // Get EMF id attribute
     //
     EAttribute eIDAttribute = eStructure().eIDAttribute();
     //
     // Get feature id as string
     //
     String fid =
         (eIDAttribute == null || !eFeature().eIsSet(eIDAttribute)
             ? null
             : EcoreUtil.convertToString(
                 eIDAttribute.getEAttributeType(), eFeature().eGet(eIDAttribute)));
     //
     // Create feature id instance
     //
     eID = new FeatureIdImpl(fid);
   }
   //
   // Finished
   //
   return eID;
 }
Example #3
0
  private void fillEAttribute(EObject container, JsonNode root) {
    final EClass eClass = container.eClass();

    // Iterates over all key values of the JSON Object,
    // if the value is not an object then
    // if the key corresponds to an EAttribute, fill it
    // if not and the EClass contains a MapEntry, fill it with the key, value.
    for (Iterator<Entry<String, JsonNode>> it = root.getFields(); it.hasNext(); ) {
      Entry<String, JsonNode> field = it.next();

      String key = field.getKey();
      JsonNode value = field.getValue();

      if (value.isObject()) // not an attribute
      continue;

      EAttribute attribute = getEAttribute(eClass, key);
      if (attribute != null && !attribute.isTransient() && !attribute.isDerived()) {
        if (value.isArray()) {
          for (Iterator<JsonNode> itValue = value.getElements(); itValue.hasNext(); ) {
            setEAttributeValue(container, attribute, itValue.next());
          }
        } else {
          setEAttributeValue(container, attribute, value);
        }
      } else {
        EStructuralFeature eFeature = getDynamicMapEntryFeature(eClass);
        if (eFeature != null) {
          @SuppressWarnings("unchecked")
          EList<EObject> values = (EList<EObject>) container.eGet(eFeature);
          values.add(createEntry(key, value));
        }
      }
    }
  }
  @Override
  protected void bindAttribute(
      Composite parent, EObject object, EAttribute attribute, String label) {
    if ("independent".equals(attribute.getName())) {
      independentEditor = new BooleanObjectEditor(this, object, attribute);
      independentCheckbox = (Button) independentEditor.createControl(parent, label);
      if (waitForCompletionCheckbox != null && waitForCompletionCheckbox.getSelection() == false) {
        independentCheckbox.setEnabled(false);
      }
    } else if ("waitForCompletion".equals(attribute.getName())) {
      ObjectEditor editor = new BooleanObjectEditor(this, object, attribute);
      waitForCompletionCheckbox = (Button) editor.createControl(parent, label);
      waitForCompletionCheckbox.addSelectionListener(
          new SelectionListener() {

            @Override
            public void widgetSelected(SelectionEvent e) {
              boolean checked = waitForCompletionCheckbox.getSelection();
              if (!checked) {
                independentCheckbox.setEnabled(false);
                independentEditor.setValue(Boolean.TRUE);
              } else {
                independentCheckbox.setEnabled(true);
              }
            }

            @Override
            public void widgetDefaultSelected(SelectionEvent e) {}
          });
      if (waitForCompletionCheckbox.getSelection() == false) {
        if (independentCheckbox != null) independentCheckbox.setEnabled(false);
      }
    } else super.bindAttribute(parent, object, attribute, label);
  }
  /**
   * Create an OCL condition from the given {@link Object} of type {@link EAttribute}.<br>
   * Subclasses may use information from the <code>eAttribute</code> to refine the condition.
   *
   * <p>Example:<br>
   * A String attribute called <code>foo</code> containing the value <code>"bar"</code> results in
   * the condition <code>self.foo = 'bar'</code> .
   *
   * @param eAttribute The type of the object.
   * @param obj The object for which the condition should be created.
   * @return An ocl condition which describes this object.
   */
  protected String eAttributeToCondition(EAttribute eAttribute, Object obj) {
    final String prefix = ""; // "self.";
    if (obj instanceof List<?>) {
      // recursive call for lists :-)
      return prefix
          + eAttribute.getName()
          + "->asSequence() = "
          + listAttributeToString((List<?>) obj);

    } else if (obj instanceof Enum) {
      final Class<?> declaringClass = ((Enum<?>) obj).getDeclaringClass();
      /*
       *  the quotes " are required to escape keywords, e.g. VisibilityKind::"package".
       *  if the quotes are missing, then the visibility 'package' collides with the ocl keyword 'package'.
       */
      return prefix
          + eAttribute.getName()
          + " = "
          + declaringClass.getSimpleName()
          + "::\""
          + ((Enum<?>) obj).toString()
          + "\"";

    } else if (obj == null) {
      // FIXME: unfortunately, the OCL implementation does not work with
      // OclVoid as null! workaround: create set and check if it is empty :o)
      return prefix + eAttribute.getName() + "->asSet()->isEmpty()";

    } else {
      // handle primitive types
      return prefix + eAttribute.getName() + " = " + primitiveAttributeToString(obj);
    }
  }
  @Override
  protected Object doExecute() throws Exception {
    final Map<String, SysConfig> sysConfigMap = appCtx.getBean("sysConfigMap", Map.class);
    if (sysConfigMap.isEmpty()) {
      System.err.println("No tenant SysConfigs found");
      return null;
    }
    System.out.print(ansi().render("@|negative_on %3s|%-15s|@", "â„–", "Tenant ID"));
    final SysConfig first = sysConfigMap.values().iterator().next();
    final List<EAttribute> attrs = new ArrayList<>();
    for (EAttribute attr : first.eClass().getEAttributes()) {
      attrs.add(attr);
      System.out.print(ansi().render("@|negative_on |%-25s|@", attr.getName()));
    }
    System.out.println();

    int i = 0;
    for (final Entry<String, SysConfig> entry : sysConfigMap.entrySet()) {
      SysConfig sysConfig = entry.getValue();
      System.out.print(ansi().render("@|bold,black %3d||@%-15s", ++i, entry.getKey()));
      for (EAttribute attr : attrs) {
        System.out.print(ansi().render("@|bold,black ||@%-25s", sysConfig.eGet(attr)));
      }
      System.out.println();
    }
    System.out.println(ansi().render("@|bold %d|@ tenant SysConfigs", i));
    return null;
  }
  @Override
  public void load() {
    Object value = getElementText(node);
    if (feature instanceof EAttribute) {
      EAttribute ea = (EAttribute) feature;
      value = EcoreUtil.createFromString(ea.getEAttributeType(), value.toString());
    }

    modelObject.eSet(feature, value);
  }
  @Override
  public Object caseEAttribute(EAttribute object) {
    Attribute attrib = new Attribute(object.getName());

    attrib.type = getType(object.getEType());
    attrib.setBounds(object.getLowerBound(), object.getUpperBound());
    attrib.setStatic(false);
    attrib.setScope(Scope.PUBLIC);
    return attrib;
  }
 protected void handleNotificationEvent(Notification event) {
   Object feature = event.getFeature();
   if (feature instanceof EAttribute) {
     EAttribute attr = (EAttribute) feature;
     if ("name".equals(attr.getName())) {
       ((DisplayOutTypeFigure) this.getConnectionFigure()).refresh();
     }
   }
   super.handleNotificationEvent(event);
 }
  /**
   * This defines which attributes are used for building the OCL condition. The default
   * implementation uses only the primitive types contained in {@link
   * ElementSetReferenceCreator#PRIMITIVE_TYPES} and enumeration types.
   *
   * <p>Furthermore, all derived attributes are ignored. This is due to an issue with UML models.
   *
   * <p>Subclasses may override this to refine the set of types.
   *
   * @param eAttribute An {@link EAttribute} in the transformation.
   * @return <code>true</code>, if the attribute should be part of the condition; <code>false</code>
   *     otherwise.
   */
  protected boolean isRelevantAttribute(EAttribute eAttribute) {

    // is it an enumeration?
    if (eAttribute.getEType() instanceof EEnum) {
      return true;
    }

    // is it one of the supported primitive types?
    return PRIMITIVE_TYPES.contains(eAttribute.getEType().getInstanceClassName())
        && !eAttribute.isDerived();
  }
Example #11
0
  private static void checkObject(
      EObject expected,
      EObject actual,
      Set<EStructuralFeature> excludeFeatures,
      Set<EObject> visited) {
    if (expected == null) {
      assertThat(actual, is(nullValue()));
      return;
    }

    if (visited.contains(expected)) return;

    visited.add(expected);

    assertThat(
        "Actual instance for type '" + expected.eClass().getName() + "' must not be null",
        actual,
        is(notNullValue()));

    for (EAttribute attribute : expected.eClass().getEAllAttributes()) {
      if (!excludeFeatures.contains(attribute))
        assertThat(
            "Attribute '"
                + attribute.getName()
                + "' on class '"
                + expected.eClass().getName()
                + "' did not match",
            actual.eGet(attribute),
            is(expected.eGet(attribute)));
    }

    for (EReference reference : expected.eClass().getEAllReferences()) {
      if (excludeFeatures.contains(reference)) continue;

      if (reference.isMany()) {
        @SuppressWarnings("unchecked")
        EList<EObject> expectedObjects = (EList<EObject>) expected.eGet(reference);
        @SuppressWarnings("unchecked")
        EList<EObject> actualObjects = (EList<EObject>) actual.eGet(reference);
        assertThat(
            "Reference size for '" + reference.getName() + "' does not match",
            actualObjects.size(),
            is(expectedObjects.size()));

        for (int i = 0; i < expectedObjects.size(); i++)
          checkObject(expectedObjects.get(i), actualObjects.get(i), excludeFeatures, visited);
      } else
        checkObject(
            (EObject) expected.eGet(reference),
            (EObject) actual.eGet(reference),
            excludeFeatures,
            visited);
    }
  }
 public Object[] getDefaultValues(org.eclipse.emf.ecore.EAttribute attribute) {
   String typeName = attribute.getEType().getName();
   if ("EString".equals(typeName)) {
     return new Object[] {
       "some" + ASPMM.resource.ASPMM.util.ASPMMStringUtil.capitalize(attribute.getName())
     };
   }
   if ("EBoolean".equals(typeName)) {
     return new Object[] {Boolean.TRUE, Boolean.FALSE};
   }
   return new Object[] {attribute.getDefaultValue()};
 }
 /**
  * {@inheritDoc}
  *
  * @see org.eclipse.emf.compare.diff.merge.api.AbstractMerger#applyInOrigin()
  */
 @Override
 public void applyInOrigin() {
   final AttributeChangeLeftTarget theDiff = (AttributeChangeLeftTarget) this.diff;
   final EObject origin = theDiff.getLeftElement();
   final Object value = theDiff.getLeftTarget();
   final EAttribute attr = theDiff.getAttribute();
   try {
     EFactory.eRemove(origin, attr.getName(), value);
   } catch (FactoryException e) {
     EMFComparePlugin.log(e, true);
   }
   super.applyInOrigin();
 }
  /**
   * Returns true if we can set the given attribute with a "name" feature of an
   * instanciationInstruction.
   *
   * @param attribute the attribute to inspect
   * @return true if the given attribute is of type EString and is named 'name' or is an ID
   *     attribute
   */
  private static boolean isConcernedByNameAttribute(EAttribute attribute) {

    // Case 1 : true if the attribute is defined as ID and is of type EString
    boolean isConcernedByNameAttribute =
        attribute.isID() && ("EString".equals(attribute.getEAttributeType().getName()));

    // Case 2 : true if the attribute's name is "name" and is of type EString
    isConcernedByNameAttribute =
        isConcernedByNameAttribute
            || ("name".equals(attribute.getName())
                && ("EString".equals(attribute.getEAttributeType().getName())));
    return isConcernedByNameAttribute;
  }
 public java.lang.Object[] getDefaultValues(org.eclipse.emf.ecore.EAttribute attribute) {
   String typeName = attribute.getEType().getName();
   if ("EString".equals(typeName)) {
     return new java.lang.Object[] {
       "some"
           + west.twouse.language.sparqlas.resource.sparqlas.util.SparqlasStringUtil.capitalize(
               attribute.getName())
     };
   }
   if ("EBoolean".equals(typeName)) {
     return new java.lang.Object[] {Boolean.TRUE, Boolean.FALSE};
   }
   return new java.lang.Object[] {attribute.getDefaultValue()};
 }
 public static void printAttributeValues(EObject object) {
   EClass eClass = object.eClass();
   System.out.println(eClass.getName());
   for (Iterator iter = eClass.getEAllAttributes().iterator(); iter.hasNext(); ) {
     EAttribute attribute = (EAttribute) iter.next();
     Object value = object.eGet(attribute);
     System.out.print("  " + attribute.getName() + ": " + value);
     if (object.eIsSet(attribute)) {
       System.out.println(); // attribute is set
     } else {
       System.out.println(" (default)"); // attribute is not set
     }
   }
 } // printAttributeValues
 public Object[] getDefaultValues(EAttribute attribute) {
   String typeName = attribute.getEType().getName();
   if ("EString".equals(typeName)) {
     return new Object[] {
       "some"
           + org.dresdenocl.language.ocl.resource.ocl.util.OclStringUtil.capitalize(
               attribute.getName())
     };
   }
   if ("EBoolean".equals(typeName)) {
     return new Object[] {Boolean.TRUE, Boolean.FALSE};
   }
   return new Object[] {attribute.getDefaultValue()};
 }
  private String matches(
      org.eclipse.emf.ecore.EObject element, String identifier, boolean matchFuzzy) {
    // first check for attributes that have set the ID flag to true
    java.util.List<org.eclipse.emf.ecore.EStructuralFeature> features =
        element.eClass().getEStructuralFeatures();
    for (org.eclipse.emf.ecore.EStructuralFeature feature : features) {
      if (feature instanceof org.eclipse.emf.ecore.EAttribute) {
        org.eclipse.emf.ecore.EAttribute attribute = (org.eclipse.emf.ecore.EAttribute) feature;
        if (attribute.isID()) {
          Object attributeValue = element.eGet(attribute);
          String match = matches(identifier, attributeValue, matchFuzzy);
          if (match != null) {
            return match;
          }
        }
      }
    }

    // then check for an attribute that is called 'name'
    org.eclipse.emf.ecore.EStructuralFeature nameAttr =
        element.eClass().getEStructuralFeature(NAME_FEATURE);
    if (nameAttr instanceof org.eclipse.emf.ecore.EAttribute) {
      Object attributeValue = element.eGet(nameAttr);
      return matches(identifier, attributeValue, matchFuzzy);
    } else {
      // try any other string attribute found
      for (org.eclipse.emf.ecore.EAttribute stringAttribute :
          element.eClass().getEAllAttributes()) {
        if ("java.lang.String".equals(stringAttribute.getEType().getInstanceClassName())) {
          Object attributeValue = element.eGet(stringAttribute);
          String match = matches(identifier, attributeValue, matchFuzzy);
          if (match != null) {
            return match;
          }
        }
      }

      for (org.eclipse.emf.ecore.EOperation o : element.eClass().getEAllOperations()) {
        if (o.getName().toLowerCase().endsWith(NAME_FEATURE) && o.getEParameters().size() == 0) {
          String result = (String) ssl.resource.ssl.util.SslEObjectUtil.invokeOperation(element, o);
          String match = matches(identifier, result, matchFuzzy);
          if (match != null) {
            return match;
          }
        }
      }
    }
    return null;
  }
 public void testErrorMessage_04() {
   EClass eClass = createEClass();
   eClass.setName("EClassName");
   EAttribute attribute = EcoreFactory.eINSTANCE.createEAttribute();
   attribute.setName("Attribute");
   eClass.getEStructuralFeatures().add(attribute);
   IEObjectDescription description =
       EObjectDescription.create(QualifiedName.create(attribute.getName()), attribute);
   String errorMessage =
       helper.getDuplicateNameErrorMessage(
           description,
           EcorePackage.Literals.EATTRIBUTE,
           EcorePackage.Literals.ENAMED_ELEMENT__NAME);
   assertEquals("Duplicate EAttribute 'Attribute' in EClass 'EClassName'", errorMessage);
 }
  /**
   * Returns a list of potential identifiers that may be used to reference the given element. This
   * method can be overridden to customize the identification of elements.
   */
  public List<String> getNames(EObject element) {
    List<String> names = new ArrayList<String>();

    // first check for attributes that have set the ID flag to true
    List<EAttribute> attributes = element.eClass().getEAllAttributes();
    for (EAttribute attribute : attributes) {
      if (attribute.isID()) {
        Object attributeValue = element.eGet(attribute);
        if (attributeValue != null) {
          names.add(attributeValue.toString());
        }
      }
    }

    // then check for an attribute that is called 'name'
    EStructuralFeature nameAttr = element.eClass().getEStructuralFeature(NAME_FEATURE);
    if (nameAttr instanceof EAttribute) {
      Object attributeValue = element.eGet(nameAttr);
      if (attributeValue != null) {
        names.add(attributeValue.toString());
      }
    } else {
      // try any other string attribute found
      for (EAttribute attribute : attributes) {
        if ("java.lang.String".equals(attribute.getEType().getInstanceClassName())) {
          Object attributeValue = element.eGet(attribute);
          if (attributeValue != null) {
            names.add(attributeValue.toString());
          }
        }
      }

      // try operations without arguments that return strings and which have a name that
      // ends with 'name'
      for (EOperation operation : element.eClass().getEAllOperations()) {
        if (operation.getName().toLowerCase().endsWith(NAME_FEATURE)
            && operation.getEParameters().size() == 0) {
          Object result =
              org.emftext.sdk.concretesyntax.resource.cs.util.CsEObjectUtil.invokeOperation(
                  element, operation);
          if (result != null) {
            names.add(result.toString());
          }
        }
      }
    }
    return names;
  }
  public void testCustomDefaultLiteral() throws CommitException {
    // valid default literal
    att.setDefaultValueLiteral("1;2");

    EObject obj = EcoreUtil.create(cls);
    obj.eUnset(att);

    {
      CDOSession session = openSession();
      session.getPackageRegistry().putEPackage(pkg);
      CDOTransaction tx = session.openTransaction();
      CDOResource res = tx.createResource(getResourcePath("/test"));
      res.getContents().add(obj);
      tx.commit();
      tx.close();
      session.close();
    }

    clearCache(getRepository().getRevisionManager());

    {
      CDOSession session = openSession();
      session.getPackageRegistry().putEPackage(pkg);
      CDOView v = session.openView();
      CDOResource res = v.getResource(getResourcePath("/test"));
      EObject persistent = res.getContents().get(0);

      CustomType pCustom = (CustomType) persistent.eGet(att);
      assertEquals(1, pCustom.getA());
      assertEquals(2, pCustom.getB());

      v.close();
      session.close();
    }
  }
 public static String getName(EObject obj) {
   if (obj == null) return null;
   if (obj instanceof ENamedElement) return ((ENamedElement) obj).getName();
   List allAtts = obj.eClass().getEAllAttributes();
   int size = allAtts.size();
   EAttribute att, nameAttribute = null;
   for (int i = 0; i < size; i++) {
     att = (EAttribute) allAtts.get(i);
     if (NAME_ATTRIBUTE_STRING.equals(att.getName())) {
       nameAttribute = att;
       break;
     }
   }
   if (nameAttribute != null) return (String) obj.eGet(nameAttribute);
   return null;
 }
  private void setEnabledAll(boolean enabled) {
    for (EClass e : elementSet) {
      prefs.putBoolean(e.getName(), enabled);

      for (EAttribute a : e.getEAllAttributes()) {
        prefs.putBoolean(e.getName() + "." + a.getName(), enabled);
      }

      for (EReference a : e.getEAllContainments()) {
        prefs.putBoolean(e.getName() + "." + a.getName(), enabled);
      }

      for (EReference a : e.getEAllReferences()) {
        prefs.putBoolean(e.getName() + "." + a.getName(), enabled);
      }
    }
  }
Example #24
0
 @Test
 public void cast() {
   final EClassifier[] types =
       new EClassifier[] {
         EcorePackage.eINSTANCE.getEInt(),
         EcorePackage.eINSTANCE.getEFloat(),
         EcorePackage.eINSTANCE.getEDouble()
       };
   final Object[] values = new Object[] {1, 1F, 1D};
   for (int i = 0; i < types.length; i++) {
     EClassifier classifier = types[i];
     EAttribute attribute = FACTORY.createEAttribute();
     attribute.setEType(classifier);
     eClass0.getEStructuralFeatures().add(attribute);
     assertEquals(values[i], EMFUtils.cast(values[(i + 1) % values.length], attribute));
   }
 }
Example #25
0
 /**
  * Converts the value of an EAttribute with isMany==false, the value is converted ( {@link
  * #convertEAttributeValue(Object, EDataType)}) and set in the correct feature in the {@link
  * ModelObject}.
  *
  * @param eObject the eObject from which the value is read
  * @param modelObject the @[link ModelObject} in which the value is to be set
  * @param eAttribute the EAttribute which is converted
  * @see #convertEAttributeValue(Object, EDataType)
  */
 protected void convertSingleEAttribute(
     final EObject eObject, final ModelObject<?> modelObject, final EAttribute eAttribute) {
   if (!eObject.eIsSet(eAttribute)) {
     return;
   }
   final Object eValue = eObject.eGet(eAttribute);
   modelObject.eSet(eAttribute, convertEAttributeValue(eValue, eAttribute.getEAttributeType()));
 }
  @SuppressWarnings({"unchecked", "rawtypes"})
  private void updateAttrs(
      EClass eClass, EObject eParentObj, EObject eObj, EObject eRef, EObject eDef) {

    List<EAttribute> listMany = new LinkedList<EAttribute>();
    List<EAttribute> list = new LinkedList<EAttribute>();

    for (EAttribute eAttr : eClass.getEAllAttributes()) {
      if (eAttr.isMany()) {
        listMany.add(eAttr);
      } else {
        list.add(eAttr);
      }
    }

    for (EAttribute eAttr : listMany) {
      List<?> vList = (List<?>) eObj.eGet(eAttr);
      if (vList.size() == 0) {
        if (eRef != null && ((List<?>) eRef.eGet(eAttr)).size() > 0) {
          vList.addAll((List) eRef.eGet(eAttr));
        } else if (eDef != null) {
          vList.addAll((List) eDef.eGet(eAttr));
        }
      }
    }

    for (EAttribute eAttr : list) {
      Object val = eObj.eGet(eAttr);
      if (eAttr.isUnsettable()) {
        if (!eObj.eIsSet(eAttr)) {
          if (eRef != null && eRef.eIsSet(eAttr)) {
            eObj.eSet(eAttr, eRef.eGet(eAttr));
          } else if (eDef != null && eDef.eIsSet(eAttr)) {
            eObj.eSet(eAttr, eDef.eGet(eAttr));
          }
        }
      } else if (val == null) {
        if (eRef != null && eRef.eGet(eAttr) != null) {
          eObj.eSet(eAttr, eRef.eGet(eAttr));
        } else if (eDef != null) {
          eObj.eSet(eAttr, eDef.eGet(eAttr));
        }
      }
    }
  }
 @Override
 public int hashCode() {
   final int prime = 31;
   int result = 1;
   result = prime * result + ((fE == null) ? 0 : fE.hashCode());
   result = prime * result + ((fAttr == null) ? 0 : fAttr.hashCode());
   result = prime * result + ((fType == null) ? 0 : fType.hashCode());
   return result;
 }
 /** @generated */
 protected Object getValue(EObject element, EAttribute feature) {
   Object value = element.eGet(feature);
   Class iClass = feature.getEAttributeType().getInstanceClass();
   if (String.class.equals(iClass)) {
     if (value == null) {
       value = ""; // $NON-NLS-1$
     }
   }
   return value;
 }
 /**
  * @param feature
  * @param target
  */
 private void storeSingleValue(EAttribute feature, Object target) {
   // store current value
   if (feature.isChangeable()) {
     if (target instanceof EObject) {
       currentValue = EcoreUtil.copy((EObject) target);
     }
   } else {
     currentValue = target;
   }
 }
 public CharSequence idAssignment(final EClass it) {
   CharSequence _xblockexpression = null;
   {
     final EAttribute idAttr = Ecore2XtextExtensions.idAttribute(it);
     CharSequence _xifexpression = null;
     boolean _notEquals = (!Objects.equal(idAttr, null));
     if (_notEquals) {
       StringConcatenation _builder = new StringConcatenation();
       String _name = idAttr.getName();
       _builder.append(_name, "");
       _builder.append("=");
       String _assignedRuleCall = Ecore2XtextExtensions.assignedRuleCall(idAttr);
       _builder.append(_assignedRuleCall, "");
       _xifexpression = _builder;
     }
     _xblockexpression = (_xifexpression);
   }
   return _xblockexpression;
 }