//# 0 errors, 246 messages
//#
/*
    //#CategoryRemove.java:1:1: class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
 * 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 java.util.Collections;
import java.util.List;
import java.util.Set;
import java.util.TreeSet;
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.WeblogPermission;
import org.apache.roller.weblogger.pojos.WeblogCategory;
import org.apache.roller.weblogger.pojos.WeblogCategoryPathComparator;
import org.apache.roller.weblogger.ui.struts2.util.UIAction;
import org.apache.roller.weblogger.util.cache.CacheManager;


/**
 * Remove a category.
 */
public class CategoryRemove extends UIAction {
    
    private static Log log = LogFactory.getLog(CategoryRemove.class);
    //#CategoryRemove.java:43: method: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init
    //#CategoryRemove.java:43: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryRemove]
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.execute()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.getAllCategories()Ljava/util/Set;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.getRemoveId()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.getTargetCategoryId()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.myPrepare()V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.remove()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.requiredWeblogPermissions()S
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.setAllCategories(Ljava/util/Set;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.setCategory(Lorg/apache/roller/weblogger/pojos/WeblogCategory;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.setRemoveId(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.setTargetCategoryId(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): log
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryRemove] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.execute()Ljava/lang/String; == &execute
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.getAllCategories()Ljava/util/Set; == &getAllCategories
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory; == &getCategory
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.getRemoveId()Ljava/lang/String; == &getRemoveId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.getTargetCategoryId()Ljava/lang/String; == &getTargetCategoryId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.myPrepare()V == &myPrepare
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.remove()Ljava/lang/String; == &remove
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.requiredWeblogPermissions()S == &requiredWeblogPermissions
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.setAllCategories(Ljava/util/Set;)V == &setAllCategories
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.setCategory(Lorg/apache/roller/weblogger/pojos/WeblogCategory;)V == &setCategory
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.setRemoveId(Ljava/lang/String;)V == &setRemoveId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): __Dispatch_Table.setTargetCategoryId(Ljava/lang/String;)V == &setTargetCategoryId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init): init'ed(log)
    //#CategoryRemove.java:43: end of method: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove__static_init
    
    // id of category to remove
    private String removeId = null;
    
    // category object that we will remove
    private WeblogCategory category = null;
    
    // category id of the category to move to
    private String targetCategoryId = null;
    
