Package com.webobjects.directtoweb

Source Code of com.webobjects.directtoweb.ERD2WRuleEditorModel

//
// RuleEditorModel.java
// Project RuleEditor
//
// Created by ak on Fri Jun 21 2002
//
package com.webobjects.directtoweb;
import java.io.File;
import java.util.Enumeration;
import java.util.Vector;

import com.webobjects.eocontrol.EOKeyValueUnarchiver;
import com.webobjects.foundation.NSArray;
import com.webobjects.foundation.NSDictionary;
import com.webobjects.foundation.NSForwardException;
import com.webobjects.foundation.NSLog;
import com.webobjects.foundation.NSMutableDictionary;

public class ERD2WRuleEditorModel extends D2WModel {
   
    public ERD2WRuleEditorModel(File file) {
        super(new EOKeyValueUnarchiver(ERD2WRuleEditorModel._dictionaryFromFile(file)));

    }

    public NSArray publicRules() {
        return rules();
    }

    public void setPublicRules(NSArray rules) {
        setRules(rules);
    }

    public Enumeration publicTasks() {
        return tasks();
    }

    public Vector publicDynamicPages() {
        return dynamicPages();
    }

    protected static NSDictionary _dictionaryFromFile(File file) {
        NSDictionary model = null;
        try {
            model = Services.dictionaryFromFile(file);
            NSArray rules = (NSArray)model.objectForKey("rules");
            Enumeration e = rules.objectEnumerator();
            while(e.hasMoreElements()) {
                NSMutableDictionary dict = (NSMutableDictionary)e.nextElement();
                if("com.webobjects.directtoweb.Rule".equals(dict.objectForKey("class"))) {
                    dict.setObjectForKey("ERD2WExtendedRule", "class");
                }
            }
        } catch (Throwable throwable) {
            NSLog.err.appendln("****** DirectToWeb: Problem reading file "
                               + file + " reason:" + throwable);
            if (NSLog.debugLoggingAllowedForLevelAndGroups(1, 40L)) {
                NSLog.err.appendln("STACKTRACE:");
                NSLog.err.appendln(throwable);
            }
            throw NSForwardException._runtimeExceptionForThrowable(throwable);
        }
        return model;
    }
}
TOP

Related Classes of com.webobjects.directtoweb.ERD2WRuleEditorModel

TOP
Copyright © 2018 www.massapi.com. 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.