//# 0 errors, 224 messages
//#
/*
    //#CategoryAdd.java:1:1: class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
 * 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.ui.struts2.editor;

import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.weblogger.WebloggerException;
import org.apache.roller.weblogger.business.WebloggerFactory;
import org.apache.roller.weblogger.business.WeblogManager;
import org.apache.roller.weblogger.pojos.WeblogCategory;
import org.apache.roller.weblogger.pojos.WeblogPermission;
import org.apache.roller.weblogger.ui.struts2.util.UIAction;
import org.apache.roller.weblogger.util.cache.CacheManager;
import org.apache.struts2.interceptor.validation.SkipValidation;


/**
 * Add a new subCategory to an existing Category.
 */
public class CategoryAdd extends UIAction {
    
    private static Log log = LogFactory.getLog(CategoryAdd.class);
    //#CategoryAdd.java:39: method: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init
    //#CategoryAdd.java:39: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd]
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.execute()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.getBean()Lorg/apache/roller/weblogger/ui/struts2/editor/CategoryBean;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.getCategoryId()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.myPrepare()V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.myValidate()V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.requiredWeblogPermissions()S
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.save()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.setBean(Lorg/apache/roller/weblogger/ui/struts2/editor/CategoryBean;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.setCategory(Lorg/apache/roller/weblogger/pojos/WeblogCategory;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.setCategoryId(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): log
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.execute()Ljava/lang/String; == &execute
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.getBean()Lorg/apache/roller/weblogger/ui/struts2/editor/CategoryBean; == &getBean
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory; == &getCategory
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.getCategoryId()Ljava/lang/String; == &getCategoryId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.myPrepare()V == &myPrepare
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.myValidate()V == &myValidate
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.requiredWeblogPermissions()S == &requiredWeblogPermissions
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.save()Ljava/lang/String; == &save
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.setBean(Lorg/apache/roller/weblogger/ui/struts2/editor/CategoryBean;)V == &setBean
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.setCategory(Lorg/apache/roller/weblogger/pojos/WeblogCategory;)V == &setCategory
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): __Dispatch_Table.setCategoryId(Ljava/lang/String;)V == &setCategoryId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init): init'ed(log)
    //#CategoryAdd.java:39: end of method: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd__static_init
    
    // the id of the Category we are adding the new subCategory into
    private String categoryId = null;
    
    // the category we are adding the new subcategory into
    private WeblogCategory category = null;
    
