Ejemplo n.º 1
0
 public ILeaf createLeaf(
     Code code,
     List<? extends CharSequence> display,
     LeafType entityType,
     IGroup parentContainer,
     Set<VisibilityModifier> hides) {
   if (entityType == null) {
     throw new IllegalArgumentException();
   }
   final Bodier bodier = new Bodier(entityType, hides);
   final EntityImpl result = new EntityImpl(this, code, bodier, parentContainer, entityType);
   result.setDisplay(display);
   return result;
 }
Ejemplo n.º 2
0
 public IGroup muteToGroup(Code code, String namespace, GroupType type, IGroup parent) {
   final ILeaf leaf = getLeafs().get(code);
   ((EntityImpl) leaf).muteToGroup(namespace, type, parent);
   final IGroup result = (IGroup) leaf;
   removeLeaf(code);
   return result;
 }
Ejemplo n.º 3
0
 public IGroup createGroup(
     Code code,
     List<? extends CharSequence> display,
     String namespace,
     GroupType groupType,
     IGroup parentContainer,
     Set<VisibilityModifier> hides) {
   if (groupType == null) {
     throw new IllegalArgumentException();
   }
   final Bodier bodier = new Bodier(null, hides);
   final EntityImpl result =
       new EntityImpl(this, code, bodier, parentContainer, groupType, namespace);
   if (display != null) {
     result.setDisplay(display);
   }
   return result;
 }
Ejemplo n.º 4
0
  public ManyToOneFieldImpl(CharSequence name, EntityImpl entity, AggregationRelation oneToOne)
      throws ModelException {
    super(name, entity, oneToOne);

    this.manyToOne = oneToOne;

    // Add to parent entity
    entity.addField(this);
  }
