Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSMutableArray


     */
    private static NSArray varPositionsForQuery(String query) {
        int position = 0;
        boolean inQuote = false;
        char quoteChar = 0;
        NSMutableArray positions = new NSMutableArray();

        while( position < query.length() ) {
            char c = query.charAt( position );
            if( c == '\\' ) {
                position += 2;
                continue;
            }
            if( inQuote == false && ( c == '\'' || c == '\"' ) ) {
                quoteChar = c;
                inQuote = true;
            } else if( inQuote && c == quoteChar ) {
                inQuote = false;
            } else if( inQuote == false && c == '?' ) {
                positions.addObject(position);
            }

            position++;
        }

View Full Code Here


      NSTimestamp temp = start;
      start = end;
      end = temp;
    }

    NSMutableArray dates = new NSMutableArray();

    Day loopDay = new Day(start);
    Day startDay = new Day(start);
    Day endDay = new Day(end);

    while (loopDay.before(endDay)) {
      dates.addObject(loopDay);
      loopDay = loopDay.next();
    }

    dates.addObject(endDay);

    return dates;
  }
View Full Code Here

    private NSMutableArray _compareList;
    public NSArray compareList() {
        if (_compareList == null) {
            NSArray list = displayGroup().displayedObjects();
            _compareList = new NSMutableArray();
            if (list != null && list.count() > 0) {
                _compareList.addObject(list.objectAtIndex(0));
                Object o=comparisonObject();
                if (o!=null) _compareList.addObject(o);
                _compareList.addObjectsFromArray(list);
View Full Code Here

        if (null==_subList) {
            _realSize = list().count();
            if (_realSize > numberToDisplay()) {
                int anIndex;
                int count = numberToDisplay();
                NSMutableArray aSubList = new NSMutableArray(count);
                for (anIndex = 0; anIndex < count ; anIndex++) {
                    aSubList.addObject(list().objectAtIndex(anIndex));
                }
                _subList = aSubList;
            } else {
                _subList = list();
            }
View Full Code Here

  public NSArray list() {
    NSArray list = (NSArray) valueForBinding("list");
    if (_list == null || !_list.equals(list)) {
      _list = list;
      if (!ERXComponentUtilities.booleanValueForBinding(this, "mandatory", true)) {
        NSMutableArray optionList = _list.mutableClone();
        optionList.insertObjectAtIndex(NSKeyValueCoding.NullValue, 0);
        _list = optionList;
      }
    }
    return _list;
  }
View Full Code Here

        Object aSourceObject = _localSourceObject();
        boolean isDictionary = (aSourceObject instanceof NSMutableDictionary);
        NSMutableDictionary _dictionary = (isDictionary) ? (NSMutableDictionary) aSourceObject : null;
        EOEnterpriseObject _eo = (!isDictionary) ? (EOEnterpriseObject) aSourceObject : null;
        String masterKey = _localRelationshipKey();
        NSMutableArray currentValues = (NSMutableArray) NSKeyValueCoding.Utility.valueForKey(aSourceObject, masterKey);
        int count = currentValues.count();
        EOEnterpriseObject o;

        for (int i = count - 1; i >= 0; i--) {
            o = (EOEnterpriseObject) currentValues.objectAtIndex(i);

            if (newValues == null || newValues.indexOfIdenticalObject(o) == NSArray.NotFound) { // not found

                if (isDictionary) {
                    currentValues.removeObject(o);
                }
                else {
                    _eo.removeObjectFromBothSidesOfRelationshipWithKey(o, masterKey);
                }

            }

        }

        count = (newValues == null) ? 0 : newValues.count();

        for (int i = count - 1; i >= 0; i--) {
            o = (EOEnterpriseObject) newValues.objectAtIndex(i);

            if (currentValues.indexOfIdenticalObject(o) == NSArray.NotFound) {  // not found

                if (isDictionary) {
                    currentValues.addObject(o);
                }
                else {
                    _eo.addObjectToBothSidesOfRelationshipWithKey(o, masterKey);
                }
View Full Code Here

        propertiesPaths.addObject(path);
      }
    }
   
    public static NSArray<String> pathsForUserAndBundleProperties(boolean reportLoggingEnabled) {
        NSMutableArray<String> propertiesPaths = new NSMutableArray();
        NSMutableArray<String> projectsInfo = new NSMutableArray();

        /*  Properties for frameworks */
        NSArray frameworkNames = (NSArray) NSBundle.frameworkBundles().valueForKey("name");
        Enumeration e = frameworkNames.reverseObjectEnumerator();
        while (e.hasMoreElements()) {
          String frameworkName = (String) e.nextElement();

          String propertyPath = ERXFileUtilities.pathForResourceNamed("Properties", frameworkName, null);
          addIfPresent(frameworkName + ".framework", propertyPath, propertiesPaths, projectsInfo);

          /** Properties.dev -- per-Framework-dev properties
           * This adds support for Properties.dev in your Frameworks new load order will be
           */
          String devPropertiesPath = ERXApplication.isDevelopmentModeSafe() ? ERXProperties.variantPropertiesInBundle("dev", frameworkName) : null;
          addIfPresent(frameworkName + ".framework.dev", devPropertiesPath, propertiesPaths, projectsInfo);
         
          /** Properties.<userName> -- per-Framework-per-User properties */
          String userPropertiesPath = ERXProperties.variantPropertiesInBundle(ERXSystem.getProperty("user.name"), frameworkName);
          addIfPresent(frameworkName + ".framework.user", userPropertiesPath, propertiesPaths, projectsInfo);
        }

    NSBundle mainBundle = NSBundle.mainBundle();
   
    if( mainBundle != null ) {
          String mainBundleName = mainBundle.name();
 
          String appPath = ERXFileUtilities.pathForResourceNamed("Properties", "app", null);
        addIfPresent(mainBundleName + ".app", appPath, propertiesPaths, projectsInfo);
    }

    /*  WebObjects.properties in the user home directory */
    String userHome = ERXSystem.getProperty("user.home");
    if (userHome != null && userHome.length() > 0) {
      File file = new File(userHome, "WebObjects.properties");
      if (file.exists() && file.isFile() && file.canRead()) {
        try {
          String userHomePath = file.getCanonicalPath();
            addIfPresent("{$user.home}/WebObjects.properties", userHomePath, propertiesPaths, projectsInfo);
        }
        catch (java.io.IOException ex) {
          ERXProperties.log.error("Failed to load the configuration file '" + file.getAbsolutePath() + "'.", ex);
        }
      }
        }

    /*  Optional properties files */
    if (optionalConfigurationFiles() != null && optionalConfigurationFiles().count() > 0) {
      for (Enumeration configEnumerator = optionalConfigurationFiles().objectEnumerator(); configEnumerator.hasMoreElements();) {
        String configFile = (String) configEnumerator.nextElement();
        File file = new File(configFile);
        if (file.exists() && file.isFile() && file.canRead()) {
          try {
            String optionalPath = file.getCanonicalPath();
              addIfPresent("Optional Configuration", optionalPath, propertiesPaths, projectsInfo);
          }
          catch (java.io.IOException ex) {
            ERXProperties.log.error("Failed to load configuration file '" + file.getAbsolutePath() + "'.", ex);
          }
        }
        else {
          ERXProperties.log.error("The optional configuration file '" + file.getAbsolutePath() + "' either does not exist or could not be read.");
        }
      }
    }

    optionalPropertiesLoader(ERXSystem.getProperty("user.name"), propertiesPaths, projectsInfo);
   
        /** /etc/WebObjects/AppName/Properties -- per-Application-per-Machine properties */
        String applicationMachinePropertiesPath = ERXProperties.applicationMachinePropertiesPath("Properties");
      addIfPresent("Application-Machine Properties", applicationMachinePropertiesPath, propertiesPaths, projectsInfo);

        /** Properties.dev -- per-Application-dev properties */
        String applicationDeveloperPropertiesPath = ERXProperties.applicationDeveloperProperties();
      addIfPresent("Application-Developer Properties", applicationDeveloperPropertiesPath, propertiesPaths, projectsInfo);

        /** Properties.<userName> -- per-Application-per-User properties */
        String applicationUserPropertiesPath = ERXProperties.applicationUserProperties();
      addIfPresent("Application-User Properties", applicationUserPropertiesPath, propertiesPaths, projectsInfo);

        /*  Report the result */
    if (reportLoggingEnabled && projectsInfo.count() > 0 && log.isInfoEnabled()) {
      StringBuilder message = new StringBuilder();
      message.append("\n\n").append("ERXProperties has found the following Properties files: \n");
      message.append(projectsInfo.componentsJoinedByString("\n"));
      message.append('\n');
      message.append("ERXProperties currently has the following properties:\n");
      message.append(ERXProperties.logString(ERXSystem.getProperties()));
      // ERXLogger.configureLoggingWithSystemProperties();
      log.info(message.toString());
View Full Code Here

     *
     *   @return 全プロパティーの配列
     * </span>
     */
    public static NSArray<Property> allProperties() {
      NSMutableArray props = new NSMutableArray();
      for (Enumeration e = ERXSystem.getProperties().keys(); e.hasMoreElements();) {
        String key = (String) e.nextElement();
        String object = "" + ERXSystem.getProperty(key);
        props.addObject(new Property(key, object));
      }
      return (NSArray) props.valueForKey("@sortAsc.key");
     }
View Full Code Here

        _context = ERD2WContext.newContext();
        _context.setDynamicPage(_pageConfiguration);
        _context.setTask(_context.task());
        _context.setEntity(_context.entity());
        if(pageKeys == null) {
            _pageLevelKeys = new NSMutableArray(new Object[] {"pageWrapperName", "displayPropertyKeys", "pageName"});
        } else {
            _pageLevelKeys = pageKeys.mutableClone();
        }
        NSArray keys = new NSMutableArray(new Object[] {"componentName", "customComponentName",
                "displayNameForProperty", "propertyKey"});
        _componentLevelKeys = new NSMutableArray();
        if(componentKeys != null) {
            _componentLevelKeys = componentKeys.mutableClone();
        }
        for(Enumeration e = keys.objectEnumerator(); e.hasMoreElements(); ) {
          String key = (String)e.nextElement();
          if(!_componentLevelKeys.containsObject(key)) {
            _componentLevelKeys.addObject(key);
          }
        }
View Full Code Here

            }
        }
    }

    public NSArray rulesForLevel(int level) {
        NSMutableArray arr = new NSMutableArray();
        for(Enumeration e = dictionary().keyEnumerator(); e.hasMoreElements(); ) {
            String key = (String)e.nextElement();
            if(!"componentLevelKeys".equals(key)) {
                Object value = dictionary().valueForKey(key);
                EOQualifier q = EOQualifier.qualifierWithQualifierFormat( "pageConfiguration = '" + _pageConfiguration + "'" , null);
                Assignment a = createAssigment(key, value);
                arr.addObject(new Rule(level, q, a));
            }
        }
        NSArray keys = (NSArray)_dictionary.valueForKey("displayPropertyKeys");
        if(keys != null && keys.count() > 0) {
            addRulesForPropertyKeys(level, arr, keys);
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSMutableArray

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.