Package com.webobjects.foundation

Examples of com.webobjects.foundation.NSDictionary


            NSArray qualifiers = (NSArray)_validationInfo.valueForKeyPath(validationTypeString);
            if(qualifiers != null) {
                ValidationObjectValue values = new ValidationObjectValue(object, value);
                int i = 0;
                for(Enumeration e = qualifiers.objectEnumerator(); e.hasMoreElements();) {
                    NSDictionary info = (NSDictionary)e.nextElement();
                    if(validationLog.isDebugEnabled())
                        validationLog.debug("Validate " + validationTypeString +"."+ property +" with <"+ value + "> on " + object + "\nRule: " + info);
                    if(!validateObjectValueDictWithInfo(values, info, validationTypeString+property+i)) {
                        String message = (String)info.objectForKey("message");
                        String keyPaths = (String)info.objectForKey("keyPaths");
                        property = keyPaths == null ? property : keyPaths;
                        if(validationLog.isDebugEnabled())
                            validationLog.info("Validation failed " + validationTypeString +"."+ property +" with <"+ value + "> on " + object);
                        throw ERXValidationFactory.defaultFactory().createException(object, property, value,message);
                    }
View Full Code Here


    public void readDefaultValues() {
        if(_initialDefaultValues == null) {
            _initialDefaultValues = new NSMutableDictionary();

            EOEntity entity = entity();
            NSDictionary entityInfo = (NSDictionary)entity.userInfo().objectForKey("ERXDefaultValues");

            for( Enumeration e = entity.attributes().objectEnumerator(); e.hasMoreElements();) {
                EOAttribute attr = (EOAttribute)e.nextElement();
                String defaultValue = null;

                if(attr.userInfo() != null)
                    defaultValue = (String)attr.userInfo().objectForKey(defaultKey);

                if(defaultValue == null && entityInfo != null) {
                    defaultValue = (String)entityInfo.objectForKey(attr.name());
                }
                if(defaultValue != null)
                    setDefaultAttributeValue(attr, defaultValue);
            }

            for( Enumeration e = entity.relationships().objectEnumerator(); e.hasMoreElements();) {
                EORelationship rel = (EORelationship)e.nextElement();
                String defaultValue = null;

                if(rel.userInfo() != null)
                    defaultValue = (String)rel.userInfo().objectForKey(defaultKey);

                if(defaultValue == null && entityInfo != null) {
                    defaultValue = (String)entityInfo.objectForKey(rel.name());
                }
                if(defaultValue != null)
                    setDefaultRelationshipValue(rel, defaultValue);
            }
        }
View Full Code Here

    ERXFutureTask<?> _future = new ERXFutureTask(taskInfoGID);
    ERXExecutorService.executorService().execute(_future);

    ERXRouteResults results = (ERXRouteResults)response(taskInfo, ERXKeyFilter.filterWithAttributesAndToOneRelationships());   
    WOResponse response = results.generateResponse();
    String location = hostName() + ERXRouteUrlUtils.actionUrlForRecord(_context, taskInfo, "show", format().name(), new NSDictionary(), request().isSecure(), request().isSessionIDInRequest());
    response.setHeader(location, "Content-Location");
    response.setStatus(ERXHttpStatusCodes.ACCEPTED);
    return response; 
  }
View Full Code Here

  public WOActionResults showAction() throws Throwable {
    TaskInfo taskInfo = routeObjectForKey("taskInfo");
    if (TaskInfo.WORKFLOW_PRIME_CHECKED.equals(taskInfo.workflowState())) {
      ERXRouteResults results = (ERXRouteResults)response(taskInfo, ERXKeyFilter.filterWithNone());   
      WOResponse response = results.generateResponse();
      String location = hostName() + ERXRouteUrlUtils.actionUrlForRecord(_context, taskInfo, "results", format().name(), new NSDictionary(), request().isSecure(), request().isSessionIDInRequest());
      response.setHeader(location, "Content-Location");
      response.setStatus(ERXHttpStatusCodes.SEE_OTHER);
      return response;
    }
    return response(taskInfo.workflowState(), ERXKeyFilter.filterWithAttributes());
View Full Code Here

    public static String valueFromPlistBundleWithKey(NSBundle bundle, String plist, String key) {
      if (bundle == null)
        return "";

      String dictString = new String(bundle.bytesForResourcePath(plist));
      NSDictionary versionDictionary = NSPropertyListSerialization.dictionaryForString(dictString);

      String versionString = (String) versionDictionary.objectForKey(key);
      return versionString == null  ""  :  versionString.trim(); // trim() removes the line ending char
    }
View Full Code Here

     * </span>
     */
    @SuppressWarnings("javadoc")
  public static NSDictionary dictionaryForKeyWithDefault(final String s, final NSDictionary defaultValue) {
        final String propertyName = getApplicationSpecificPropertyName(s);
    NSDictionary value;
    Object cachedValue = _cache.get(propertyName);
    if (UndefinedMarker.equals(cachedValue)) {
      value = defaultValue;
    } else if (cachedValue instanceof NSDictionary) {
      value = (NSDictionary) cachedValue;
View Full Code Here

     * </span>
     */
    @SuppressWarnings("javadoc")
  public static Properties propertiesFromArgv(String[] argv) {
      ERXProperties._Properties properties = new ERXProperties._Properties();
        NSDictionary argvDict = NSProperties.valuesFromArgv(argv);
        Enumeration e = argvDict.allKeys().objectEnumerator();
        while (e.hasMoreElements()) {
            Object key = e.nextElement();
            properties.put(key, argvDict.objectForKey(key));
        }
        return properties;
    }
View Full Code Here

            Object o = e.nextElement();
            if(o instanceof NSArray) {
                addRulesForPropertyKeys(level, rules, keys);
            } else {
                String propertyKey = (String)o;
                NSDictionary values = (NSDictionary)dictionary().valueForKeyPath("componentLevelKeys." + propertyKey);
                EOQualifier q = EOQualifier.qualifierWithQualifierFormat( "pageConfiguration = '" + _pageConfiguration + "' and propertyKey = '" + propertyKey + "'" , null);
                for (Enumeration e1 = values.keyEnumerator(); e1.hasMoreElements();) {
                    String key = (String)e1.nextElement();
                    Object value = values.objectForKey(key);
                    Assignment a = createAssigment(key, value);
                    rules.addObject(new Rule(level, q, a));
                }
            }
        }
View Full Code Here

      public Configuration() {
        NSMutableArray bundles = NSBundle.frameworkBundles().mutableClone();
        bundles.addObject(NSBundle.mainBundle());
        for(Enumeration e = bundles.objectEnumerator(); e.hasMoreElements(); ) {
          NSBundle bundle = (NSBundle)e.nextElement();
          NSDictionary dict;
          String path = bundle.resourcePathForLocalizedResourceNamed("d2wclientConfiguration.plist", null);
          if(path != null) {
            dict = ERXDictionaryUtilities.dictionaryFromPropertyList("d2wclientConfiguration", bundle);
            if(dict != null) {
              if(dict.objectForKey("components") != null) {
                components.addEntriesFromDictionary((NSDictionary)dict.objectForKey("components"));
              }
              if(dict.objectForKey("editors") != null) {
                editors.addEntriesFromDictionary((NSDictionary)dict.objectForKey("editors"));
              }
            }
          }
        }
      }
View Full Code Here

      EOQualifier qualifier = new EOAndQualifier(new NSArray<EOQualifier>(new EOQualifier[]{q1, q2, q3}));
      EOFetchSpecification fs = new EOFetchSpecification("LuceneAsset", qualifier, null);
      fs.setFetchLimit(5);
      fs.setSortOrderings(new NSArray(new EOSortOrdering("userCount", EOSortOrdering.CompareAscending)));
      Query query = ERLuceneAdaptorChannel.queryForQualifier(new EOKeyValueQualifier("userCount", EOQualifier.QualifierOperatorLessThanOrEqualTo, 802), EOUtilities.entityNamed(ec, "LuceneAsset"));
      fs.setHints(new NSDictionary(query, ERLuceneAdaptor.QUERY_HINTS));
      NSArray<EOEnterpriseObject> result = ec.objectsWithFetchSpecification(fs);
      log.info(result.count() + ": " + result.valueForKey("userCount"));
      for (EOEnterpriseObject eo : result) {
        log.info(result.count() + ": " + eo);
      }
View Full Code Here

TOP

Related Classes of com.webobjects.foundation.NSDictionary

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.