Examples of EOModelGroup


Examples of com.webobjects.eoaccess.EOModelGroup

   * @throws IllegalAccessException
   * @throws InstantiationException
   */
  @SuppressWarnings("unchecked")
  public void migrateToLatest() {
    EOModelGroup modelGroup = EOModelGroup.defaultGroup();
    NSArray<String> modelNames;
    String modelNamesStr = ERXProperties.stringForKey("er.migration.modelNames");
    if (modelNamesStr == null) {
      ERXMigrator.log.warn("er.migration.modelNames is not set, defaulting to modelGroup.models() order instead.");
      modelNames = modelGroup.modelNames();
    }
    else {
      modelNames = NSArray.componentsSeparatedByString(modelNamesStr, ",");
    }
    String skipModelNamesStr = ERXProperties.stringForKey("er.migration.skipModelNames");
View Full Code Here

Examples of com.webobjects.eoaccess.EOModelGroup

  protected Map<IERXMigration, ERXModelVersion> _buildDependenciesForModelsNamed(NSArray<String> modelNames, NSArray<String> skipModelNames) {
    Map<IERXMigration, ERXModelVersion> migrations = new LinkedHashMap<IERXMigration, ERXModelVersion>();
    try {
      Map<String, Integer> versions = new HashMap<String, Integer>();

      EOModelGroup modelGroup = EOModelGroup.defaultGroup();
      Enumeration modelNamesEnum = modelNames.objectEnumerator();
      while (modelNamesEnum.hasMoreElements()) {
        String modelName = (String) modelNamesEnum.nextElement();
        if (!skipModelNames.containsObject(modelName)) {
          EOModel model = modelGroup.modelNamed(modelName);
          if (model == null) {
            throw new IllegalArgumentException("There is no model named '" + modelName + "' in this model group.");
          }
          _buildDependenciesForModel(model, ERXMigrator.LATEST_VERSION, versions, migrations);
        }
      }

      Set<String> processedModelNames = new HashSet<String>();
      Set<String> pendingModelNames = new HashSet<String>(versions.keySet());
      while (!pendingModelNames.isEmpty()) {
        Iterator<String> modelNamesIter = pendingModelNames.iterator();
        while (modelNamesIter.hasNext()) {
          String modelName = modelNamesIter.next();
          EOModel model = modelGroup.modelNamed(modelName);
          Enumeration entitiesEnum = model.entities().objectEnumerator();
          while (entitiesEnum.hasMoreElements()) {
            EOEntity entity = (EOEntity) entitiesEnum.nextElement();
            EOEntity parentEntity = entity.parentEntity();
            if (parentEntity != null && !parentEntity.model().equals(model)) {
View Full Code Here

Examples of com.webobjects.eoaccess.EOModelGroup

    EOModel dbUpdaterModel;
    if (_lastUpdatedModel == model) {
      dbUpdaterModel = _dbUpdaterModelCache;
    }
    else {
      EOModelGroup modelGroup = model.modelGroup();
      EOEntity prototypeEntity = modelGroup.entityNamed(ERXModelGroup.prototypeEntityNameForModel(model));
      boolean isWonderPrototype = (prototypeEntity != null && prototypeEntity.model().name().equals("erprototypes"));

      dbUpdaterModel = new EOModel();
      dbUpdaterModel.setConnectionDictionary(model.connectionDictionary());
      dbUpdaterModel.setAdaptorName(model.adaptorName());
View Full Code Here

Examples of com.webobjects.eoaccess.EOModelGroup

  }

  private void reloadModel(EOModel model) {
    log.echo("JRebel: reloading EOModel " + model.name() + " (" + model.hashCode() + ")");
    EOModel newModel = new EOModel(model.pathURL());
    EOModelGroup modelGroup = model.modelGroup();
    modelGroup.removeModel(model);
    modelGroup.addModel(newModel);
    for (Map.Entry<EOObjectStoreCoordinator, EOModelGroup> entry : oscCache.entrySet()) {
      if (modelGroup == entry.getValue()) {
        EOObjectStoreCoordinator osc = entry.getKey();
        for (Object obj : osc.cooperatingObjectStores()) {
          EOCooperatingObjectStore store = (EOCooperatingObjectStore) obj;
View Full Code Here

Examples of com.webobjects.eoaccess.EOModelGroup

    // over all the models that heard about via EOModelAddedNotification's
    // and loads all their shared EOs at once.
    public void objectStoreWasAdded(NSNotification aNotification) {
        if (!_loadingComplete) {
            if (_modelList.count() == 0) {
                EOModelGroup group = EOModelGroup.modelGroupForObjectStoreCoordinator((EOObjectStoreCoordinator)aNotification.object());
                if (group != null && group.models().count() == 0) {
                    throw new RuntimeException("No models found in default group");
                }
                // internal list empty; drop it and use modelgroup's.
                _modelList = new NSMutableArray(group.models());
            }
            _loadingComplete = true; // make sure we only do this once.
            EOModel currentModel = null;
            try {
                NSNotificationCenter.defaultCenter().addObserver(this,
View Full Code Here

Examples of com.webobjects.eoaccess.EOModelGroup

    public boolean supportsDirectColumnRenaming() {
        return true;
    }
   
    private EOEntity entityForTableName(String tableName) {
        EOModelGroup modelGroup = EOModelGroup.globalModelGroup();
            for (EOModel model : modelGroup.models()) {
                for (EOEntity entity : model.entities()) {
                    if (entity.externalName() != null && entity.externalName().equalsIgnoreCase(tableName)) {
                        return entity;
                    }
                }
View Full Code Here

Examples of com.webobjects.eoaccess.EOModelGroup

        if (null==dataSource()) {
            setDataSource((EODatabaseDataSource) _WOJExtensionsUtil.valueForBindingOrNull("dataSource",this));
            if (null==dataSource()) {
                String anEntityName = _localSourceEntityName();
                EOModelGroup aModelGroup = EOModelGroup.defaultGroup();
                EOEntity anEntity = aModelGroup.entityNamed(anEntityName);

                if (anEntity == null) {
                    throw new IllegalStateException("<" + getClass().getName() + " could not find entity named " + anEntityName + ">");
                }
View Full Code Here

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

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

    _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

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

      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
TOP
Copyright © 2018 www.massapi.com. 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.