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

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


            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);
              }
            }
          }
        } else {
          loadModels(eogeneratorModel, modelGroup, eogeneratorModel.getModels(), models, monitor);
          loadModels(eogeneratorModel, modelGroup, eogeneratorModel.getRefModels(), new LinkedList<EOModel>(), monitor);

          modelGroup.resolve(failures);
          modelGroup.verify(failures);
        }

        for (EOModelVerificationFailure failure : failures) {
          if (!failure.isWarning()) {
            results.append("Error: " + failure.getMessage() + "\n");
            showResults = true;
          }
        }
      } else {
        modelGroup = preloadedModelGroup;
        for (EOModelReference modelRef : eogeneratorModel.getModels()) {
          String modelName = modelRef.getName();
          EOModel model = modelGroup.getModelNamed(modelName);
          if (model == null) {
            throw new RuntimeException("There was no model named '" + modelName + "' in this model group.");
          }
          models.add(model);
        }
      }

      File superclassDestination = new File(eogeneratorModel.getDestination());
      if (!superclassDestination.isAbsolute()) {
        IPath projectPath = eogeneratorModel.getProjectPath();
        if (projectPath != null) {
          superclassDestination = new File(projectPath.toFile(), eogeneratorModel.getDestination());
        }
      }
      if (!superclassDestination.exists()) {
        if (!superclassDestination.mkdirs()) {
          throw new IOException("Failed to create destination '" + superclassDestination + "'.");
        }
      }

      File subclassDestination = new File(eogeneratorModel.getSubclassDestination());
      if (!subclassDestination.isAbsolute()) {
        IPath projectPath = eogeneratorModel.getProjectPath();
        if (projectPath != null) {
          subclassDestination = new File(projectPath.toFile(), eogeneratorModel.getSubclassDestination());
        }
      }
      if (!subclassDestination.exists()) {
        if (!subclassDestination.mkdirs()) {
          throw new IOException("Failed to create subclass destination '" + subclassDestination + "'.");
        }
      }

      // String filePathTemplate = eogeneratorModel.getFilenameTemplate();
      // if (filePathTemplate == null || filePathTemplate.trim().length()
      // == 0) {
      // }

      String extension = eogeneratorModel.getExtension();
      Set<String> entitySet = new HashSet<String>();
      if (entityList != null) {
        entitySet.addAll(entityList);
      }
      Date date = new Date();
     
      for (EOModel model : models) {
        if (monitor.isCanceled()) {
          throw new OperationCanceledException("EOGenerator canceled.");
        }
        // System.out.println("Generating " + model.getName() + " ...");
        for (EOEntity entity : model.getEntities()) {
          VelocityContext context = new VelocityContext();
          context.put("eogeneratorModel", eogeneratorModel);
          context.put("date", date);
          context.put("calendar", Calendar.getInstance());
          for (Define define : eogeneratorModel.getDefines()) {
View Full Code Here


    for (EOModelReference modelRef : modelReferences) {
      if (monitor.isCanceled()) {
        throw new OperationCanceledException("EOGenerator canceled.");
      }
      URL modelURL = getModelURL(eogeneratorModel, modelRef);
      EOModel model = modelGroup.loadModelFromURL(modelURL);
      loadedModels.add(model);
    }
  }
View Full Code Here

      }
    }
  }

  protected void addModelsFromEOModelGroupFile(IFile eoModelGroupFile, EOModelGroup modelGroup, Set<EOModelVerificationFailure> failures, boolean skipOnDuplicates, IProgressMonitor progressMonitor) throws ParseException, CoreException, IOException, EOModelException {
    EOModel model = null;
    IProject project = eoModelGroupFile.getProject();
    EOGeneratorModel eogeneratorModel = EOGeneratorModel.createModelFromFile(eoModelGroupFile);
    List<EOModelReference> modelRefList = new LinkedList<EOModelReference>();
    modelRefList.addAll(eogeneratorModel.getModels());
    modelRefList.addAll(eogeneratorModel.getRefModels());
    for (EOModelReference modelRef : modelRefList) {
      String modelPath = modelRef.getPath(project);
      File modelFolder = new File(modelPath);
      if (!modelFolder.isAbsolute()) {
        modelFolder = new File(project.getLocation().toFile(), modelPath);
      }
      if (model == null) {
        modelGroup.setEditingModelURL(modelFolder.toURL());
      }
      EOModel modelGroupModel = modelGroup.loadModelFromURL(modelFolder.toURL(), failures, skipOnDuplicates, progressMonitor);
      if (model == null) {
        model = modelGroupModel;
      }
    }
  }