    // bean for managing form data
    private CategoryBean bean = new CategoryBean();
    
    
    public CategoryAdd() {
    //#CategoryAdd.java:51: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()
    //#CategoryAdd.java:51: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.util.UIAction()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.util.UIAction()
    //#input(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): new CategoryBean(CategoryAdd#1) num objects
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.__Tag
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.description
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.id
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.image
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.name
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.actionName
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.category
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.categoryId
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.desiredMenu
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.pageTitle
    //#new obj(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): new CategoryBean(CategoryAdd#1)
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.actionName == &"categoryAdd"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean == &new CategoryBean(CategoryAdd#1)
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.category == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.categoryId == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.description == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.id == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.image == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.name == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.desiredMenu == &"editor"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.pageTitle == &"categoryForm.add.title"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): new CategoryBean(CategoryAdd#1) num objects == 1
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()): this.bean.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryBean
        this.actionName = "categoryAdd";
        this.desiredMenu = "editor";
        this.pageTitle = "categoryForm.add.title";
    }
    //#CategoryAdd.java:55: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd()
    
    
    // author perms required
    public short requiredWeblogPermissions() {
        return WeblogPermission.AUTHOR;
    //#CategoryAdd.java:60: method: short org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.requiredWeblogPermissions()
    //#input(short requiredWeblogPermissions()): org.apache.roller.weblogger.pojos.WeblogPermission.AUTHOR
    //#output(short requiredWeblogPermissions()): return_value
    //#presumption(short requiredWeblogPermissions()): init'ed(org.apache.roller.weblogger.pojos.WeblogPermission.AUTHOR)
    //#post(short requiredWeblogPermissions()): return_value == org.apache.roller.weblogger.pojos.WeblogPermission.AUTHOR
    //#post(short requiredWeblogPermissions()): (soft) init'ed(return_value)
    //#CategoryAdd.java:60: end of method: short org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.requiredWeblogPermissions()
    }
    
    
    public void myPrepare() {
        try {
            WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
    //#CategoryAdd.java:66: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.myPrepare()
    //#CategoryAdd.java:66: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: void myPrepare()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#CategoryAdd.java:66: Warning: method not available
    //#    -- call on WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: void myPrepare()
    //#    unanalyzed callee: WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#input(void myPrepare()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd]
    //#input(void myPrepare()): __Descendant_Table[others]
    //#input(void myPrepare()): __Dispatch_Table.getCategoryId()Ljava/lang/String;
    //#input(void myPrepare()): __Dispatch_Table.setCategory(Lorg/apache/roller/weblogger/pojos/WeblogCategory;)V
    //#input(void myPrepare()): log
    //#input(void myPrepare()): this
    //#input(void myPrepare()): this.__Tag
    //#input(void myPrepare()): this.categoryId
    //#output(void myPrepare()): this.category
    //#pre[1] (void myPrepare()): (soft) log != null
    //#pre[4] (void myPrepare()): (soft) this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd
    //#pre[5] (void myPrepare()): (soft) init'ed(this.categoryId)
    //#presumption(void myPrepare()): org.apache.roller.weblogger.business.Weblogger:getWeblogManager(...)@66 != null
    //#presumption(void myPrepare()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@66 != null
    //#post(void myPrepare()): possibly_updated(this.category)
    //#test_vector(void myPrepare()): org.apache.commons.lang.StringUtils:isEmpty(...)@67: {1}, {0}
            if(!StringUtils.isEmpty(getCategoryId())) {
    //#CategoryAdd.java:67: Warning: method not available
    //#    -- call on bool org.apache.commons.lang.StringUtils:isEmpty(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: void myPrepare()
    //#    unanalyzed callee: bool org.apache.commons.lang.StringUtils:isEmpty(String)
                setCategory(wmgr.getWeblogCategory(getCategoryId()));
    //#CategoryAdd.java:68: Warning: method not available
    //#    -- call on WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: void myPrepare()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(String)
            }
        } catch (WebloggerException ex) {
            log.error("Error looking up category", ex);
    //#CategoryAdd.java:71: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: void myPrepare()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
        }
    }
    //#CategoryAdd.java:73: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.myPrepare()
    
    
    /**
     * Show category form.
     */
    @SkipValidation
    public String execute() {
        
        if(getCategory() == null) {
    //#CategoryAdd.java:82: method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.execute()
    //#input(String execute()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd]
    //#input(String execute()): __Descendant_Table[others]
    //#input(String execute()): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#input(String execute()): this
    //#input(String execute()): this.__Tag
    //#input(String execute()): this.category
    //#output(String execute()): return_value
    //#pre[2] (String execute()): this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd
    //#pre[3] (String execute()): init'ed(this.category)
    //#post(String execute()): return_value in Addr_Set{&"input",&"error"}
    //#test_vector(String execute()): this.category: Inverse{null}, Addr_Set{null}
            // TODO: i18n
            addError("Cannot add category to null parent category");
    //#CategoryAdd.java:84: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError(String)
            return ERROR;
        }
        
        return INPUT;
    //#CategoryAdd.java:88: end of method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.execute()
    }

    
    /**
     * Save new category.
     */
    public String save() {
        
        if(getCategory() == null) {
    //#CategoryAdd.java:97: method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.save()
    //#input(String save()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd]
    //#input(String save()): __Descendant_Table[others]
    //#input(String save()): __Dispatch_Table.getBean()Lorg/apache/roller/weblogger/ui/struts2/editor/CategoryBean;
    //#input(String save()): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#input(String save()): __Dispatch_Table.myValidate()V
    //#input(String save()): log
    //#input(String save()): org/apache/roller/weblogger/ui/struts2/editor/CategoryBean.__Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryBean]
    //#input(String save()): org/apache/roller/weblogger/ui/struts2/editor/CategoryBean.__Descendant_Table[others]
    //#input(String save()): org/apache/roller/weblogger/ui/struts2/editor/CategoryBean.__Dispatch_Table.getDescription()Ljava/lang/String;
    //#input(String save()): org/apache/roller/weblogger/ui/struts2/editor/CategoryBean.__Dispatch_Table.getImage()Ljava/lang/String;
    //#input(String save()): org/apache/roller/weblogger/ui/struts2/editor/CategoryBean.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(String save()): this
    //#input(String save()): this.__Tag
    //#input(String save()): this.bean
    //#input(String save()): this.bean.__Tag
    //#input(String save()): this.bean.description
    //#input(String save()): this.bean.image
    //#input(String save()): this.bean.name
    //#input(String save()): this.category
    //#output(String save()): return_value
    //#pre[3] (String save()): this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd
    //#pre[9] (String save()): init'ed(this.category)
    //#pre[1] (String save()): (soft) log != null
    //#pre[4] (String save()): (soft) this.bean != null
    //#pre[5] (String save()): (soft) this.bean.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryBean
    //#pre[6] (String save()): (soft) init'ed(this.bean.description)
    //#pre[7] (String save()): (soft) init'ed(this.bean.image)
    //#pre[8] (String save()): (soft) init'ed(this.bean.name)
    //#presumption(String save()): org.apache.roller.weblogger.business.Weblogger:getWeblogManager(...)@119 != null
    //#presumption(String save()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@119 != null
    //#presumption(String save()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@121 != null
    //#post(String save()): return_value in Addr_Set{&"success",&"input",&"error"}
    //#unanalyzed(String save()): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogCategory:hasCategory
    //#unanalyzed(String save()): Effects-of-calling:org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError
    //#test_vector(String save()): this.category: Inverse{null}, Addr_Set{null}
    //#test_vector(String save()): org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:hasActionErrors(...)@106: {1}, {0}
            // TODO: i18n
            addError("Cannot add category to null parent category");
    //#CategoryAdd.java:99: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError(String)
            return ERROR;
        }
        
        // validation
        myValidate();
        
        if(!hasActionErrors()) try {
    //#CategoryAdd.java:106: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:hasActionErrors()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:hasActionErrors()
            
            WeblogCategory newCategory = new WeblogCategory(
    //#CategoryAdd.java:108: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:getActionWeblog()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:getActionWeblog()
    //#CategoryAdd.java:108: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.pojos.WeblogCategory(Weblog, WeblogCategory, String, String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.pojos.WeblogCategory(Weblog, WeblogCategory, String, String, String)
                    getActionWeblog(),
                    getCategory(),
                    getBean().getName(),
                    getBean().getDescription(),
                    getBean().getImage());
            
            // add new folder to parent
            getCategory().addCategory(newCategory);
    //#CategoryAdd.java:116: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.pojos.WeblogCategory:addCategory(WeblogCategory)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.pojos.WeblogCategory:addCategory(WeblogCategory)
            
            // save changes
            WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
    //#CategoryAdd.java:119: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#CategoryAdd.java:119: Warning: method not available
    //#    -- call on WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
            wmgr.saveWeblogCategory(newCategory);
    //#CategoryAdd.java:120: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.WeblogManager:saveWeblogCategory(WeblogCategory)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.WeblogManager:saveWeblogCategory(WeblogCategory)
            WebloggerFactory.getWeblogger().flush();
    //#CategoryAdd.java:121: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#CategoryAdd.java:121: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.Weblogger:flush()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.Weblogger:flush()
            
            // notify caches
            CacheManager.invalidate(newCategory);
    //#CategoryAdd.java:124: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.util.cache.CacheManager:invalidate(WeblogCategory)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.util.cache.CacheManager:invalidate(WeblogCategory)
            
            // TODO: i18n
            addMessage("category added");
    //#CategoryAdd.java:127: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addMessage(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addMessage(String)
            
            return SUCCESS;
            
        } catch(Exception ex) {
            log.error("Error saving new category", ex);
    //#CategoryAdd.java:132: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            // TODO: i18n
            addError("Error saving new category");
    //#CategoryAdd.java:134: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError(String)
        }
        
        return INPUT;
    //#CategoryAdd.java:137: end of method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.save()
    }

    
    // TODO: validation
    public void myValidate() {
        
        // name is required, has max length, no html
        
        // make sure new name is not a duplicate of an existing folder
        if(getCategory().hasCategory(getBean().getName())) {
    //#CategoryAdd.java:147: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.myValidate()
    //#CategoryAdd.java:147: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.pojos.WeblogCategory:hasCategory(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: void myValidate()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.pojos.WeblogCategory:hasCategory(String)
    //#input(void myValidate()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd]
    //#input(void myValidate()): __Descendant_Table[others]
    //#input(void myValidate()): __Dispatch_Table.getBean()Lorg/apache/roller/weblogger/ui/struts2/editor/CategoryBean;
    //#input(void myValidate()): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#input(void myValidate()): org/apache/roller/weblogger/ui/struts2/editor/CategoryBean.__Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryBean]
    //#input(void myValidate()): org/apache/roller/weblogger/ui/struts2/editor/CategoryBean.__Descendant_Table[others]
    //#input(void myValidate()): org/apache/roller/weblogger/ui/struts2/editor/CategoryBean.__Dispatch_Table.getName()Ljava/lang/String;
    //#input(void myValidate()): this
    //#input(void myValidate()): this.__Tag
    //#input(void myValidate()): this.bean
    //#input(void myValidate()): this.bean.__Tag
    //#input(void myValidate()): this.bean.name
    //#input(void myValidate()): this.category
    //#pre[2] (void myValidate()): this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryAdd
    //#pre[3] (void myValidate()): this.bean != null
    //#pre[4] (void myValidate()): this.bean.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryBean
    //#pre[5] (void myValidate()): init'ed(this.bean.name)
    //#pre[6] (void myValidate()): this.category != null
    //#test_vector(void myValidate()): org.apache.roller.weblogger.pojos.WeblogCategory:hasCategory(...)@147: {0}, {1}
            addError("categoryForm.error.duplicateName", getBean().getName());
    //#CategoryAdd.java:148: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError(String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
    //#    method: void myValidate()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd:addError(String, String)
        }
    }
    //#CategoryAdd.java:150: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.myValidate()

    
    public String getCategoryId() {
        return categoryId;
    //#CategoryAdd.java:154: method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.getCategoryId()
    //#input(String getCategoryId()): this
    //#input(String getCategoryId()): this.categoryId
    //#output(String getCategoryId()): return_value
    //#pre[2] (String getCategoryId()): init'ed(this.categoryId)
    //#post(String getCategoryId()): return_value == this.categoryId
    //#post(String getCategoryId()): init'ed(return_value)
    //#CategoryAdd.java:154: end of method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.getCategoryId()
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    //#CategoryAdd.java:158: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.setCategoryId(String)
    //#input(void setCategoryId(String)): categoryId
    //#input(void setCategoryId(String)): this
    //#output(void setCategoryId(String)): this.categoryId
    //#post(void setCategoryId(String)): this.categoryId == categoryId
    //#post(void setCategoryId(String)): init'ed(this.categoryId)
    }
    //#CategoryAdd.java:159: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.setCategoryId(String)

