Package org.guvnor.common.services.project.model

Examples of org.guvnor.common.services.project.model.KSessionModel


            writer.endNode();
        }
    }

    public Object unmarshal(HierarchicalStreamReader reader, final UnmarshallingContext context) {
        final KSessionModel kSession = new KSessionModel();
        kSession.setName(reader.getAttribute("name"));
        kSession.setDefault("true".equals(reader.getAttribute("default")));

        String kSessionType = reader.getAttribute("type");
        kSession.setType(kSessionType != null ? kSessionType : "stateful");

        String clockType = reader.getAttribute("clockType");
        if (clockType != null) {
            kSession.setClockType(ClockTypeOption.get(clockType));
        }

        String scope = reader.getAttribute("scope");
        if (scope != null) {
            kSession.setScope(scope);
        }

        readNodes(reader, new AbstractXStreamConverter.NodeReader() {
            public void onNode(HierarchicalStreamReader reader,
                    String name,
                    String value) {
                if ("listeners".equals(name)) {
                    while (reader.hasMoreChildren()) {
                        reader.moveDown();
                        kSession.getListeners().add(readObject(reader, context, ListenerModel.class));
                        reader.moveUp();
                    }
                } else if ("workItemHandlers".equals(name)) {
                    kSession.getWorkItemHandelerModels().addAll(readObjectList(reader, context, WorkItemHandlerModel.class));
                }
//                else if ("consoleLogger".equals(name)){
//                    kSession.setLogger(readObject(reader, context, ConsoleLogger.class));
//                } else if ("fileLogger".equals(name)){
//                    kSession.setLogger(readObject(reader, context, FileLogger.class));
View Full Code Here


        }

        readNodes(reader, new AbstractXStreamConverter.NodeReader() {
            public void onNode(HierarchicalStreamReader reader, String name, String value) {
                if ("ksession".equals(name)) {
                    KSessionModel kSession = readObject(reader, context, KSessionModel.class);
                    kBase.getKSessions().add(kSession);

                } else if ("includes".equals(name)) {
                    for (String include : readList(reader)) {
                        kBase.addInclude(include);
View Full Code Here

    public KSessionConverter() {
        super(KSessionModel.class);
    }

    public void marshal(Object value, HierarchicalStreamWriter writer, MarshallingContext context) {
        KSessionModel kSession = (KSessionModel) value;
        writer.addAttribute("name", kSession.getName());
        writer.addAttribute("type", kSession.getType());
        writer.addAttribute("default", Boolean.toString(kSession.isDefault()));
        if (kSession.getClockType() != null) {
            writer.addAttribute("clockType", kSession.getClockType().getClockTypeAsString());
        }
        if (kSession.getScope() != null) {
            writer.addAttribute("scope", kSession.getScope().toString());
        }

        writeObjectList(writer, context, "workItemHandlers", "workItemHandler", kSession.getWorkItemHandelerModels());

//        if (kSession.getLogger() instanceof ConsoleLogger) {
//            writeObject(writer, context, "consoleLogger", kSession.getLogger());
//        } else if (kSession.getLogger() instanceof FileLogger) {
//            writeObject(writer, context, "fileLogger", kSession.getLogger());
//        }

        if (!kSession.getListeners().isEmpty()) {
            writer.startNode("listeners");

            for (ListenerModel listener : kSession.getListeners()) {
                writeObject(writer, context, listener.getKind().toString(), listener);

            }
            writer.endNode();
        }
View Full Code Here

TOP

Related Classes of org.guvnor.common.services.project.model.KSessionModel

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.