/**
   * @see gov.nih.nci.codegen.framework.Transformer#execute(javax.jmi.reflect.RefObject,
   *     java.util.Collection)
   */
  public Collection execute(RefObject modelElement, Collection artifacts)
      throws TransformationException {
    if (modelElement == null) {
      throw new TransformationException("model element is null");
    }
    if (!(modelElement instanceof Model)) {
      throw new TransformationException("model element not instance of Model");
    }
    ArrayList newArtifacts = new ArrayList();
    UML13ModelElementFilter meFilt = new UML13ModelElementFilter();
    ArrayList umlExtentCol = new ArrayList();
    umlExtentCol.add(modelElement.refOutermostPackage());
    Collection classifiers = null;
    try {
      classifiers = _classifierFilt.execute(meFilt.execute(umlExtentCol));
    } catch (FilteringException ex) {
      log.error("couldn't filter model elements" + ex.getMessage());
      throw new TransformationException("couldn't filter model elements", ex);
    }

    String methodList = generateConfig(classifiers);

    newArtifacts.add(new BaseArtifact("CommonRoleUtility", modelElement, methodList));

    return newArtifacts;
  }
Пример #2
0
  /*
   * (non-Javadoc)
   *
   * @see gov.nih.nci.codegen.framework.Transformer#execute(javax.jmi.reflect.RefObject,
   *      java.util.Collection)
   */
  public Collection execute(RefObject modelElement, Collection artifacts)
      throws TransformationException {
    if (modelElement == null) {
      log.error("model element is null");
      throw new TransformationException("model element is null");
    }
    if (!(modelElement instanceof Model)) {
      log.error("model element not instance of Model");
      throw new TransformationException("model element not instance of Model");
    }
    ArrayList newArtifacts = new ArrayList();
    UML13ModelElementFilter meFilt = new UML13ModelElementFilter();
    ArrayList umlExtentCol = new ArrayList();
    umlExtentCol.add(modelElement.refOutermostPackage());
    Collection classifiers = null;
    try {
      classifiers = _classifierFilt.execute(meFilt.execute(umlExtentCol));
    } catch (FilteringException ex) {
      log.error("couldn't filter model elements " + ex.getMessage());
      throw new TransformationException("couldn't filter model elements", ex);
    }
    Document doc = generateConfig(classifiers);
    XMLOutputter p = new XMLOutputter();
    p.setFormat(Format.getPrettyFormat());

    newArtifacts.add(new BaseArtifact("hibernate_config", modelElement, p.outputString(doc)));
    return newArtifacts;
  }