Ejemplo n.º 1
0
  /**
   * @see
   *     com.metamatrix.modeler.core.metamodel.aspect.sql.SqlAspect#getName(org.eclipse.emf.ecore.EObject)
   */
  public String getName(final EObject eObject) {
    CoreArgCheck.isInstanceOf(XmlElement.class, eObject);

    IPath path = new Path(getShortName(eObject));
    EObject parent = eObject.eContainer();
    SqlAspect parentAspect = AspectManager.getSqlAspect(parent);
    while (parentAspect != null) {
      if (parent instanceof XmlDocument) {
        // XmlDocumentSqlAspect now implements SqlTableAspect AND SqlColumnAspect
        break;
      }
      if (parentAspect instanceof SqlColumnAspect) {
        String name = null;
        if (parentAspect instanceof AbstractXmlDocumentEntitySqlAspect) {
          name = ((AbstractXmlDocumentEntitySqlAspect) parentAspect).getShortName(parent);
        } else {
          name = parentAspect.getName(parent);
        }
        path = new Path("").append(name).append(path); // $NON-NLS-1$
      } else if (parentAspect instanceof SqlTableAspect) {
        break;
      }
      // Walk up to the parent ...
      parent = parent.eContainer();
      parentAspect = AspectManager.getSqlAspect(parent);
    }

    return path.toString().replace(IPath.SEPARATOR, '.');
  }
Ejemplo n.º 2
0
 @Override
 protected String getParentFullName(EObject eObject) {
   EObject parent = eObject.eContainer();
   if (parent != null) {
     SqlAspect parentAspect = AspectManager.getSqlAspect(parent);
     while (parentAspect != null) {
       if (parentAspect instanceof SqlTableAspect) {
         return parentAspect.getFullName(parent);
       }
       parent = parent.eContainer();
       if (parent != null) {
         parentAspect = AspectManager.getSqlAspect(parent);
       } else {
         return null;
       }
     }
   }
   return null;
 }
Ejemplo n.º 3
0
  /**
   * @see
   *     com.metamatrix.modeler.core.metamodel.aspect.sql.SqlColumnAspect#isTranformationInputParameter(org.eclipse.emf.ecore.EObject)
   * @since 4.2
   */
  public boolean isTranformationInputParameter(EObject eObject) {
    CoreArgCheck.isInstanceOf(XmlElement.class, eObject);
    final XmlElement element = (XmlElement) eObject;

    if (element instanceof XmlRoot) {
      return false;
    }

    final XmlDocument doc = getDocParent(element);
    final XmlElement parent = getElementParent(element);
    if (doc == null || parent == null) {
      return false;
    }

    Resource eResource = element.eResource();
    if (eResource instanceof EmfResource) {
      EmfResource emfResource = (EmfResource) eResource;
      ModelContents contents = emfResource.getModelContents();
      if (contents != null) {
        for (final Iterator mappings = contents.getTransformations(doc).iterator();
            mappings.hasNext(); ) {
          final TreeMappingRoot tmr = (TreeMappingRoot) mappings.next();
          if (tmr.getOutputs().contains(parent)) {
            final Iterator nested = tmr.getNested().iterator();
            while (nested.hasNext()) {
              final Mapping mapping = (Mapping) nested.next();
              if (mapping.getOutputs().contains(element)) {
                if (mapping.getInputs().size() == 0) {
                  return false;
                }
                Iterator i = mapping.getInputs().iterator();
                while (i.hasNext()) {
                  MappingClassColumn column = (MappingClassColumn) i.next();
                  SqlAspect aspect = AspectManager.getSqlAspect(column);
                  if (!(aspect instanceof SqlColumnAspect)) {
                    return false;
                  }
                  if (!((SqlColumnAspect) aspect).isTranformationInputParameter(column)) {
                    return false;
                  }
                }
                return true;
              }
            }
          }
        }
      }
    }
    return false;
  }
Ejemplo n.º 4
0
 /**
  * @see
  *     com.metamatrix.modeler.core.metamodel.aspect.ValidationAspect#shouldValidate(org.eclipse.emf.ecore.EObject)
  * @since 4.2
  */
 @Override
 public boolean shouldValidate(final EObject eObject, final ValidationContext context) {
   CoreArgCheck.isInstanceOf(InputBinding.class, eObject);
   if (!context.shouldIgnore(eObject)) {
     InputBinding inputBinding = (InputBinding) eObject;
     EObject inputParam = inputBinding.getInputParameter();
     if (inputParam != null) {
       ValidationAspect validAspect = AspectManager.getValidationAspect(inputParam);
       if (validAspect != null) {
         boolean shouldValidate = validAspect.shouldValidate(inputParam, context);
         if (!shouldValidate) {
           context.addObjectToIgnore(eObject, true);
         }
         return shouldValidate;
       }
     }
     return true;
   }
   return false;
 }