Ejemplo n.º 1
0
 /**
  * Creates a Property correctly initialized with the default value.
  *
  * @param propertyType The PropertyType
  * @return Property The newly created Property
  */
 private Property createProperty(PropertyType propertyType) {
   Property p = getModelFactory().createProperty();
   p.setTypeName(propertyType.getName());
   p.setLibraryName(propertyType.getLibrary().getName());
   p.setValue(propertyType.getDefaultValue());
   return p;
 }
Ejemplo n.º 2
0
  /**
   * Creates the properties for the Event. Existing properties are reused so that their values are
   * conserved.
   */
  private void createProperties() {
    Map<String, Property> existingProperties = new HashMap<String, Property>();
    for (Property p : event.getProperties()) {
      existingProperties.put(p.getTypeName(), p);
    }

    // Clear the old properties
    event.getProperties().clear();

    for (PropertyType pt : event.getEventType().getPropertyTypes()) {
      Property p = existingProperties.get(pt.getName());
      if (p == null) {
        // Create a new property
        p = ModelFactory.eINSTANCE.createProperty();
        p.setTypeName(pt.getName());
        p.setLibraryName(pt.getLibrary().getName());
      }
      event.getProperties().add(p);
    }
  }