Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSArray


      }
    }
  }

  protected void ensureSingleTableInheritanceParentEntitiesAreIncluded() {
    Enumeration entitiesEnum = new NSArray(_entities).objectEnumerator();
    while (entitiesEnum.hasMoreElements()) {
      EOEntity entity = (EOEntity) entitiesEnum.nextElement();
      ensureSingleTableInheritanceParentEntitiesAreIncluded(entity);
    }
  }
View Full Code Here


    EOEntity parentEntity = entity.parentEntity();
    return parentEntity != null && entity.externalName() != null && entity.externalName().equalsIgnoreCase(parentEntity.externalName());
  }

  protected void createLocalizedAttributes(EOEntity entity) {
    NSArray attributes = entity.attributes().immutableClone();
    NSArray classProperties = entity.classProperties().immutableClone();
    NSArray attributesUsedForLocking = entity.attributesUsedForLocking().immutableClone();
    if (attributes == null) {
      attributes = NSArray.EmptyArray;
    }
    if (classProperties == null) {
      classProperties = NSArray.EmptyArray;
    }
    if (attributesUsedForLocking == null) {
      attributesUsedForLocking = NSArray.EmptyArray;
    }
    NSMutableArray mutableClassProperties = classProperties.mutableClone();
    NSMutableArray mutableAttributesUsedForLocking = attributesUsedForLocking.mutableClone();
    for (Enumeration e = attributes.objectEnumerator(); e.hasMoreElements();) {
      EOAttribute attribute = (EOAttribute) e.nextElement();
      NSDictionary userInfo = attribute.userInfo();
      String name = attribute.name();
      if (userInfo != null) {
        Object l = userInfo.valueForKey("ERXLanguages");
        if (l != null && !(l instanceof NSArray)) {
          l = (entity.model().userInfo() != null ? entity.model().userInfo().valueForKey("ERXLanguages") : null);
        }

        NSArray languages = (NSArray) l;
        if (languages != null && languages.count() > 0) {
          String columnName = attribute.columnName();
          for (int i = 0; i < languages.count(); i++) {
            String language = (String) languages.objectAtIndex(i);
            String newName = name + "_" + language;
            String newColumnName = columnName + "_" + language;

            EOAttribute newAttribute = new EOAttribute();
            newAttribute.setName(newName);
View Full Code Here

  }

  public List reverseEngineerTableNames() {
    open();
    try {
      NSArray tableNamesArray = _channel.describeTableNames();
      return (List) EOFSQLUtils53.toJavaCollections(tableNamesArray);
    } finally {
      close();
    }
  }
View Full Code Here

  }

  public File reverseEngineerWithTableNamesIntoModel(List tableNamesList) throws IOException {
    open();
    try {
      NSArray tableNamesArray = (NSArray) EOFSQLUtils53.toWOCollections(tableNamesList);
      com.webobjects.eoaccess.EOModel eofModel = _channel.describeModelWithTableNames(tableNamesArray);
      eofModel.beautifyNames();
      File tempFile = File.createTempFile("EntityModeler", "tmp");
      File eomodelFolder = new File(tempFile.getParentFile(), "EM" + System.currentTimeMillis() + ".eomodeld");
      tempFile.delete();
View Full Code Here

    ///////////
    // Utility
    ///////////
    protected EOSortOrdering _primarySortOrdering() {
        NSArray anArray = displayGroup().sortOrderings();
        if ((anArray!=null) && (anArray.count() > 0)) {
            EOSortOrdering anOrdering = (EOSortOrdering)anArray.objectAtIndex(0);
            return anOrdering;
        }
        return null;
    }
View Full Code Here

  public Object rawPrimaryKeyInTransaction() {
    Object result = rawPrimaryKey();
    if (result == null) {
      NSDictionary pk = primaryKeyDictionary(false);
      NSArray primaryKeyAttributeNames = primaryKeyAttributeNames();
      result = ERXArrayUtilities.valuesForKeyPaths(pk, primaryKeyAttributeNames);
      if (((NSArray) result).count() == 1)
        result = ((NSArray) result).lastObject();
    }
    return result;
View Full Code Here

                          // String=>Object, but I
                          // don't know when it is and
                          // when it isn't, so
                          // we go ahead and check for
                          // both conditions.
                          value = foreignKey.objectForKey(new NSArray(join.destinationAttribute().name()));
                          if (value instanceof NSArray) {
                            value = ((NSArray) value).lastObject();
                          }
                        }
                      }
View Full Code Here

   */
  public NSDictionary<String, Object> committedSnapshot() {
    if (!isNewObject()) {
      return editingContext().committedSnapshotForObject(this);
    }
    NSArray keys = allPropertyKeys();
    NSMutableDictionary allNullDict = new NSMutableDictionary(keys.count());
    ERXDictionaryUtilities.setObjectForKeys(allNullDict, NSKeyValueCoding.NullValue, keys);
    return allNullDict;
  }
View Full Code Here

  public ERXEnterpriseObject refetchObjectFromDBinEditingContext(EOEditingContext ec) {
    EOEntity entity = ERXEOAccessUtilities.entityNamed(ec, entityName());
    EOQualifier qual = entity.qualifierForPrimaryKey(primaryKeyDictionary(false));
    EOFetchSpecification fetchSpec = new EOFetchSpecification(entityName(), qual, null);
    fetchSpec.setRefreshesRefetchedObjects(true);
    NSArray results = ec.objectsWithFetchSpecification(fetchSpec);
    ERXEnterpriseObject freshObject = null;
    if (results.count() > 0) {
      freshObject = (ERXEnterpriseObject) results.objectAtIndex(0);
    }
    return freshObject;
  }
View Full Code Here

    public void setSelection(String anIndex) {
        if (anIndex != null) {
            int idx = Integer.parseInt(anIndex);
            // ** push the selection to the parent
            NSArray anItemList = (NSArray)_WOJExtensionsUtil.valueForBindingOrNull("list",this);
            Object aSelectedObject = anItemList.objectAtIndex(idx);
            setValueForBinding(aSelectedObject, "selection");
        }
        // ** and force it to be pulled if there's a next time.
        _selection = null;
    }
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSArray

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.