View Full Code Here

          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);
          model.saveToFolder(modelFolder);

          ApplicationWorkbenchAdvisor.openModelPath(modelFolder.getAbsolutePath());
        }
        catch (Throwable t) {
          t.printStackTrace();
View Full Code Here

import org.objectstyle.wolips.eomodeler.core.model.EOModel;
import org.objectstyle.wolips.eomodeler.core.utils.EOModelUtils;

public class EOStoredProceduresContentProvider implements IStructuredContentProvider {
  public Object[] getElements(Object _inputElement) {
    EOModel model = EOModelUtils.getRelatedModel(_inputElement);
    Object[] storedProcedures = model.getStoredProcedures().toArray();
    return storedProcedures;
  }
View Full Code Here

import org.objectstyle.wolips.eomodeler.core.utils.EOModelUtils;
import org.objectstyle.wolips.eomodeler.editors.entity.SubclassEntityDialog;

public class SubclassEntityAction extends EMAction {
  public void run(IAction action) {
    EOModel model = null;
    EOEntity entity = null;
    Object selectedObject = getSelectedObject();
    if (selectedObject instanceof EOModel) {
      model = (EOModel) selectedObject;
    } else if (selectedObject instanceof IEOEntityRelative) {
      entity = ((IEOEntityRelative) selectedObject).getEntity();
      model = entity.getModel();
    }
    if (model != null) {
      SubclassEntityDialog dialog = new SubclassEntityDialog(getWindow().getShell(), model, entity, model.getModelGroup().getEditingModel());
      dialog.setBlockOnOpen(true);
      int results = dialog.open();
      if (results == Window.OK) {
        String entityName = dialog.getEntityName();
        if (entityName != null && entityName.trim().length() > 0) {
          try {
            EOEntity parentEntity = dialog.getParentEntity();
            InheritanceType inheritanceType = dialog.getInheritanceType();
            String restrictingQualifier = dialog.getRestrictingQualifier();
            EOModel destinationModel = dialog.getDestinationModel();
            SubclassOperation operation = new SubclassOperation(parentEntity, inheritanceType, destinationModel, entityName, restrictingQualifier);
            operation.addContext(EOModelUtils.getUndoContext(model));
            IOperationHistory operationHistory = PlatformUI.getWorkbench().getOperationSupport().getOperationHistory();
            operationHistory.execute(operation, null, null);
          } catch (Throwable e) {
View Full Code Here

  public String getText(Object _element) {
    String text;
    if (_element instanceof String) {
      text = (String) _element;
    } else if (_element instanceof EOModel) {
      EOModel model = (EOModel) _element;
      text = model.getName();
      if (model.isDirty()) {
        text = text + "*";
      }
    } else if (_element instanceof EOEntity) {
      EOEntity entity = (EOEntity) _element;
      text = entity.getName();
View Full Code Here

import org.objectstyle.wolips.eomodeler.core.model.EOEntity;
import org.objectstyle.wolips.eomodeler.core.model.EOModel;

public class EOEntitiesContentProvider implements IStructuredContentProvider {
  public Object[] getElements(Object _inputElement) {
    EOModel model = (EOModel) _inputElement;
    Set entitiesList = model.getEntities();
    EOEntity[] entities = (EOEntity[]) entitiesList.toArray(new EOEntity[entitiesList.size()]);
    return entities;
  }
View Full Code Here

      // _adaptorNameComboViewer.getCombo().removeModifyListener(_adaptorNameBinding);
      _adaptorNameBinding.dispose();
    }
    EODatabaseConfig databaseConfig = getDatabaseConfig();
    if (databaseConfig != null) {
      EOModel model = databaseConfig.getModel();
      if (model != null) {
        model.removePropertyChangeListener(EOModel.ACTIVE_DATABASE_CONFIG, _activeDatabaseConfigHandler);
      }
      databaseConfig.removePropertyChangeListener(EODatabaseConfig.ADAPTOR_NAME, _adaptorNameHandler);
    }
  }
View Full Code Here

    _adaptorNameBinding = new ComboViewerBinding(_adaptorNameComboViewer, getDatabaseConfig(), EODatabaseConfig.ADAPTOR_NAME, null, null, null);
    // _adaptorNameComboViewer.getCombo().addModifyListener(_adaptorNameBinding);

    EODatabaseConfig databaseConfig = getDatabaseConfig();
    if (databaseConfig != null) {
      EOModel model = databaseConfig.getModel();
      if (model != null) {
        model.addPropertyChangeListener(EOModel.ACTIVE_DATABASE_CONFIG, _activeDatabaseConfigHandler);
      }
      databaseConfig.addPropertyChangeListener(EODatabaseConfig.ADAPTOR_NAME, _adaptorNameHandler);
    }
    activeDatabaseConfigChanged();
  }
View Full Code Here

TOP

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

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.