Examples of EOModel


Examples of com.webobjects.eoaccess.EOModel

      defaultConnectionDictionary = _model.connectionDictionary();
    }

    Enumeration modelsEnum = _modelGroup.models().objectEnumerator();
    while (modelsEnum.hasMoreElements()) {
      EOModel model = (EOModel) modelsEnum.nextElement();
      if (model.connectionDictionary() == null) {
        model.setConnectionDictionary(defaultConnectionDictionary);
      }
    }

    if (_modelProcessor == null) {
      findModelProcessor("org.objectstyle.wolips.eomodeler.EOModelProcessor", false);
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

      return;
    }

    NSMutableDictionary removedPrototypeEntities = new NSMutableDictionary();

    EOModel prototypesModel = null;
    Enumeration modelsEnum = modelGroup.models().objectEnumerator();
    while (modelsEnum.hasMoreElements()) {
      EOModel model = (EOModel) modelsEnum.nextElement();
      EOEntity eoAdaptorPrototypesEntity = _modelGroup.entityNamed("EO" + model.adaptorName() + "Prototypes");
      if (eoAdaptorPrototypesEntity != null) {
        prototypesModel = eoAdaptorPrototypesEntity.model();
        // System.out.println("EOFSQLGenerator.EOFSQLGenerator:
        // removing " + eoAdaptorPrototypesEntity.name() + " from "
        // + prototypesModel.name());
        prototypesModel.removeEntity(eoAdaptorPrototypesEntity);
        removedPrototypeEntities.takeValueForKey(eoAdaptorPrototypesEntity, eoAdaptorPrototypesEntity.name());
      }
    }

    EOEntity eoPrototypesEntity = _modelGroup.entityNamed("EOPrototypes");
    if (eoPrototypesEntity != null) {
      prototypesModel = eoPrototypesEntity.model();
      prototypesModel.removeEntity(eoPrototypesEntity);
      // System.out.println("EOFSQLGenerator.EOFSQLGenerator: removing
      // " + eoPrototypesEntity.name() + " from " +
      // prototypesModel.name());
      removedPrototypeEntities.takeValueForKey(eoPrototypesEntity, eoPrototypesEntity.name());
    }

    EOEntity prototypesEntity = _modelGroup.entityNamed(prototypeEntityName);
    if (prototypesEntity == null) {
      prototypesEntity = (EOEntity) removedPrototypeEntities.valueForKey(prototypeEntityName);
    } else {
      prototypesModel = prototypesEntity.model();
      prototypesModel.removeEntity(prototypesEntity);
    }
    if (prototypesEntity != null && prototypesModel != null) {
      // System.out.println("EOFSQLGenerator.EOFSQLGenerator: setting
      // " + prototypesEntity.name() + " to EOPrototypes in " +
      // prototypesModel.name());
      prototypesEntity.setName(replacementPrototypeName);
      prototypesModel.addEntity(prototypesEntity);
    }

    Enumeration resetModelsEnum = _modelGroup.models().objectEnumerator();
    while (resetModelsEnum.hasMoreElements()) {
      EOModel model = (EOModel) resetModelsEnum.nextElement();
      model._resetPrototypeCache();
    }
  }
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

      defaultConnectionDictionary = _model.connectionDictionary();
    }

    Enumeration modelsEnum = _modelGroup.models().objectEnumerator();
    while (modelsEnum.hasMoreElements()) {
      EOModel model = (EOModel) modelsEnum.nextElement();
      if (model.connectionDictionary() == null) {
        model.setConnectionDictionary(defaultConnectionDictionary);
      }
    }

    if (_modelProcessor == null) {
      findModelProcessor("org.objectstyle.wolips.eomodeler.EOModelProcessor", false);
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

      return;
    }

    NSMutableDictionary removedPrototypeEntities = new NSMutableDictionary();

    EOModel prototypesModel = null;
    Enumeration modelsEnum = modelGroup.models().objectEnumerator();
    while (modelsEnum.hasMoreElements()) {
      EOModel model = (EOModel) modelsEnum.nextElement();
      EOEntity eoAdaptorPrototypesEntity = _modelGroup.entityNamed("EO" + model.adaptorName() + "Prototypes");
      if (eoAdaptorPrototypesEntity != null) {
        prototypesModel = eoAdaptorPrototypesEntity.model();
        // System.out.println("EOFSQLGenerator.EOFSQLGenerator:
        // removing " + eoAdaptorPrototypesEntity.name() + " from "
        // + prototypesModel.name());
        prototypesModel.removeEntity(eoAdaptorPrototypesEntity);
        removedPrototypeEntities.takeValueForKey(eoAdaptorPrototypesEntity, eoAdaptorPrototypesEntity.name());
      }
    }

    EOEntity eoPrototypesEntity = _modelGroup.entityNamed("EOPrototypes");
    if (eoPrototypesEntity != null) {
      prototypesModel = eoPrototypesEntity.model();
      prototypesModel.removeEntity(eoPrototypesEntity);
      // System.out.println("EOFSQLGenerator.EOFSQLGenerator: removing
      // " + eoPrototypesEntity.name() + " from " +
      // prototypesModel.name());
      removedPrototypeEntities.takeValueForKey(eoPrototypesEntity, eoPrototypesEntity.name());
    }

    EOEntity prototypesEntity = _modelGroup.entityNamed(prototypeEntityName);
    if (prototypesEntity == null) {
      prototypesEntity = (EOEntity) removedPrototypeEntities.valueForKey(prototypeEntityName);
    } else {
      prototypesModel = prototypesEntity.model();
      prototypesModel.removeEntity(prototypesEntity);
    }
    if (prototypesEntity != null && prototypesModel != null) {
      // System.out.println("EOFSQLGenerator.EOFSQLGenerator: setting
      // " + prototypesEntity.name() + " to EOPrototypes in " +
      // prototypesModel.name());
      prototypesEntity.setName(replacementPrototypeName);
      prototypesModel.addEntity(prototypesEntity);
    }

    Enumeration resetModelsEnum = _modelGroup.models().objectEnumerator();
    while (resetModelsEnum.hasMoreElements()) {
      EOModel model = (EOModel) resetModelsEnum.nextElement();
      model._resetPrototypeCache();
    }
  }
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

                EOEntity registeredEntity = ERXEOAccessUtilities.entityNamed(null,_entity.name());

                if(registeredEntity != null) {
                    _entity = registeredEntity;
                } else {
                    EOModel model = _entity.model();
                    if(model == null) {
                        model = ERXEOAccessUtilities.modelGroup(null).models().lastObject();
                    }
                    model.addEntity(_entity);
                    log.warn("Added <" + _entity.name() + "> to default model group.");
                }
            } catch (Exception ex) {
                throw new RuntimeException("Model or modelgroup for <" + _entity.name() + "> is null: " + entity().model(), ex);
            }
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

         * Called when a model group finished loading. Checks foreign keys by default. Override to to more...
         * @param group
         */
    protected void processModelGroup(EOModelGroup group) {
      for (Enumeration ge = group.models().objectEnumerator(); ge.hasMoreElements();) {
                EOModel model = (EOModel)ge.nextElement();
                String frameworkName = null;
                String modelPath = null;
                log.debug("ApplicationDidFinishLaunching: " + model.name());
               
                if(isRapidTurnaroundEnabled()) {
                    for(Enumeration e = NSArray.componentsSeparatedByString(model.pathURL().getFile(), File.separator).reverseObjectEnumerator(); e.hasMoreElements(); ) {
                        String a = (String)e.nextElement();
                        if(a.indexOf(".framework") > 0) {
                            frameworkName = a.substring(0, a.indexOf(".framework"));
                            break;
                        }
                    }
                    if(frameworkName == null) {
                        frameworkName = "app";
                    }
                    modelPath = ERXFileUtilities.pathForResourceNamed(model.name() + ".eomodeld", frameworkName, null);
                    defaultLog.debug("Path for model <" + model.name() + "> in framework <"+frameworkName+">: " + modelPath);
                }
                               
                for (Enumeration ee = model.entities().objectEnumerator(); ee.hasMoreElements();) {
                    EOEntity entity = (EOEntity)ee.nextElement();
                    checkForeignKeys(entity);
                    EOClassDescription cd = EOClassDescription.classDescriptionForEntityName(entity.name());
                    defaultLog.debug("Reading defaults for: " + entity.name());
                    if(cd instanceof ERXEntityClassDescription) {
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

         * <code>registerDescriptionForEntitiesInModel</code>
         *
         * @param n notification that has the EOModel that was loaded.
         */
        public final void modelWasAdded(NSNotification n) {
          EOModel model = ((EOModel)n.object());
            log.debug("ModelWasAddedNotification: " + model.name());
            // Don't want this guy getting in our way.
            NSNotificationCenter.defaultCenter().removeObserver(model);
            try {
                registerDescriptionForEntitiesInModel(model);
            } catch (RuntimeException e) {
                log.error("Error registering model: " + model.name(), e);
                throw e;
            }
        }
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

  public ERXDatabase(EODatabase _database) {
    this(_database.adaptor());
    Enumeration modelsEnum = _database.models().objectEnumerator();
    while (modelsEnum.hasMoreElements()) {
      EOModel model = (EOModel) modelsEnum.nextElement();
      addModel(model);
    }
    _database.dispose();
  }
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

    }
  }

  private void createTables(boolean dropTables) {
    for (Enumeration e = EOModelGroup.defaultGroup().models().objectEnumerator(); e.hasMoreElements();) {
      final EOModel eomodel = (EOModel) e.nextElement();
      EODatabaseContext dbc = EOUtilities.databaseContextForModelNamed(ec, eomodel.name());
      dbc.lock();
      try {
        EOAdaptorChannel channel = dbc.availableChannel().adaptorChannel();
        if (eomodel.adaptorName().contains("JDBC")) {
          EOSynchronizationFactory syncFactory = (EOSynchronizationFactory) channel.adaptorContext().adaptor().synchronizationFactory();
          ERXSQLHelper helper = ERXSQLHelper.newSQLHelper(channel);
          NSDictionary options = helper.defaultOptionDictionary(true, dropTables);

          // Primary key support creation throws an unwanted exception
          // if
          // EO_PK_TABLE already
          // exists (e.g. in case of MySQL), so we add pk support in a
          // stand-alone step
          options = optionsWithPrimaryKeySupportDisabled(options);
          createPrimaryKeySupportForModel(eomodel, channel, syncFactory);

          String sqlScript = syncFactory.schemaCreationScriptForEntities(eomodel.entities(), options);
          log.info("Creating tables: " + eomodel.name());
          ERXJDBCUtilities.executeUpdateScript(channel, sqlScript, true);
        }
      } catch (SQLException ex) {
        log.error("Can't update: " + ex, ex);
      } finally {
View Full Code Here

Examples of com.webobjects.eoaccess.EOModel

  }

  public static synchronized void registerDescriptionForClass(Class clazz, NSArray keys) {
    String entityName = "Pojo" + ERXStringUtilities.lastPropertyKeyInKeyPath(clazz.getName().replaceAll("\\$", ""));
    if (pojoModel == null) {
      pojoModel = new EOModel();
      pojoModel.setName("PojoModel");
      //ak: fake name for possible NPE
      pojoModel.setAdaptorName("JDBCAdaptor");
      //ak: fake dict for possible NPE
      pojoModel.setConnectionDictionary(new NSMutableDictionary());
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.