Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSMutableSet$Itr


  @Override
  protected void actionInvoked(WORequest request, WOContext context) {
    String message = request.stringFormValueForKey(InstantMessengerAdaptor.MESSAGE_KEY);
    String lowercaseMessage = message.trim().toLowerCase();
    NSMutableSet yes = new NSMutableSet();
    yes.addObject("yes");
    yes.addObject("y");
    yes.addObject("yep");
    yes.addObject("true");

    NSMutableSet no = new NSMutableSet();
    no.addObject("no");
    no.addObject("n");
    no.addObject("nope");
    no.addObject("nah");

    WOComponent component = context.component();
    if (yes.containsObject(lowercaseMessage)) {
      _confirmed.setValue(Boolean.TRUE, component);
    }
    else if (no.containsObject(lowercaseMessage)) {
      _confirmed.setValue(Boolean.FALSE, component);
    }
    else {
      _confirmed.setValue(null, component);
    }
View Full Code Here


    @Override
    public NSArray _foreignKeyConstraintStatementsForEntityGroup(NSArray group) {
        if (group == null)
            return NSArray.EmptyArray;
        NSMutableArray result = new NSMutableArray();
        NSMutableSet generatedStatements = new NSMutableSet();
        int i = 0;
        for (int groupCount = group.count(); i < groupCount; i++) {
            EOEntity currentEntity = (EOEntity) group.objectAtIndex(i);
            if (currentEntity.externalName() != null) {
                NSArray relationships = currentEntity.relationships();
                int relCount = relationships.count();
                for (int j = 0; j < relCount; j++) {
                    EORelationship currentRelationship = ((EORelationship) relationships.objectAtIndex(j));
                    if (_shouldGenerateForeignKeyConstraints(currentRelationship)) {
                        NSArray statements = foreignKeyConstraintStatementsForRelationship(currentRelationship);
                        if (!generatedStatements.containsObject(statements.valueForKey("statement"))) {
                            result.addObjectsFromArray(statements);
                            generatedStatements.addObject(statements.valueForKey("statement"));
                        }
                    }
                }
            }
        }
View Full Code Here

     *            an array of <code>EOEntity</code> objects
     * @return the array of SQL statements
     */
    @Override
    public NSArray dropPrimaryKeySupportStatementsForEntityGroup(NSArray entityGroup) {
        NSMutableSet sequenceNames = new NSMutableSet();
        NSMutableArray results = new NSMutableArray();
        int count = entityGroup.count();
        for (int i = 0; i < count; i++) {
            EOEntity entity = (EOEntity) entityGroup.objectAtIndex(i);
            String sequenceName = DB2PlugIn._sequenceNameForEntity(entity);
            if (!sequenceNames.containsObject(sequenceName)) {
                sequenceNames.addObject(sequenceName);
                String sql = "DROP SEQUENCE " + sequenceName ;
                results.addObject(createExpression(entity, sql));
            }
        }
        return results;
View Full Code Here

        NSMutableArray results;
        NSArray priKeyAttributes;
        EOAttribute priKeyAttribute;
        String sequenceName;

        NSMutableSet sequenceNames = new NSMutableSet();
        results = new NSMutableArray();
        count = entityGroup.count();
        for (i = 0; i < count; i++) {
            entity = (EOEntity) entityGroup.objectAtIndex(i);
            priKeyAttributes = entity.primaryKeyAttributes();
            if (priKeyAttributes.count() == 1) {
                priKeyAttribute = (EOAttribute) priKeyAttributes.objectAtIndex(0);
               
                // Q: Don't create a sequence for non number primary keys
                if (priKeyAttribute.adaptorValueType() != EOAttribute.AdaptorNumberType) {
                  continue;
                }
                String sql;

                sequenceName = DB2PlugIn._sequenceNameForEntity(entity);
                if (!sequenceNames.containsObject(sequenceName)) {
                    sequenceNames.addObject(sequenceName);
                    // timc 2006-11-06 create result here so we can check for
                    // enableIdentifierQuoting while building the statement

                    sql = "CREATE SEQUENCE " + sequenceName;
                    results.addObject(createExpression(entity, sql));
View Full Code Here

    /**
     * Quote table name if necessary
     */
    @Override
    public NSArray createTableStatementsForEntityGroup(NSArray entityGroup) {
    NSMutableSet columnNames = new NSMutableSet();
    StringBuffer aStatement = new StringBuffer(128);
    if (entityGroup != null && entityGroup.count() > 0) {
      EOSQLExpression sqlExpr = _expressionForEntity((EOEntity) entityGroup.objectAtIndex(0));
      for (Iterator entityIterator = entityGroup.iterator(); entityIterator.hasNext();) {
        EOEntity entity = (EOEntity) entityIterator.next();
        Iterator attributeIterator = entity.attributes().iterator();
        while (attributeIterator.hasNext()) {
          EOAttribute attribute = (EOAttribute) attributeIterator.next();
          String columnName = attribute.columnName();
          if (!attribute.isDerived() && !attribute.isFlattened() && columnName != null && columnName.length() > 0 && !columnNames.contains(columnName)) {
            sqlExpr.appendItemToListString(_columnCreationClauseForAttribute(attribute), aStatement);
            columnNames.addObject(columnName);
          }
        }
      }
      return new NSArray(_expressionForString(new StringBuilder().append("CREATE TABLE ").append(formatTableName(((EOEntity) entityGroup.objectAtIndex(0)).externalName())).append(" (").append(aStatement.toString()).append(')').toString()));
    }
View Full Code Here

  private boolean _allExpanded;
  private boolean _rootExpanded;
  private _NSDelegate _delegate;

  public AjaxTreeModel() {
    _expandedTreeNodes = new NSMutableSet();
    _collapsedTreeNodes = new NSMutableSet();
    _delegate = new _NSDelegate(AjaxTreeModel.Delegate.class);
  }
View Full Code Here

      Integer insertKey = ERXConstant.integerForInt(EODatabaseOperation.AdaptorInsertOperator);
      NSArray insertOps = (NSArray) groupedOps.objectForKey(insertKey);
      Integer deleteKey = ERXConstant.integerForInt(EODatabaseOperation.AdaptorDeleteOperator);
      NSArray deleteOps = (NSArray) groupedOps.objectForKey(deleteKey);
      if (insertOps!=null && deleteOps!=null) {
        NSMutableSet skippedOps = new NSMutableSet();
        for(Enumeration e = insertOps.objectEnumerator(); e.hasMoreElements();) {
          EOAdaptorOperation insertOp = (EOAdaptorOperation)e.nextElement();
          for(Enumeration e1 = deleteOps.objectEnumerator(); e1.hasMoreElements();) {
            EOAdaptorOperation deleteOp = (EOAdaptorOperation)e1.nextElement();
            if(!skippedOps.containsObject(deleteOp)) {
              if(insertOp.entity() == deleteOp.entity()) {
                if(deleteOp.qualifier().evaluateWithObject(insertOp.changedValues())) {
                  if(false) {
                    // here we remove both the delete and the
                    // insert. this might fail if we didn't lock on all rows
                    // FIXME: check the current snapshot in the database and
                    // see if it is the same as the new insert

                    skippedOps.addObject(deleteOp);
                    skippedOps.addObject(insertOp);
                  } else {
                    // here we put the delete up front, this might fail if
                    // we have cascading delete rules in the database
                    result.addObject(deleteOp);
                    skippedOps.addObject(deleteOp);
                  }
                  log.warn("Skipped: " + insertOp + "\n" + deleteOp);
                }
              }
            }
          }
        }
          for(Enumeration e = adaptorOps.objectEnumerator(); e.hasMoreElements();) {
            EOAdaptorOperation op = (EOAdaptorOperation)e.nextElement();
            if(!skippedOps.containsObject(op)) {
              result.addObject(op);
            }
          }
      } else {
        result.addObjectsFromArray(adaptorOps);
View Full Code Here

          if(_handler.batchSizeForRelationship(ec, relationship) > 0 && !relationship.isToMany()) {
            markStart("ToOne.Calculation", source, key);
            long timestamp = source.batchFaultingTimeStamp();
            boolean fromThreadStorage = false;
            NSMutableArray<EOEnterpriseObject> eos = new NSMutableArray<EOEnterpriseObject>();
            NSMutableSet faults = new NSMutableSet();
            NSArray<EOEnterpriseObject> candidates = null;
            NSArray currentObjects = (NSArray) ERXThreadStorage.valueForKey(THREAD_KEY);
            if (currentObjects != null) {
              NSMutableArray<EOEnterpriseObject> tmpList = new NSMutableArray<EOEnterpriseObject>();
              for (Object tmpItem : currentObjects) {
                if (tmpItem instanceof AutoBatchFaultingEnterpriseObject) {
                  tmpList.add((EOEnterpriseObject) tmpItem);
                }
              }
              if (tmpList.count() > 0) {
                candidates = tmpList;
                fromThreadStorage = true;
              }
            }
            if (candidates == null) {
              candidates = ec.registeredObjects();
            }
            for (EOEnterpriseObject current : candidates) {
              if (current instanceof AutoBatchFaultingEnterpriseObject) {
                AutoBatchFaultingEnterpriseObject currentEO = (AutoBatchFaultingEnterpriseObject) current;
                if(currentEO.batchFaultingTimeStamp() == timestamp || fromThreadStorage) {
                  if(source.classDescription() == currentEO.classDescription()) {
                    if(!EOFaultHandler.isFault(currentEO)) {
                      Object fault = currentEO.storedValueForKey(key);
                      if(EOFaultHandler.isFault(fault)) {
                        faults.addObject(fault);
                        eos.addObject(currentEO);
                        if(eos.count() == autoBatchFetchSize()) {
                          break;
                        }
                      }
                    }
                  }
                }
              }
            }

            markEnd("ToOne.Calculation", source, key);
            if(eos.count() > 1) {
              markStart("ToOne.Fetching", source, key);
              doFetch(dbc, ec, relationship, eos);
              freshenFetchTimestamps(faults.allObjects(), timestamp);
              markEnd("ToOne.Fetching", source, key);
              if(batchLog.isDebugEnabled()) {
                batchLog.debug("Fetched " + faults.count() + " to-one " + relationship.destinationEntity().name() + " from " + eos.count() " " + source.entityName() + " for " + key);
              }
              return EOFaultHandler.isFault(eo);
            }
          }
        }
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSMutableSet$Itr

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.