Package org.objectstyle.wolips.eomodeler.core.model

Examples of org.objectstyle.wolips.eomodeler.core.model.EOModelGroup


  }

  public IStatus runInWorkspace(IProgressMonitor monitor) throws CoreException {
    try {
      String extension = (_createEOModelGroup) ? ".eomodelgroup" : ".eogen";
      EOModelGroup modelGroup = new EOModelGroup();
      final Set<EOModelVerificationFailure> failures = new HashSet<EOModelVerificationFailure>();
      IEOModelGroupFactory.Utility.loadModelGroup(_modelFile, modelGroup, failures, true, _modelFile.getLocationURI().toURL(), new NullProgressMonitor());
      EOModel model = modelGroup.getEditingModel();
      if (model != null) {
        EOGeneratorModel eogenModel = EOGeneratorWizard.createEOGeneratorModel(_modelFile.getParent(), model, false);
        String eogenBasePath = URLUtils.cheatAndTurnIntoFile(model.getModelURL()).getAbsolutePath();
        int dotIndex = eogenBasePath.lastIndexOf('.');
        eogenBasePath = eogenBasePath.substring(0, dotIndex);
View Full Code Here


    _selection = selection;
  }

  public static EOGeneratorModel createEOGeneratorModel(IContainer parentResource, EOModel targetModel, boolean includeRefModels) {
    EOGeneratorModel eogenModel = EOGeneratorCreator.createDefaultModel(parentResource.getProject());
    EOModelGroup modelGroup = targetModel.getModelGroup();
    List<EOModel> exceptModels = new LinkedList<EOModel>();
    exceptModels.add(targetModel);
    List<EOModelReference> modelReferences = EOGeneratorModel.createModelReferencesForModelGroup(modelGroup, exceptModels);
    File modelFolder = URLUtils.cheatAndTurnIntoFile(targetModel.getModelURL());
    if (modelFolder != null) {
View Full Code Here

      errors.open();
      return;
    }

    boolean createModelGroup = false;
    EOModelGroup modelGroup = new EOModelGroup();
    try {
      IEOModelGroupFactory.Utility.loadModelGroup(_parentResource, modelGroup, failures, true, existingModelFolder.getLocation().toFile().toURL(), new NullProgressMonitor());
    } catch (Exception e) {
      failures.clear();
      failures.add(new EOModelVerificationFailure(null, "Creating empty EOModelGroup for this model because " + e.getMessage(), true, e));
      modelGroup = new EOModelGroup();
      createModelGroup = true;
      EOModelErrorDialog errors = new EOModelErrorDialog(Display.getDefault().getActiveShell(), failures);
      errors.open();
    }

    EOModel model = new EOModel(_modelName);
    EODatabaseConfig databaseConfig = new EODatabaseConfig("Default");
    databaseConfig.setAdaptorName(_adaptorName);
    model.addDatabaseConfig(databaseConfig);
    modelGroup.addModel(model);
    modelGroup.setEditingModelName(_modelName);

    ProjectFrameworkAdapter frameworkAdapter = (ProjectFrameworkAdapter)_parentResource.getProject().getAdapter(ProjectFrameworkAdapter.class);
    // add adaptor framework
    if (!"None".equals(_adaptorName) && !"".equals(_adaptorName)) {
      frameworkAdapter.addFrameworks(frameworkAdapter.getAdaptorFrameworks().get(_adaptorName));
    }
    if (!"None".equals(_pluginName) && !"".equals(_pluginName)) {
      IEclipseFramework pluginFramework = frameworkAdapter.getPluginFrameworks().get(_pluginName);
      frameworkAdapter.addFrameworks(pluginFramework);
      String selectedPrototypeEntityName = "EO" + _adaptorName + _pluginName + "Prototypes";
      EOEntity selectedPrototypeEntity = modelGroup.getEntityNamed(selectedPrototypeEntityName);
      if (selectedPrototypeEntity != null) {
        EODatabaseConfig activeConfig = model.getActiveDatabaseConfig();
        if (activeConfig != null) {
          activeConfig.setPrototype(selectedPrototypeEntity);
        }
View Full Code Here

    if (outputFile == null) {
      System.out.println("eomodelgraffle -output /path/to/output/Model.graffle [-model /path/to/model.eomodeld]* [-modelgroup /path/to/working/dir] [-templates /path/to/templates]");
      System.exit(0);
    }

    EOModelGroup modelGroup = new EOModelGroup();
    Set<EOModelVerificationFailure> failures = new HashSet<EOModelVerificationFailure>();
    if (modelPaths.size() == 0) {
      new SimpleManifestEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
      new IDEAProjectEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
      new EclipseProjectEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
    }
    else {
      for (String modelPath : modelPaths) {
        modelGroup.loadModelFromURL(new File(modelPath).toURL());
      }
    }
    modelGroup.resolve(failures);
    modelGroup.verify(failures);
    EOModelGraffleGenerator g = new EOModelGraffleGenerator(false, modelGroup, templateFolder, outputFile);
    g.generate();
  }
View Full Code Here

    if (outputFolder == null) {
      System.out.println("eomodeldoc -output /path/to/output/folder [-model /path/to/model.eomodeld]* [-modelgroup /path/to/working/dir] [-templates /path/to/templates] [-entityURLTemplate \"http://whatever?${entity.classNamePath}.html\"");
      System.exit(0);
    }

    EOModelGroup modelGroup = new EOModelGroup();
    Set<EOModelVerificationFailure> failures = new HashSet<EOModelVerificationFailure>();
    if (modelPaths.size() == 0) {
      new SimpleManifestEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
      new IDEAProjectEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
      new EclipseProjectEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
    }
    else {
      for (String modelPath : modelPaths) {
        modelGroup.loadModelFromURL(new File(modelPath).toURL());
      }
    }
    modelGroup.resolve(failures);
    modelGroup.verify(failures);
    EOModelDocGenerator.generate(modelGroup, outputFolder, templateFolder, entityURLTemplate);
  }
View Full Code Here

    if (eogeneratorModel.getSubclassDestination() == null) {
      eogeneratorModel.setSubclassDestination(eogeneratorModel.getDestination());
    }

    EOModelGroup modelGroup = new EOModelGroup();
    Set<EOModelVerificationFailure> failures = new HashSet<EOModelVerificationFailure>();
    if (loadModelGroup || modelPaths.size() == 0) {
      if (System.getProperty("veogen.modelgroup.nobundle") == null) {
        new BundleEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, loadModelGroup, new NullProgressMonitor());
      }
      if (System.getProperty("veogen.modelgroup.nomanifest") == null) {
        new SimpleManifestEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
      }
      if (System.getProperty("veogen.modelgroup.noidea") == null) {
        new IDEAProjectEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
      }
      if (System.getProperty("veogen.modelgroup.noeclipse") == null) {
        new EclipseProjectEOModelGroupFactory().loadModelGroup(modelGroupFolder, modelGroup, failures, true, new NullProgressMonitor());
      }
    }
    for (String modelPath : modelPaths) {
      modelGroup.loadModelFromURL(new File(modelPath).toURL());
    }

    modelGroup.resolve(failures);
    modelGroup.verify(failures);
    boolean hasFailures = false;
    for (EOModelVerificationFailure failure : failures) {
      if (!failure.isWarning()) {
        System.err.println("Failure: " + failure.getMessage());
        hasFailures = true;
View Full Code Here

    // org.objectstyle.wolips.thirdparty.velocity.resourceloader.ResourceLoader.class.getName());
    // velocityEngine.setProperty("wolips.resource.loader.bundle",
    // Activator.getDefault().getBundle());
    // velocityEngine.setProperty("jar.resource.loader.path", "jar:" +
    // TemplateEnginePlugin.getDefault().getBundle().getResource("plugin.xml").getFile());
    EOModelGroup modelGroup = new EOModelGroup();
    modelGroup.loadModelFromURL(new File("/Users/mschrag/Documents/workspace/ERPrototypes/Resources/erprototypes.eomodeld").toURL());
    modelGroup.loadModelFromURL(new File("/Users/mschrag/Documents/workspace/MDTAccounting/MDTAccounting.eomodeld").toURL());
    modelGroup.loadModelFromURL(new File("/Users/mschrag/Documents/workspace/MDTask/MDTask.eomodeld").toURL());
    modelGroup.resolve(new HashSet<EOModelVerificationFailure>());

    File outputFolder = new File("/tmp/eomodeldoc");

    EOModelDocGenerator.generate(modelGroup, outputFolder, null, null);
  }
View Full Code Here

        if (editorPart instanceof EOModelEditor) {
          modelEditor = (EOModelEditor)editorPart;
          EOModel editingModel = modelEditor.getModel();
          if (editingModel != null) {
            List<File> modelFolders = new LinkedList<File>();
            EOModelGroup modelGroup = editingModel.getModelGroup();
            for (EOModel model : modelGroup.getModels()) {
              File modelFolder = URLUtils.cheatAndTurnIntoFile(model.getModelURL()).getParentFile();
              modelFolders.add(modelFolder);
            }
            if (modelFolders.size() > 0) {
              input = new FilesystemFolder(new File("/"), modelFolders);
View Full Code Here

      }
      renderContext.setJavaClientCommon(eogeneratorModel.isJavaClientCommon() != null && eogeneratorModel.isJavaClientCommon().booleanValue());
      renderContext.setJavaClient(eogeneratorModel.isJavaClient() != null && eogeneratorModel.isJavaClient().booleanValue());
      EOModelRenderContext.setRenderContext(renderContext);

      EOModelGroup modelGroup;
      if (preloadedModelGroup == null) {
        modelGroup = new EOModelGroup();

        Set<EOModelVerificationFailure> failures = new HashSet<EOModelVerificationFailure>();

        if (BooleanUtils.isTrue(eogeneratorModel.isLoadModelGroup())) {
          for (EOModelReference eomodelReference : eogeneratorModel.getModels()) {
            EOModelGroup generatingModelGroup = new EOModelGroup();
            URL modelURL = getModelURL(eogeneratorModel, eomodelReference);
            IEOModelGroupFactory.Utility.loadModelGroup(modelURL, generatingModelGroup, failures, true, modelURL, monitor);
            if (monitor.isCanceled()) {
              throw new OperationCanceledException("EOGenerator canceled.");
            }
            EOModel generatingModel = generatingModelGroup.getEditingModel();
            models.add(generatingModel);

            for (EOModel model : generatingModelGroup.getModels()) {
              if (!modelGroup.containsModelNamed(model.getName())) {
                modelGroup.addModel(model);
              }
            }
          }
View Full Code Here

          EOModelErrorDialog errors = new EOModelErrorDialog(Display.getDefault().getActiveShell(), failures);
          errors.open();
          return;
        }

        EOModelGroup modelGroup = new EOModelGroup();
        try {
          IEOModelGroupFactory.Utility.loadModelGroup(modelFolder, modelGroup, failures, true, modelFolder.toURI().toURL(), new NullProgressMonitor());
        }
        catch (Exception e) {
          failures.clear();
          failures.add(new EOModelVerificationFailure(null, "Creating empty EOModelGroup for this model because " + e.getMessage(), true, e));
          modelGroup = new EOModelGroup();
          EOModelErrorDialog errors = new EOModelErrorDialog(Display.getDefault().getActiveShell(), failures);
          errors.open();
        }

        try {
          EOModel model = new EOModel(modelName);
          modelGroup.addModel(model);
          //model.setEditing(true);
          EODatabaseConfig databaseConfig = new EODatabaseConfig("Default");
          databaseConfig.setAdaptorName("JDBC");
          model.setModelURL(modelFolder.toURI().toURL());
          model.addDatabaseConfig(databaseConfig);
View Full Code Here

TOP

Related Classes of org.objectstyle.wolips.eomodeler.core.model.EOModelGroup

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.