Ejemplo n.º 5
0
 void add(Node gNode, Node node) {
   NodeTable gt = graph.get(gNode);
   if (gt == null) {
     gt = new NodeTable();
     graph.put(gNode, gt);
   }
   if (!gt.containsKey(node)) {
     gt.put(node, EntityImpl.create(gNode, node));
   }
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public void eUnset(int featureID) {
   switch (featureID) {
     case Entity_pcPackage
         .INTERFACE_REQUIRING_ENTITY__RESOURCE_REQUIRED_ROLES_RESOURCE_INTERFACE_REQUIRING_ENTITY:
       getResourceRequiredRoles__ResourceInterfaceRequiringEntity().clear();
       return;
     case Entity_pcPackage.INTERFACE_REQUIRING_ENTITY__REQUIRED_ROLES_INTERFACE_REQUIRING_ENTITY:
       getRequiredRoles_InterfaceRequiringEntity().clear();
       return;
   }
   super.eUnset(featureID);
 }
Ejemplo n.º 7
0
  ComponentIdentityImpl(CharSequence name, EntityImpl entity) throws ModelException {

    super(name);

    // Validate parameters
    if (entity == null) {
      throw new ModelException(String.format("Can't create a ComplexIdentity with a null entity"));
    }
    if (entity.getTable().getPrimaryKey() == null) {
      throw new ModelException(
          String.format(
              "Can't create a ComplexIdentity with a null primary key in entity %s, table %s.",
              entity.getName(), entity.getTable().getName()));
    }
    // Set fields
    this.entity = entity;
    this.primaryKey = entity.getTable().getPrimaryKey();
    this.fields = new FieldCollectionDelegate(this);

    // Add to entity field collection
    this.entity.setIdentity(this);
  }
Ejemplo n.º 8
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @Override
 public void eUnset(int featureID) {
   switch (featureID) {
     case MetadataPackage.MODEL__ENTITY_GROUPS:
       getEntityGroups().clear();
       return;
     case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER:
       setSourceModelProvider(SOURCE_MODEL_PROVIDER_EDEFAULT);
       return;
     case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT:
       setCurrentModelContext(CURRENT_MODEL_CONTEXT_EDEFAULT);
       return;
   }
   super.eUnset(featureID);
 }
Ejemplo n.º 9
0
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @SuppressWarnings("unchecked")
 @Override
 public void eSet(int featureID, Object newValue) {
   switch (featureID) {
     case MetadataPackage.MODEL__ENTITY_GROUPS:
       getEntityGroups().clear();
       getEntityGroups().addAll((Collection<? extends EntityGroup>) newValue);
       return;
     case MetadataPackage.MODEL__SOURCE_MODEL_PROVIDER:
       setSourceModelProvider((IMetaDataSourceModelProvider) newValue);
       return;
     case MetadataPackage.MODEL__CURRENT_MODEL_CONTEXT:
       setCurrentModelContext((ModelKeyDescriptor) newValue);
       return;
   }
   super.eSet(featureID, newValue);
 }
 /**
  *
  * <!-- begin-user-doc -->
  * <!-- end-user-doc -->
  *
  * @generated
  */
 @SuppressWarnings("unchecked")
 @Override
 public void eSet(int featureID, Object newValue) {
   switch (featureID) {
     case Entity_pcPackage
         .INTERFACE_REQUIRING_ENTITY__RESOURCE_REQUIRED_ROLES_RESOURCE_INTERFACE_REQUIRING_ENTITY:
       getResourceRequiredRoles__ResourceInterfaceRequiringEntity().clear();
       getResourceRequiredRoles__ResourceInterfaceRequiringEntity()
           .addAll((Collection<? extends ResourceRequiredRole>) newValue);
       return;
     case Entity_pcPackage.INTERFACE_REQUIRING_ENTITY__REQUIRED_ROLES_INTERFACE_REQUIRING_ENTITY:
       getRequiredRoles_InterfaceRequiringEntity().clear();
       getRequiredRoles_InterfaceRequiringEntity()
           .addAll((Collection<? extends RequiredRole>) newValue);
       return;
   }
   super.eSet(featureID, newValue);
 }
Ejemplo n.º 11
0
  ComponentIdentityImpl(ComponentIdentityImplBuilder builder) throws ModelException {
    super(builder.getName());

    // Validate parameters
    if (builder.getEntity() == null) {
      throw new ModelException(String.format("Can't create a ComplexIdentity with a null entity"));
    }
    if (builder.getEntity().getTable().getPrimaryKey() == null) {
      throw new ModelException(
          String.format(
              "Can't create a ComplexIdentity with a null primary key in entity %s, table %s.",
              builder.getEntity().getName(), builder.getEntity().getTable().getName()));
    }

    // Set fields
    this.entity = builder.getEntity();
    this.primaryKey = entity.getTable().getPrimaryKey();
    this.fields = new FieldCollectionDelegate(this);

    // Create properties
    for (IdentityFieldImplBuilder ifBuilder : builder.getSimpleProperties()) {
      ifBuilder.setComponentIdentity(this);
      ifBuilder.build();
    }
    // Create many-to-ones
    for (ManyToOneComponentRelationImplBuilder ifBuilder : builder.getManyToOnes()) {
      ifBuilder.setComponent(this);
      ifBuilder.setCatalog(this.entity.getCatalog());
      ifBuilder.build();
    }

    // Check all primary columns are mapped
    if (!getColumns().equals(primaryKey.getColumns())) {
      throw new ModelException(
          String.format(
              "Can't create ComponentIdentity %s for entity %s as not all primary key columns are mapped.",
              this.name, this.entity.getName()));
    }

    // Add to entity field collection
    this.entity.setIdentity(this);
  }
Ejemplo n.º 12
0
 public Table getTable() {
   return entity.getTable();
 }
Ejemplo n.º 13
0
 /**
  *
  * <!-- begin-user-doc -->
  * Due to a mistake in the EMF model, Model is not inheriting accept method from Entity. This
  * should be fixed.
  * <!-- end-user-doc -->
  *
  * @generated NOT
  */
 public void accept(IEntityVisitor visitor) {
   super.accept(visitor);
 }