    public WeblogCategory getCategory() {
        return category;
    //#CategoryAdd.java:162: method: WeblogCategory org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.getCategory()
    //#input(WeblogCategory getCategory()): this
    //#input(WeblogCategory getCategory()): this.category
    //#output(WeblogCategory getCategory()): return_value
    //#pre[2] (WeblogCategory getCategory()): init'ed(this.category)
    //#post(WeblogCategory getCategory()): return_value == this.category
    //#post(WeblogCategory getCategory()): init'ed(return_value)
    //#CategoryAdd.java:162: end of method: WeblogCategory org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.getCategory()
    }

    public void setCategory(WeblogCategory category) {
        this.category = category;
    //#CategoryAdd.java:166: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.setCategory(WeblogCategory)
    //#input(void setCategory(WeblogCategory)): category
    //#input(void setCategory(WeblogCategory)): this
    //#output(void setCategory(WeblogCategory)): this.category
    //#post(void setCategory(WeblogCategory)): this.category == category
    //#post(void setCategory(WeblogCategory)): init'ed(this.category)
    }
    //#CategoryAdd.java:167: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.setCategory(WeblogCategory)

    public CategoryBean getBean() {
        return bean;
    //#CategoryAdd.java:170: method: CategoryBean org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.getBean()
    //#input(CategoryBean getBean()): this
    //#input(CategoryBean getBean()): this.bean
    //#output(CategoryBean getBean()): return_value
    //#pre[2] (CategoryBean getBean()): init'ed(this.bean)
    //#post(CategoryBean getBean()): return_value == this.bean
    //#post(CategoryBean getBean()): init'ed(return_value)
    //#CategoryAdd.java:170: end of method: CategoryBean org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.getBean()
    }

    public void setBean(CategoryBean bean) {
        this.bean = bean;
    //#CategoryAdd.java:174: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.setBean(CategoryBean)
    //#input(void setBean(CategoryBean)): bean
    //#input(void setBean(CategoryBean)): this
    //#output(void setBean(CategoryBean)): this.bean
    //#post(void setBean(CategoryBean)): this.bean == bean
    //#post(void setBean(CategoryBean)): init'ed(this.bean)
    }
    //#CategoryAdd.java:175: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd.setBean(CategoryBean)
    
}
    //#CategoryAdd.java:: end of class: org.apache.roller.weblogger.ui.struts2.editor.CategoryAdd
