Package com.webobjects.eoaccess

Examples of com.webobjects.eoaccess.EOModelGroup


    public GSVModel(String path) throws IllegalArgumentException {
        if(this.validateEOModelForPath(path)){
            _entities = new NSMutableArray();
            _eomodelPath = path;
            _eomodelName = NSPathUtilities.stringByDeletingPathExtension(NSPathUtilities.lastPathComponent(_eomodelPath));
            _eomodelGroup = new EOModelGroup();
            _eomodelGroup.addModelWithPath(_eomodelPath);
            //this.saveModel();
        } else {
            throw new IllegalArgumentException("Could not find a valid EOModel at: " + path);
        }
View Full Code Here


        //We changed "Name" to "EOModelName", so for backward compatibility, if "EOModelName"
        //doesn't exist, we have to check for "Name"
        if( _eomodelName == null ){
            _eomodelName = (String)decoder.decodeObjectForKey("Name");
        }
        _eomodelGroup = new EOModelGroup();
        _eomodelPath = (String)decoder.decodeObjectForKey("EOModelPath");
    }
View Full Code Here

        entity.setClassProperties(mutableClassProperties);
      }
    }

    public static void modelGroupAdded(NSNotification n) {
      EOModelGroup group = (EOModelGroup) n.object();
      new LocalizedAttributeProcessor().adjustLocalizedAttributes(group);
    }
View Full Code Here

    protected String modelPath;
   
    public void setModelPath(String value) {
        modelPath = value;
        modelGroup = new EOModelGroup();
        model = modelGroup.addModelWithPath(modelPath);
        prototypes = model.entityNamed("EOPrototypes");
        if(prototypes == null)
            prototypes = model.entityNamed("EOJDBCPrototypes");
    }
View Full Code Here

     */
    public static EOEntity entityMatchingString(EOEditingContext ec, String string) {
        EOEntity result = null;
        if (string != null) {
            String lowerCaseName = string.toLowerCase();
            EOModelGroup group = modelGroup(ec);
            NSArray<String> entityNames = (NSArray<String>) ERXUtilities.entitiesForModelGroup(group).valueForKeyPath("name.toLowerCase");
            NSMutableArray<String> possibleEntities = new NSMutableArray<String>();
            for (String lowercaseEntityName : entityNames) {
                if (lowerCaseName.indexOf(lowercaseEntityName) != -1) possibleEntities.addObject(lowercaseEntityName);
            }
View Full Code Here

     *            the EOSQLExpression in question
     *
     * @return array of dictionaries
     */
    public static NSArray<NSDictionary> rawRowsForSQLExpression(EOEditingContext ec, String modelName, EOSQLExpression expression) {
      EOModelGroup modelGroup = EOUtilities.modelGroup(ec);
        EOModel model = modelGroup.modelNamed(modelName);
      return ERXEOAccessUtilities.rawRowsForSQLExpression(ec, model, expression, null);
    }
View Full Code Here

            WOSession s = ERXSession.anySession();
            if (s != null) {
                ec = s.defaultEditingContext();
            }
        }
        EOModelGroup group;
        if (ec == null) {
            group = EOModelGroup.defaultGroup();
        } else {
            group = EOModelGroup.modelGroupForObjectStoreCoordinator((EOObjectStoreCoordinator) ec.rootObjectStore());
        }
View Full Code Here

     * @param entityName
     *            entity name
     * @return the entity with the specified name
     */
    public static EOEntity entityNamed(EOEditingContext ec, String entityName) {
        EOModelGroup modelGroup = modelGroup(ec);
        return modelGroup.entityNamed(entityName);
    }
View Full Code Here

    */
   public static NSSet verifyAllSnapshots() {
     NSMutableSet mismatches = new NSMutableSet();
     NSMutableSet verifiedDatabases = new NSMutableSet();
     EOEditingContext editingContext = ERXEC.newEditingContext();
     EOModelGroup modelGroup = EOModelGroup.defaultGroup();
     Enumeration modelsEnum = modelGroup.models().objectEnumerator();
     while (modelsEnum.hasMoreElements()) {
       EOModel model = (EOModel) modelsEnum.nextElement();
       EODatabaseContext databaseContext = null;
       try {
         databaseContext = EODatabaseContext.registeredDatabaseContextForModel(model, editingContext);
       }
       catch (IllegalStateException e) {
         log.warn("Model " + model.name() + " failed: " + e.getMessage());
       }
       if (databaseContext != null) {
         databaseContext.lock();
         try {
           EODatabase database = databaseContext.database();
           if (!verifiedDatabases.containsObject(database)) {
             Enumeration gidEnum = database.snapshots().keyEnumerator();
             while (gidEnum.hasMoreElements()) {
               EOGlobalID gid = (EOGlobalID) gidEnum.nextElement();
               if (gid instanceof EOKeyGlobalID) {
                 EOEnterpriseObject eo = null;
                 EOKeyGlobalID keyGID = (EOKeyGlobalID) gid;
                 String entityName = keyGID.entityName();
                 EOEntity entity = modelGroup.entityNamed(entityName);
                 NSDictionary snapshot = database.snapshotForGlobalID(gid);
                 if (snapshot != null) {
                   EOQualifier gidQualifier = entity.qualifierForPrimaryKey(entity.primaryKeyForGlobalID(gid));
                   EOFetchSpecification gidFetchSpec = new EOFetchSpecification(entityName, gidQualifier, null);

View Full Code Here

    protected NSMutableDictionary<String, Configuration> configuration = new NSMutableDictionary<String, Configuration>();

    public void modelGroupDidLoad(NSNotification n) {
        configuration.removeAllObjects();
        EOModelGroup group = (EOModelGroup) n.object();
        for (Enumeration e = group.models().objectEnumerator(); e.hasMoreElements();) {
            EOModel model = (EOModel) e.nextElement();
            for (Enumeration e1 = model.entities().objectEnumerator(); e1.hasMoreElements();) {
                EOEntity entity = (EOEntity) e1.nextElement();
                if (entity.userInfo() != null && entity.userInfo().objectForKey(ERXAUDIT_KEYS) != null) {
                    configureEntity(entity);
View Full Code Here

TOP

Related Classes of com.webobjects.eoaccess.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.