    // all categories from the action weblog
    private Set allCategories = Collections.EMPTY_SET;
    
    
    public CategoryRemove() {
    //#CategoryRemove.java:58: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()
    //#CategoryRemove.java:58: 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.CategoryRemove
    //#    method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.util.UIAction()
    //#input(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): java.util.Collections.EMPTY_SET
    //#input(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.actionName
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.allCategories
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.category
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.desiredMenu
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.pageTitle
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.removeId
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.targetCategoryId
    //#presumption(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): init'ed(java.util.Collections.EMPTY_SET)
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.actionName == &"categoryRemove"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.allCategories == java.util.Collections.EMPTY_SET
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): (soft) init'ed(this.allCategories)
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.category == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.removeId == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.targetCategoryId == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.desiredMenu == &"editor"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()): this.pageTitle == &"categoriesForm.rootTitle"
        this.actionName = "categoryRemove";
        this.desiredMenu = "editor";
        this.pageTitle = "categoriesForm.rootTitle";
    }
    //#CategoryRemove.java:62: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove()
    
    
    public short requiredWeblogPermissions() {
        return WeblogPermission.AUTHOR;
    //#CategoryRemove.java:66: method: short org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.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)
    //#CategoryRemove.java:66: end of method: short org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.requiredWeblogPermissions()
    }
    
    
    public void myPrepare() {
        try {
            WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
    //#CategoryRemove.java:72: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.myPrepare()
    //#CategoryRemove.java:72: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: void myPrepare()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#CategoryRemove.java:72: Warning: method not available
    //#    -- call on WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    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/CategoryRemove]
    //#input(void myPrepare()): __Descendant_Table[others]
    //#input(void myPrepare()): __Dispatch_Table.getRemoveId()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.removeId
    //#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/CategoryRemove
    //#pre[5] (void myPrepare()): (soft) init'ed(this.removeId)
    //#presumption(void myPrepare()): org.apache.roller.weblogger.business.Weblogger:getWeblogManager(...)@72 != null
    //#presumption(void myPrepare()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@72 != null
    //#post(void myPrepare()): possibly_updated(this.category)
    //#test_vector(void myPrepare()): org.apache.commons.lang.StringUtils:isEmpty(...)@73: {1}, {0}
            if(!StringUtils.isEmpty(getRemoveId())) {
    //#CategoryRemove.java:73: Warning: method not available
    //#    -- call on bool org.apache.commons.lang.StringUtils:isEmpty(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: void myPrepare()
    //#    unanalyzed callee: bool org.apache.commons.lang.StringUtils:isEmpty(String)
                setCategory(wmgr.getWeblogCategory(getRemoveId()));
    //#CategoryRemove.java:74: 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.CategoryRemove
    //#    method: void myPrepare()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(String)
            }
        } catch (WebloggerException ex) {
            log.error("Error looking up category", ex);
    //#CategoryRemove.java:77: 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.CategoryRemove
    //#    method: void myPrepare()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
        }
    }
    //#CategoryRemove.java:79: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.myPrepare()
    
    
    /**
     * Display the remove template confirmation.
     */
    public String execute() {
        
        // build list of categories for display
        TreeSet allCategories = new TreeSet(new WeblogCategoryPathComparator());
    //#CategoryRemove.java:88: method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.execute()
    //#CategoryRemove.java:88: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.pojos.WeblogCategoryPathComparator()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.roller.weblogger.pojos.WeblogCategoryPathComparator()
    //#input(String execute()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryRemove]
    //#input(String execute()): __Descendant_Table[others]
    //#input(String execute()): __Dispatch_Table.getRemoveId()Ljava/lang/String;
    //#input(String execute()): __Dispatch_Table.setAllCategories(Ljava/util/Set;)V
    //#input(String execute()): log
    //#input(String execute()): this
    //#input(String execute()): this.__Tag
    //#input(String execute()): this.removeId
    //#output(String execute()): new TreeSet(execute#1) num objects
    //#output(String execute()): return_value
    //#output(String execute()): this.allCategories
    //#new obj(String execute()): new TreeSet(execute#1)
    //#pre[1] (String execute()): (soft) log != null
    //#pre[4] (String execute()): (soft) this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryRemove
    //#pre[5] (String execute()): (soft) init'ed(this.removeId)
    //#presumption(String execute()): java.util.Iterator:next(...)@94 != null
    //#presumption(String execute()): org.apache.roller.weblogger.business.WeblogManager:getWeblogCategories(...)@93 != null
    //#presumption(String execute()): org.apache.roller.weblogger.business.Weblogger:getWeblogManager(...)@92 != null
    //#presumption(String execute()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@92 != null
    //#presumption(String execute()): org.apache.roller.weblogger.pojos.WeblogCategory:getId(...)@95 != null
    //#post(String execute()): return_value == &"input"
    //#post(String execute()): this.allCategories == One-of{old this.allCategories, &new TreeSet(execute#1)}
    //#post(String execute()): new TreeSet(execute#1) num objects == 1
    //#test_vector(String execute()): java.lang.String:equals(...)@95: {1}, {0}
    //#test_vector(String execute()): java.util.TreeSet:size(...)@105: {-2_147_483_648..0}, {1..4_294_967_295}
        
        try {
            // Build list of all categories, except for current one, sorted by path.
            WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
    //#CategoryRemove.java:92: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String execute()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#CategoryRemove.java:92: Warning: method not available
    //#    -- call on WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String execute()
    //#    unanalyzed callee: WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
            List<WeblogCategory> cats = wmgr.getWeblogCategories(getActionWeblog(), true);
    //#CategoryRemove.java:93: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove:getActionWeblog()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String execute()
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove:getActionWeblog()
    //#CategoryRemove.java:93: Warning: method not available
    //#    -- call on List org.apache.roller.weblogger.business.WeblogManager:getWeblogCategories(Weblog, bool)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String execute()
    //#    unanalyzed callee: List org.apache.roller.weblogger.business.WeblogManager:getWeblogCategories(Weblog, bool)
            for(WeblogCategory cat : cats) {
                if (!cat.getId().equals(getRemoveId())) {
    //#CategoryRemove.java:95: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.WeblogCategory:getId()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String execute()
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.WeblogCategory:getId()
                    allCategories.add(cat);
                }
            }
        } catch (WebloggerException ex) {
            log.error("Error building categories list", ex);
    //#CategoryRemove.java:100: 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.CategoryRemove
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            // TODO: i18n
            addError("Error building categories list");
    //#CategoryRemove.java:102: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove:addError(String)
        }
        
        if (allCategories.size() > 0) {
            setAllCategories(allCategories);
        }
        
        return INPUT;
    //#CategoryRemove.java:109: end of method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.execute()
    }
    
    
    /**
     * Remove a new template.
     */
    public String remove() {
        
        if(getCategory() != null) try {
    //#CategoryRemove.java:118: method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.remove()
    //#input(String remove()): "Error removing category - "._tainted
    //#input(String remove()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/CategoryRemove]
    //#input(String remove()): __Descendant_Table[others]
    //#input(String remove()): __Dispatch_Table.execute()Ljava/lang/String;
    //#input(String remove()): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#input(String remove()): __Dispatch_Table.getRemoveId()Ljava/lang/String;
    //#input(String remove()): __Dispatch_Table.getTargetCategoryId()Ljava/lang/String;
    //#input(String remove()): __Dispatch_Table.setAllCategories(Ljava/util/Set;)V
    //#input(String remove()): __Dispatch_Table.setRemoveId(Ljava/lang/String;)V
    //#input(String remove()): log
    //#input(String remove()): this
    //#input(String remove()): this.__Tag
    //#input(String remove()): this.category
    //#input(String remove()): this.removeId
    //#input(String remove()): this.removeId._tainted
    //#input(String remove()): this.targetCategoryId
    //#output(String remove()): new TreeSet(execute#1) num objects
    //#output(String remove()): return_value
    //#output(String remove()): this.allCategories
    //#output(String remove()): this.removeId
    //#new obj(String remove()): new TreeSet(execute#1)
    //#pre[7] (String remove()): this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/CategoryRemove
    //#pre[8] (String remove()): init'ed(this.category)
    //#pre[3] (String remove()): (soft) log != null
    //#pre[5] (String remove()): (soft) init'ed(this.removeId)
    //#pre[10] (String remove()): (soft) init'ed(this.targetCategoryId)
    //#presumption(String remove()): org.apache.roller.weblogger.business.Weblogger:getWeblogManager(...)@119 != null
    //#presumption(String remove()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@119 != null
    //#presumption(String remove()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@124 != null
    //#presumption(String remove()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@132 != null
    //#post(String remove()): return_value in Addr_Set{&"success",&"input"}
    //#post(String remove()): this.allCategories == One-of{old this.allCategories, &new TreeSet(execute#1)}
    //#post(String remove()): init'ed(this.removeId)
    //#post(String remove()): new TreeSet(execute#1) num objects <= 1
    //#unanalyzed(String remove()): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogCategoryPathComparator
    //#unanalyzed(String remove()): Effects-of-calling:java.util.TreeSet
    //#unanalyzed(String remove()): Effects-of-calling:org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger
    //#unanalyzed(String remove()): Effects-of-calling:org.apache.roller.weblogger.business.Weblogger:getWeblogManager
    //#unanalyzed(String remove()): Effects-of-calling:org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove:getActionWeblog
    //#unanalyzed(String remove()): Effects-of-calling:org.apache.roller.weblogger.business.WeblogManager:getWeblogCategories
    //#unanalyzed(String remove()): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(String remove()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(String remove()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(String remove()): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogCategory:getId
    //#unanalyzed(String remove()): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(String remove()): Effects-of-calling:java.util.TreeSet:add
    //#unanalyzed(String remove()): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(String remove()): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(String remove()): Effects-of-calling:org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove:addError
    //#unanalyzed(String remove()): Effects-of-calling:java.util.TreeSet:size
    //#test_vector(String remove()): this.category: Addr_Set{null}, Inverse{null}
    //#test_vector(String remove()): this.targetCategoryId: Addr_Set{null}, Inverse{null}
            WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
    //#CategoryRemove.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.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#CategoryRemove.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.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
            
            if(getTargetCategoryId() != null) {
                WeblogCategory target = wmgr.getWeblogCategory(getTargetCategoryId());
    //#CategoryRemove.java:122: 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.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(String)
                wmgr.moveWeblogCategoryContents(getCategory(), target);
    //#CategoryRemove.java:123: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.WeblogManager:moveWeblogCategoryContents(WeblogCategory, WeblogCategory)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.WeblogManager:moveWeblogCategoryContents(WeblogCategory, WeblogCategory)
                WebloggerFactory.getWeblogger().flush();
    //#CategoryRemove.java:124: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#CategoryRemove.java:124: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.Weblogger:flush()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.Weblogger:flush()
            }
            
            // notify cache
            String id = getCategory().getId();
    //#CategoryRemove.java:128: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.WeblogCategory:getId()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.WeblogCategory:getId()
            CacheManager.invalidate(getCategory());
    //#CategoryRemove.java:129: 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.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: void org.apache.roller.weblogger.util.cache.CacheManager:invalidate(WeblogCategory)
            
            wmgr.removeWeblogCategory(getCategory());
    //#CategoryRemove.java:131: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.WeblogManager:removeWeblogCategory(WeblogCategory)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.WeblogManager:removeWeblogCategory(WeblogCategory)
            WebloggerFactory.getWeblogger().flush();
    //#CategoryRemove.java:132: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#CategoryRemove.java:132: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.Weblogger:flush()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.Weblogger:flush()
            
            // set category id to parent for next page
            setRemoveId(id);
            
            return SUCCESS;
            
        } catch(Exception ex) {
            log.error("Error removing category - "+getRemoveId(), ex);
    //#CategoryRemove.java:140: 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.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            // TODO: i18n
            addError("Error removing category");
    //#CategoryRemove.java:142: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
    //#    method: String remove()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove:addError(String)
        }
        
        return execute();
    //#CategoryRemove.java:145: end of method: String org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.remove()
    }

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

    public void setRemoveId(String categoryId) {
        this.removeId = categoryId;
    //#CategoryRemove.java:154: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.setRemoveId(String)
    //#input(void setRemoveId(String)): categoryId
    //#input(void setRemoveId(String)): this
    //#output(void setRemoveId(String)): this.removeId
    //#post(void setRemoveId(String)): this.removeId == categoryId
    //#post(void setRemoveId(String)): init'ed(this.removeId)
    }
    //#CategoryRemove.java:155: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.setRemoveId(String)

    public WeblogCategory getCategory() {
        return category;
    //#CategoryRemove.java:158: method: WeblogCategory org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.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)
    //#CategoryRemove.java:158: end of method: WeblogCategory org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.getCategory()
    }

    public void setCategory(WeblogCategory category) {
        this.category = category;
    //#CategoryRemove.java:162: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.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)
    }
    //#CategoryRemove.java:163: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.setCategory(WeblogCategory)

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

    public void setTargetCategoryId(String targetCategoryId) {
        this.targetCategoryId = targetCategoryId;
    //#CategoryRemove.java:170: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.setTargetCategoryId(String)
    //#input(void setTargetCategoryId(String)): targetCategoryId
    //#input(void setTargetCategoryId(String)): this
    //#output(void setTargetCategoryId(String)): this.targetCategoryId
    //#post(void setTargetCategoryId(String)): this.targetCategoryId == targetCategoryId
    //#post(void setTargetCategoryId(String)): init'ed(this.targetCategoryId)
    }
    //#CategoryRemove.java:171: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.setTargetCategoryId(String)

    public Set getAllCategories() {
        return allCategories;
    //#CategoryRemove.java:174: method: Set org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.getAllCategories()
    //#input(Set getAllCategories()): this
    //#input(Set getAllCategories()): this.allCategories
    //#output(Set getAllCategories()): return_value
    //#pre[2] (Set getAllCategories()): init'ed(this.allCategories)
    //#post(Set getAllCategories()): return_value == this.allCategories
    //#post(Set getAllCategories()): init'ed(return_value)
    //#CategoryRemove.java:174: end of method: Set org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.getAllCategories()
    }

    public void setAllCategories(Set allCategories) {
        this.allCategories = allCategories;
    //#CategoryRemove.java:178: method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.setAllCategories(Set)
    //#input(void setAllCategories(Set)): allCategories
    //#input(void setAllCategories(Set)): this
    //#output(void setAllCategories(Set)): this.allCategories
    //#post(void setAllCategories(Set)): this.allCategories == allCategories
    //#post(void setAllCategories(Set)): init'ed(this.allCategories)
    }
    //#CategoryRemove.java:179: end of method: void org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove.setAllCategories(Set)
    
}
    //#CategoryRemove.java:: end of class: org.apache.roller.weblogger.ui.struts2.editor.CategoryRemove
