Search in sources :

Example 56 with NSMutableDictionary

use of com.webobjects.foundation.NSMutableDictionary in project wonder-slim by undur.

the class ERXOncePerRequestConditional method displayCountDict.

public NSMutableDictionary displayCountDict() {
    NSMutableDictionary displayCountDict = (NSMutableDictionary) ERXWOContext.contextDictionary().objectForKey("ERXOncePerRequestDisplayCountDict");
    if (displayCountDict == null) {
        displayCountDict = new NSMutableDictionary();
        ERXWOContext.contextDictionary().setObjectForKey(displayCountDict, "ERXOncePerRequestDisplayCountDict");
    }
    return displayCountDict;
}
Also used : NSMutableDictionary(com.webobjects.foundation.NSMutableDictionary)

Example 57 with NSMutableDictionary

use of com.webobjects.foundation.NSMutableDictionary in project wonder-slim by undur.

the class WOHelperFunctionDeclarationParser method parseDeclarations.

public NSMutableDictionary parseDeclarations(String declarationStr) throws WOHelperFunctionDeclarationFormatException {
    String strWithoutComments = _removeOldStyleCommentsFromString(declarationStr);
    strWithoutComments = _removeNewStyleCommentsAndQuotedStringsFromString(strWithoutComments);
    NSMutableDictionary declarations = parseDeclarationsWithoutComments(strWithoutComments);
    return declarations;
}
Also used : NSMutableDictionary(com.webobjects.foundation.NSMutableDictionary)

Example 58 with NSMutableDictionary

use of com.webobjects.foundation.NSMutableDictionary in project wonder-slim by undur.

the class WOHelperFunctionDeclarationParser method _associationsForDictionaryString.

private NSMutableDictionary _associationsForDictionaryString(String declarationHeader, String declarationBody) throws WOHelperFunctionDeclarationFormatException {
    NSMutableDictionary associations = new NSMutableDictionary();
    String trimmedDeclarationBody = declarationBody.trim();
    if (!trimmedDeclarationBody.startsWith("{") && !trimmedDeclarationBody.endsWith("}")) {
        throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Internal inconsistency : invalid dictionary for declaration:\n" + declarationHeader + " " + declarationBody);
    }
    int declarationBodyLength = trimmedDeclarationBody.length();
    if (declarationBodyLength <= 2) {
        return associations;
    }
    trimmedDeclarationBody = trimmedDeclarationBody.substring(1, declarationBodyLength - 1).trim();
    NSArray bindings = NSArray.componentsSeparatedByString(trimmedDeclarationBody, ";");
    Enumeration bindingsEnum = bindings.objectEnumerator();
    do {
        if (!bindingsEnum.hasMoreElements()) {
            break;
        }
        String binding = ((String) bindingsEnum.nextElement()).trim();
        if (binding.length() != 0) {
            int equalsIndex = binding.indexOf('=');
            if (equalsIndex < 0) {
                throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Invalid line. No equal in line:\n" + binding + "\nfor declaration:\n" + declarationHeader + " " + declarationBody);
            }
            String key = binding.substring(0, equalsIndex).trim();
            if (key.length() == 0) {
                throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing binding in line:\n" + binding + "\nfor declaration:\n" + declarationHeader + " " + declarationBody);
            }
            String value = binding.substring(equalsIndex + 1).trim();
            if (value.length() == 0) {
                throw new WOHelperFunctionDeclarationFormatException("<WOHelperFunctionDeclarationParser> Missing value in line:\n" + binding + "\nfor declaration:\n" + declarationHeader + " " + declarationBody);
            }
            WOAssociation association = WOHelperFunctionDeclarationParser._associationWithKey(value, _quotedStrings);
            Object quotedString = _quotedStrings.objectForKey(key);
            if (quotedString != null) {
                associations.setObjectForKey(association, quotedString);
            } else {
                associations.setObjectForKey(association, key);
            }
        }
    } while (true);
    // }
    return associations;
}
Also used : WOAssociation(com.webobjects.appserver.WOAssociation) Enumeration(java.util.Enumeration) NSArray(com.webobjects.foundation.NSArray) NSMutableDictionary(com.webobjects.foundation.NSMutableDictionary)

Example 59 with NSMutableDictionary

use of com.webobjects.foundation.NSMutableDictionary in project wonder-slim by undur.

the class WOHelperFunctionDeclarationParser method declarationsWithString.

public static NSMutableDictionary declarationsWithString(String declarationStr) throws WOHelperFunctionDeclarationFormatException {
    WOHelperFunctionDeclarationParser declarationParser = new WOHelperFunctionDeclarationParser();
    NSMutableDictionary declarations = declarationParser.parseDeclarations(declarationStr);
    return declarations;
}
Also used : NSMutableDictionary(com.webobjects.foundation.NSMutableDictionary)

Aggregations

NSMutableDictionary (com.webobjects.foundation.NSMutableDictionary)59 Enumeration (java.util.Enumeration)12 WOAssociation (com.webobjects.appserver.WOAssociation)10 WOComponent (com.webobjects.appserver.WOComponent)8 NSDictionary (com.webobjects.foundation.NSDictionary)7 NSMutableArray (com.webobjects.foundation.NSMutableArray)6 WOConstantValueAssociation (com.webobjects.appserver._private.WOConstantValueAssociation)5 NSArray (com.webobjects.foundation.NSArray)5 WODeclaration (com.webobjects.appserver._private.WODeclaration)4 WOHTMLCommentString (com.webobjects.appserver._private.WOHTMLCommentString)4 NoSuchElementException (java.util.NoSuchElementException)4 StringTokenizer (java.util.StringTokenizer)4 NSForwardException (com.webobjects.foundation.NSForwardException)2 ERXMutableURL (er.extensions.foundation.ERXMutableURL)2 MalformedURLException (java.net.MalformedURLException)2 JSONObject (org.json.JSONObject)2 WOActionResults (com.webobjects.appserver.WOActionResults)1 WOContext (com.webobjects.appserver.WOContext)1 WODynamicElementCreationException (com.webobjects.appserver._private.WODynamicElementCreationException)1 NSBundle (com.webobjects.foundation.NSBundle)1