//# 0 errors, 79 messages
//#
/*
    //#AppModuleGenerator.java:1:1: class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
* Licensed to the Apache Software Foundation (ASF) under one or more
*  contributor license agreements.  The ASF licenses this file to You
* under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*     http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.  For additional information regarding
* copyright in this work, please see the NOTICE file in the top level
* directory of this distribution.
*/
package org.apache.roller.weblogger.webservices.atomprotocol;

import java.util.Collections;
import java.util.HashSet;
import java.util.Set;
import org.apache.roller.util.DateUtil;
import org.apache.roller.weblogger.util.Utilities;

import org.jdom.Element;
import org.jdom.Namespace;

import com.sun.syndication.feed.module.Module;
import com.sun.syndication.io.ModuleGenerator;

public class AppModuleGenerator implements ModuleGenerator {
    //#AppModuleGenerator.java:32: method: void org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator()
    //#AppModuleGenerator.java:32: end of method: void org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator()
    private static final Namespace APP_NS  = 
    //#AppModuleGenerator.java:33: method: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init
    //#AppModuleGenerator.java:33: Warning: method not available
    //#    -- call on Namespace org.jdom.Namespace:getNamespace(String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init
    //#    unanalyzed callee: Namespace org.jdom.Namespace:getNamespace(String, String)
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): APP_NS
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): NAMESPACES
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Descendant_Table[org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator]
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Dispatch_Table.generate(Lcom/sun/syndication/feed/module/Module;Lorg/jdom/Element;)V
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Dispatch_Table.generateSimpleElement(Ljava/lang/String;Ljava/lang/String;)Lorg/jdom/Element;
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Dispatch_Table.getNamespaceUri()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Dispatch_Table.getNamespaces()Ljava/util/Set;
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): init'ed(APP_NS)
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): init'ed(NAMESPACES)
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Descendant_Table[org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Dispatch_Table.generate(Lcom/sun/syndication/feed/module/Module;Lorg/jdom/Element;)V == &generate
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Dispatch_Table.generateSimpleElement(Ljava/lang/String;Ljava/lang/String;)Lorg/jdom/Element; == &generateSimpleElement
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Dispatch_Table.getNamespaceUri()Ljava/lang/String; == &getNamespaceUri
    //#post(org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init): __Dispatch_Table.getNamespaces()Ljava/util/Set; == &getNamespaces
        Namespace.getNamespace("app", AppModule.URI);

    public String getNamespaceUri() {
        return AppModule.URI;
    //#AppModuleGenerator.java:37: method: String org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.getNamespaceUri()
    //#output(String getNamespaceUri()): return_value
    //#post(String getNamespaceUri()): return_value == &"http:..www.w3.org.2007.app"
    //#AppModuleGenerator.java:37: end of method: String org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.getNamespaceUri()
    }

    private static final Set NAMESPACES;

    static {
        Set nss = new HashSet();
        nss.add(APP_NS);
        NAMESPACES = Collections.unmodifiableSet(nss);
    }
    //#AppModuleGenerator.java:46: end of method: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator__static_init

    public Set getNamespaces() {
        return NAMESPACES;
    //#AppModuleGenerator.java:49: method: Set org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.getNamespaces()
    //#input(Set getNamespaces()): NAMESPACES
    //#output(Set getNamespaces()): return_value
    //#post(Set getNamespaces()): init'ed(return_value)
    //#AppModuleGenerator.java:49: end of method: Set org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.getNamespaces()
    }

    public void generate(Module module, Element element) {
        AppModule m = (AppModule)module;
    //#AppModuleGenerator.java:53: method: void org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.generate(Module, Element)
    //#AppModuleGenerator.java:53: Warning: suspicious precondition
    //#    the precondition for module.__Tag is not a contiguous range of values
    //#    severity: SUPPRESSED
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: void generate(Module, Element)
    //#    suspicious precondition index: [3]
    //#input(void generate(Module, Element)): APP_NS
    //#input(void generate(Module, Element)): __Descendant_Table[org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator]
    //#input(void generate(Module, Element)): __Descendant_Table[others]
    //#input(void generate(Module, Element)): __Dispatch_Table.generateSimpleElement(Ljava/lang/String;Ljava/lang/String;)Lorg/jdom/Element;
    //#input(void generate(Module, Element)): element
    //#input(void generate(Module, Element)): module
    //#input(void generate(Module, Element)): module.__Tag
    //#input(void generate(Module, Element)): module.draft
    //#input(void generate(Module, Element)): module.edited
    //#input(void generate(Module, Element)): org/apache/roller/weblogger/webservices/atomprotocol/AppModule.__Descendant_Table[org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl]
    //#input(void generate(Module, Element)): org/apache/roller/weblogger/webservices/atomprotocol/AppModule.__Descendant_Table[org/apache/roller/weblogger/webservices/atomprotocol/AppModule]
    //#input(void generate(Module, Element)): org/apache/roller/weblogger/webservices/atomprotocol/AppModule.__Descendant_Table[others]
    //#input(void generate(Module, Element)): org/apache/roller/weblogger/webservices/atomprotocol/AppModule.__Dispatch_Table.getDraft()Z
    //#input(void generate(Module, Element)): org/apache/roller/weblogger/webservices/atomprotocol/AppModule.__Dispatch_Table.getEdited()Ljava/util/Date;
    //#input(void generate(Module, Element)): org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl.__Dispatch_Table.getDraft()Z
    //#input(void generate(Module, Element)): org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl.__Dispatch_Table.getEdited()Ljava/util/Date;
    //#input(void generate(Module, Element)): this
    //#input(void generate(Module, Element)): this.__Tag
    //#pre[1] (void generate(Module, Element)): element != null
    //#pre[2] (void generate(Module, Element)): module != null
    //#pre[3] (void generate(Module, Element)): module.__Tag in {org/apache/roller/weblogger/webservices/atomprotocol/AppModule, org/apache/roller/weblogger/webservices/atomprotocol/AppModuleImpl}
    //#pre[4] (void generate(Module, Element)): init'ed(module.draft)
    //#pre[5] (void generate(Module, Element)): init'ed(module.edited)
    //#pre[7] (void generate(Module, Element)): this.__Tag == org/apache/roller/weblogger/webservices/atomprotocol/AppModuleGenerator
    //#unanalyzed(void generate(Module, Element)): Effects-of-calling:org.jdom.Element
    //#unanalyzed(void generate(Module, Element)): Effects-of-calling:org.jdom.Element:addContent
    //#test_vector(void generate(Module, Element)): module.edited: Addr_Set{null}, Inverse{null}
        
        String draft = m.getDraft() ? "yes" : "no";
        Element control = new Element("control", APP_NS);
    //#AppModuleGenerator.java:56: Warning: method not available
    //#    -- call on void org.jdom.Element(String, Namespace)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: void generate(Module, Element)
    //#    unanalyzed callee: void org.jdom.Element(String, Namespace)
        control.addContent(generateSimpleElement("draft", draft));
    //#AppModuleGenerator.java:57: Warning: method not available
    //#    -- call on Element org.jdom.Element:addContent(Content)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: void generate(Module, Element)
    //#    unanalyzed callee: Element org.jdom.Element:addContent(Content)
        element.addContent(control);
    //#AppModuleGenerator.java:58: Warning: method not available
    //#    -- call on Element org.jdom.Element:addContent(Content)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: void generate(Module, Element)
    //#    unanalyzed callee: Element org.jdom.Element:addContent(Content)
        
        if (m.getEdited() != null) {
            Element edited = new Element("edited", APP_NS);
    //#AppModuleGenerator.java:61: Warning: method not available
    //#    -- call on void org.jdom.Element(String, Namespace)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: void generate(Module, Element)
    //#    unanalyzed callee: void org.jdom.Element(String, Namespace)
            edited.addContent(DateUtil.formatIso8601(m.getEdited()));
    //#AppModuleGenerator.java:62: Warning: method not available
    //#    -- call on String org.apache.roller.util.DateUtil:formatIso8601(Date)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: void generate(Module, Element)
    //#    unanalyzed callee: String org.apache.roller.util.DateUtil:formatIso8601(Date)
    //#AppModuleGenerator.java:62: Warning: method not available
    //#    -- call on Element org.jdom.Element:addContent(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: void generate(Module, Element)
    //#    unanalyzed callee: Element org.jdom.Element:addContent(String)
            element.addContent(edited);
    //#AppModuleGenerator.java:63: Warning: method not available
    //#    -- call on Element org.jdom.Element:addContent(Content)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: void generate(Module, Element)
    //#    unanalyzed callee: Element org.jdom.Element:addContent(Content)
        }
    }
    //#AppModuleGenerator.java:65: end of method: void org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.generate(Module, Element)

    protected Element generateSimpleElement(String name, String value)  {
        Element element = new Element(name, APP_NS);
    //#AppModuleGenerator.java:68: method: Element org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.generateSimpleElement(String, String)
    //#AppModuleGenerator.java:68: Warning: method not available
    //#    -- call on void org.jdom.Element(String, Namespace)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: Element generateSimpleElement(String, String)
    //#    unanalyzed callee: void org.jdom.Element(String, Namespace)
    //#input(Element generateSimpleElement(String, String)): APP_NS
    //#input(Element generateSimpleElement(String, String)): name
    //#input(Element generateSimpleElement(String, String)): value
    //#output(Element generateSimpleElement(String, String)): new Element(generateSimpleElement#1) num objects
    //#output(Element generateSimpleElement(String, String)): return_value
    //#new obj(Element generateSimpleElement(String, String)): new Element(generateSimpleElement#1)
    //#post(Element generateSimpleElement(String, String)): return_value == &new Element(generateSimpleElement#1)
    //#post(Element generateSimpleElement(String, String)): new Element(generateSimpleElement#1) num objects == 1
        element.addContent(value);
    //#AppModuleGenerator.java:69: Warning: method not available
    //#    -- call on Element org.jdom.Element:addContent(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
    //#    method: Element generateSimpleElement(String, String)
    //#    unanalyzed callee: Element org.jdom.Element:addContent(String)
        return element;
    //#AppModuleGenerator.java:70: end of method: Element org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator.generateSimpleElement(String, String)
    }
}
    //#AppModuleGenerator.java:: end of class: org.apache.roller.weblogger.webservices.atomprotocol.AppModuleGenerator
