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


/**
 * Manage weblog categories.
 */
public class Categories extends UIAction {
    
    private static Log log = LogFactory.getLog(Categories.class);
    //#Categories.java:43: method: org.apache.roller.weblogger.ui.struts2.editor.Categories.org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init
    //#Categories.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.Categories
    //#    method: org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/Categories]
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.execute()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getAllCategories()Ljava/util/Set;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getCategoryId()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getCategoryPath()Ljava/util/List;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getSelectedCategories()[Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getTargetCategoryId()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.move()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.myPrepare()V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.requiredWeblogPermissions()S
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setAllCategories(Ljava/util/Set;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setCategory(Lorg/apache/roller/weblogger/pojos/WeblogCategory;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setCategoryId(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setCategoryPath(Ljava/util/List;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setSelectedCategories([Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setTargetCategoryId(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): log
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/Categories] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.execute()Ljava/lang/String; == &execute
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getAllCategories()Ljava/util/Set; == &getAllCategories
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory; == &getCategory
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getCategoryId()Ljava/lang/String; == &getCategoryId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getCategoryPath()Ljava/util/List; == &getCategoryPath
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getSelectedCategories()[Ljava/lang/String; == &getSelectedCategories
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.getTargetCategoryId()Ljava/lang/String; == &getTargetCategoryId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.move()Ljava/lang/String; == &move
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.myPrepare()V == &myPrepare
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.requiredWeblogPermissions()S == &requiredWeblogPermissions
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setAllCategories(Ljava/util/Set;)V == &setAllCategories
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setCategory(Lorg/apache/roller/weblogger/pojos/WeblogCategory;)V == &setCategory
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setCategoryId(Ljava/lang/String;)V == &setCategoryId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setCategoryPath(Ljava/util/List;)V == &setCategoryPath
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setSelectedCategories([Ljava/lang/String;)V == &setSelectedCategories
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): __Dispatch_Table.setTargetCategoryId(Ljava/lang/String;)V == &setTargetCategoryId
    //#post(org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init): init'ed(log)
    //#Categories.java:43: end of method: org.apache.roller.weblogger.ui.struts2.editor.Categories.org.apache.roller.weblogger.ui.struts2.editor.Categories__static_init
    
    // the id of the category we are viewing
    private String categoryId = null;
    
    // the category we are viewing
    private WeblogCategory category = null;
    
    // list of category ids to move
    private String[] selectedCategories = 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;
    
    // path of categories representing selected categories hierarchy
    private List categoryPath = Collections.EMPTY_LIST;
    
    
    public Categories() {
    //#Categories.java:64: method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.org.apache.roller.weblogger.ui.struts2.editor.Categories()
    //#Categories.java:64: 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.Categories
    //#    method: void org.apache.roller.weblogger.ui.struts2.editor.Categories()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.util.UIAction()
    //#input(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): java.util.Collections.EMPTY_LIST
    //#input(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): java.util.Collections.EMPTY_SET
    //#input(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.actionName
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.allCategories
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.category
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.categoryId
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.categoryPath
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.desiredMenu
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.pageTitle
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.selectedCategories
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.targetCategoryId
    //#presumption(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): init'ed(java.util.Collections.EMPTY_LIST)
    //#presumption(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): init'ed(java.util.Collections.EMPTY_SET)
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.actionName == &"categories"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.allCategories == java.util.Collections.EMPTY_SET
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): (soft) init'ed(this.allCategories)
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.category == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.categoryId == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.selectedCategories == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.targetCategoryId == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.categoryPath == java.util.Collections.EMPTY_LIST
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): (soft) init'ed(this.categoryPath)
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.desiredMenu == &"editor"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.Categories()): this.pageTitle == &"categoriesForm.rootTitle"
        this.actionName = "categories";
        this.desiredMenu = "editor";
        this.pageTitle = "categoriesForm.rootTitle";
    }
    //#Categories.java:68: end of method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.org.apache.roller.weblogger.ui.struts2.editor.Categories()
    
    
    // author perms required
    public short requiredWeblogPermissions() {
        return WeblogPermission.AUTHOR;
    //#Categories.java:73: method: short org.apache.roller.weblogger.ui.struts2.editor.Categories.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)
    //#Categories.java:73: end of method: short org.apache.roller.weblogger.ui.struts2.editor.Categories.requiredWeblogPermissions()
    }
    
    
    public void myPrepare() {
        try {
            WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
    //#Categories.java:79: method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.myPrepare()
    //#Categories.java:79: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: void myPrepare()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#Categories.java:79: Warning: method not available
    //#    -- call on WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    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/Categories]
    //#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/Categories
    //#pre[5] (void myPrepare()): (soft) init'ed(this.categoryId)
    //#presumption(void myPrepare()): org.apache.roller.weblogger.business.Weblogger:getWeblogManager(...)@79 != null
    //#presumption(void myPrepare()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@79 != null
    //#post(void myPrepare()): possibly_updated(this.category)
    //#test_vector(void myPrepare()): java.lang.String:equals(...)@80: {1}, {0}
    //#test_vector(void myPrepare()): org.apache.commons.lang.StringUtils:isEmpty(...)@80: {1}, {0}
            if(!StringUtils.isEmpty(getCategoryId()) && 
    //#Categories.java:80: Warning: method not available
    //#    -- call on bool org.apache.commons.lang.StringUtils:isEmpty(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: void myPrepare()
    //#    unanalyzed callee: bool org.apache.commons.lang.StringUtils:isEmpty(String)
                    !"/".equals(getCategoryId())) {
                setCategory(wmgr.getWeblogCategory(getCategoryId()));
    //#Categories.java:82: 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.Categories
    //#    method: void myPrepare()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(String)
            } else {
                setCategory(wmgr.getRootWeblogCategory(getActionWeblog()));
    //#Categories.java:84: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.ui.struts2.editor.Categories:getActionWeblog()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: void myPrepare()
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.ui.struts2.editor.Categories:getActionWeblog()
    //#Categories.java:84: Warning: method not available
    //#    -- call on WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getRootWeblogCategory(Weblog)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: void myPrepare()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getRootWeblogCategory(Weblog)
            }
        } catch (WebloggerException ex) {
            log.error("Error looking up category", ex);
    //#Categories.java:87: 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.Categories
    //#    method: void myPrepare()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
        }
    }
    //#Categories.java:89: end of method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.myPrepare()
    
    
    public String execute() {
        
        // build list of categories for display
        TreeSet allCategories = new TreeSet(new WeblogCategoryPathComparator());
    //#Categories.java:95: method: String org.apache.roller.weblogger.ui.struts2.editor.Categories.execute()
    //#Categories.java:95: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.pojos.WeblogCategoryPathComparator()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.roller.weblogger.pojos.WeblogCategoryPathComparator()
    //#input(String execute()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/Categories]
    //#input(String execute()): __Descendant_Table[others]
    //#input(String execute()): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#input(String execute()): __Dispatch_Table.getCategoryId()Ljava/lang/String;
    //#input(String execute()): __Dispatch_Table.setAllCategories(Ljava/util/Set;)V
    //#input(String execute()): __Dispatch_Table.setCategoryPath(Ljava/util/List;)V
    //#input(String execute()): log
    //#input(String execute()): this
    //#input(String execute()): this.__Tag
    //#input(String execute()): this.category
    //#input(String execute()): this.categoryId
    //#output(String execute()): new LinkedList(execute#3) num objects
    //#output(String execute()): new TreeSet(execute#1) num objects
    //#output(String execute()): return_value
    //#output(String execute()): this.allCategories
    //#output(String execute()): this.categoryPath
    //#new obj(String execute()): new LinkedList(execute#3)
    //#new obj(String execute()): new TreeSet(execute#1)
    //#pre[1] (String execute()): (soft) log != null
    //#pre[5] (String execute()): (soft) this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/Categories
    //#pre[6] (String execute()): (soft) this.category != null
    //#pre[7] (String execute()): (soft) init'ed(this.categoryId)
    //#presumption(String execute()): java.util.Iterator:next(...)@101 != null
    //#presumption(String execute()): org.apache.roller.weblogger.business.WeblogManager:getWeblogCategories(...)@100 != null
    //#presumption(String execute()): org.apache.roller.weblogger.business.Weblogger:getWeblogManager(...)@99 != null
    //#presumption(String execute()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@99 != null
    //#presumption(String execute()): org.apache.roller.weblogger.pojos.WeblogCategory:getId(...)@102 != null
    //#post(String execute()): return_value == &"list"
    //#post(String execute()): this.allCategories == One-of{old this.allCategories, &new TreeSet(execute#1)}
    //#post(String execute()): this.categoryPath == One-of{old this.categoryPath, &new LinkedList(execute#3)}
    //#post(String execute()): new LinkedList(execute#3) num objects <= 1
    //#post(String execute()): new TreeSet(execute#1) num objects == 1
    //#test_vector(String execute()): java.lang.String:equals(...)@102: {1}, {0}
    //#test_vector(String execute()): java.util.Iterator:hasNext(...)@101: {0}, {1}
    //#test_vector(String execute()): java.util.TreeSet:size(...)@124: {-2_147_483_648..0}, {1..4_294_967_295}
    //#test_vector(String execute()): org.apache.roller.weblogger.pojos.WeblogCategory:getParent(...)@108: Addr_Set{null}, Inverse{null}
        
        try {
            // Build list of all categories, except for current one, sorted by path.
            WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
    //#Categories.java:99: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String execute()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#Categories.java:99: Warning: method not available
    //#    -- call on WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String execute()
    //#    unanalyzed callee: WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
            List<WeblogCategory> cats = wmgr.getWeblogCategories(getActionWeblog(), true);
    //#Categories.java:100: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.ui.struts2.editor.Categories:getActionWeblog()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String execute()
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.ui.struts2.editor.Categories:getActionWeblog()
    //#Categories.java:100: 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.Categories
    //#    method: String execute()
    //#    unanalyzed callee: List org.apache.roller.weblogger.business.WeblogManager:getWeblogCategories(Weblog, bool)
            for(WeblogCategory cat : cats) {
                if (!cat.getId().equals(getCategoryId())) {
    //#Categories.java:102: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.WeblogCategory:getId()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String execute()
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.WeblogCategory:getId()
                    allCategories.add(cat);
                }
            }
            
            // build category path
            WeblogCategory parent = getCategory().getParent();
    //#Categories.java:108: Warning: method not available
    //#    -- call on WeblogCategory org.apache.roller.weblogger.pojos.WeblogCategory:getParent()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String execute()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.pojos.WeblogCategory:getParent()
            if(parent != null) {
                List categoryPath = new LinkedList();
                categoryPath.add(0, getCategory());
                while (parent != null) {
                    categoryPath.add(0, parent);
                    parent = parent.getParent();
    //#Categories.java:114: Warning: method not available
    //#    -- call on WeblogCategory org.apache.roller.weblogger.pojos.WeblogCategory:getParent()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String execute()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.pojos.WeblogCategory:getParent()
                }
                setCategoryPath(categoryPath);
            }
        } catch (WebloggerException ex) {
            log.error("Error building categories list", ex);
    //#Categories.java:119: 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.Categories
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            // TODO: i18n
            addError("Error building categories list");
    //#Categories.java:121: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.Categories:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.Categories:addError(String)
        }
        
        if (allCategories.size() > 0) {
            setAllCategories(allCategories);
        }
        
        return LIST;
    //#Categories.java:128: end of method: String org.apache.roller.weblogger.ui.struts2.editor.Categories.execute()
    }
    
    
    public String move() {
        
        try {
            WeblogManager wmgr = WebloggerFactory.getWeblogger().getWeblogManager();
    //#Categories.java:135: method: String org.apache.roller.weblogger.ui.struts2.editor.Categories.move()
    //#Categories.java:135: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#Categories.java:135: Warning: method not available
    //#    -- call on WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: WeblogManager org.apache.roller.weblogger.business.Weblogger:getWeblogManager()
    //#input(String move()): "Moving categories to category - "._tainted
    //#input(String move()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/Categories]
    //#input(String move()): __Descendant_Table[others]
    //#input(String move()): __Dispatch_Table.execute()Ljava/lang/String;
    //#input(String move()): __Dispatch_Table.getCategory()Lorg/apache/roller/weblogger/pojos/WeblogCategory;
    //#input(String move()): __Dispatch_Table.getCategoryId()Ljava/lang/String;
    //#input(String move()): __Dispatch_Table.getSelectedCategories()[Ljava/lang/String;
    //#input(String move()): __Dispatch_Table.getTargetCategoryId()Ljava/lang/String;
    //#input(String move()): __Dispatch_Table.setAllCategories(Ljava/util/Set;)V
    //#input(String move()): __Dispatch_Table.setCategoryPath(Ljava/util/List;)V
    //#input(String move()): log
    //#input(String move()): this
    //#input(String move()): this.__Tag
    //#input(String move()): this.category
    //#input(String move()): this.categoryId
    //#input(String move()): this.selectedCategories
    //#input(String move()): this.selectedCategories.length
    //#input(String move()): this.selectedCategories[0..4_294_967_295]
    //#input(String move()): this.targetCategoryId
    //#input(String move()): this.targetCategoryId._tainted
    //#output(String move()): new LinkedList(execute#3) num objects
    //#output(String move()): new TreeSet(execute#1) num objects
    //#output(String move()): return_value
    //#output(String move()): this.allCategories
    //#output(String move()): this.categoryPath
    //#new obj(String move()): new LinkedList(execute#3)
    //#new obj(String move()): new TreeSet(execute#1)
    //#pre[1] (String move()): log != null
    //#pre[5] (String move()): (soft) this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/Categories
    //#pre[6] (String move()): (soft) this.category != null
    //#pre[7] (String move()): (soft) init'ed(this.categoryId)
    //#pre[8] (String move()): (soft) init'ed(this.selectedCategories)
    //#pre[9] (String move()): (soft) this.selectedCategories.length <= 4_294_967_295
    //#pre[10] (String move()): (soft) init'ed(this.selectedCategories[0..4_294_967_295])
    //#pre[11] (String move()): (soft) init'ed(this.targetCategoryId)
    //#presumption(String move()): org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(...)@141 != null
    //#presumption(String move()): org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(...)@144 != null
    //#presumption(String move()): org.apache.roller.weblogger.business.Weblogger:getWeblogManager(...)@135 != null
    //#presumption(String move()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@135 != null
    //#presumption(String move()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@157 != null
    //#presumption(String move()): org.apache.roller.weblogger.pojos.WeblogCategory:getId(...)@148 != null
    //#post(String move()): return_value == &"list"
    //#post(String move()): this.allCategories == One-of{old this.allCategories, &new TreeSet(execute#1)}
    //#post(String move()): this.categoryPath == One-of{old this.categoryPath, &new LinkedList(execute#3)}
    //#post(String move()): new LinkedList(execute#3) num objects <= 1
    //#post(String move()): new TreeSet(execute#1) num objects == 1
    //#unanalyzed(String move()): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogCategoryPathComparator
    //#unanalyzed(String move()): Effects-of-calling:java.util.TreeSet
    //#unanalyzed(String move()): Effects-of-calling:org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger
    //#unanalyzed(String move()): Effects-of-calling:org.apache.roller.weblogger.business.Weblogger:getWeblogManager
    //#unanalyzed(String move()): Effects-of-calling:org.apache.roller.weblogger.ui.struts2.editor.Categories:getActionWeblog
    //#unanalyzed(String move()): Effects-of-calling:org.apache.roller.weblogger.business.WeblogManager:getWeblogCategories
    //#unanalyzed(String move()): Effects-of-calling:java.util.List:iterator
    //#unanalyzed(String move()): Effects-of-calling:java.util.Iterator:hasNext
    //#unanalyzed(String move()): Effects-of-calling:java.util.Iterator:next
    //#unanalyzed(String move()): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogCategory:getId
    //#unanalyzed(String move()): Effects-of-calling:java.lang.String:equals
    //#unanalyzed(String move()): Effects-of-calling:java.util.TreeSet:add
    //#unanalyzed(String move()): Effects-of-calling:org.apache.roller.weblogger.pojos.WeblogCategory:getParent
    //#unanalyzed(String move()): Effects-of-calling:java.util.LinkedList
    //#unanalyzed(String move()): Effects-of-calling:java.util.List:add
    //#unanalyzed(String move()): Effects-of-calling:java.lang.Throwable:__curr_excep_obj
    //#unanalyzed(String move()): Effects-of-calling:org.apache.commons.logging.Log:error
    //#unanalyzed(String move()): Effects-of-calling:org.apache.roller.weblogger.ui.struts2.editor.Categories:addError
    //#unanalyzed(String move()): Effects-of-calling:java.util.TreeSet:size
    //#test_vector(String move()): this.selectedCategories: Addr_Set{null}, Inverse{null}
    //#test_vector(String move()): java.lang.String:equals(...)@148: {1}, {0}
    //#test_vector(String move()): org.apache.roller.weblogger.pojos.WeblogCategory:descendentOf(...)@148: {1}, {0}
            
            log.debug("Moving categories to category - "+getTargetCategoryId());
    //#Categories.java:137: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            
            // Move subCategories to new category.
            String[] cats = getSelectedCategories();
            WeblogCategory parent = wmgr.getWeblogCategory(getTargetCategoryId());
    //#Categories.java:141: 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.Categories
    //#    method: String move()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(String)
            if(cats != null) {
                for (int i = 0; i < cats.length; i++) {
                    WeblogCategory cd =
    //#Categories.java:144: 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.Categories
    //#    method: String move()
    //#    unanalyzed callee: WeblogCategory org.apache.roller.weblogger.business.WeblogManager:getWeblogCategory(String)
                            wmgr.getWeblogCategory(cats[i]);
                    
                    // Don't move category into itself.
                    if (!cd.getId().equals(parent.getId()) && 
    //#Categories.java:148: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.WeblogCategory:getId()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.WeblogCategory:getId()
    //#Categories.java:148: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.pojos.WeblogCategory:descendentOf(WeblogCategory)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.pojos.WeblogCategory:descendentOf(WeblogCategory)
                            !parent.descendentOf(cd)) {
                        wmgr.moveWeblogCategory(cd, parent);
    //#Categories.java:150: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.WeblogManager:moveWeblogCategory(WeblogCategory, WeblogCategory)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.WeblogManager:moveWeblogCategory(WeblogCategory, WeblogCategory)
                    } else {
                        addMessage("categoriesForm.warn.notMoving", cd.getName());
    //#Categories.java:152: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.WeblogCategory:getName()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.WeblogCategory:getName()
    //#Categories.java:152: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.Categories:addMessage(String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.Categories:addMessage(String, String)
                    }
                }
                
                // flush changes
                WebloggerFactory.getWeblogger().flush();
    //#Categories.java:157: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#Categories.java:157: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.Weblogger:flush()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.Weblogger:flush()
            }
            
        } catch (WebloggerException ex) {
            log.error("Error moving categories", ex);
    //#Categories.java:161: 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.Categories
    //#    method: String move()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            addError("categoriesForm.error.move");
    //#Categories.java:162: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.Categories:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.Categories
    //#    method: String move()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.Categories:addError(String)
        }
        
        return execute();
    //#Categories.java:165: end of method: String org.apache.roller.weblogger.ui.struts2.editor.Categories.move()
    }
    

    public String getCategoryId() {
        return categoryId;
    //#Categories.java:170: method: String org.apache.roller.weblogger.ui.struts2.editor.Categories.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)
    //#Categories.java:170: end of method: String org.apache.roller.weblogger.ui.struts2.editor.Categories.getCategoryId()
    }

    public void setCategoryId(String categoryId) {
        this.categoryId = categoryId;
    //#Categories.java:174: method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.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)
    }
    //#Categories.java:175: end of method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.setCategoryId(String)

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

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

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

    public void setSelectedCategories(String[] selectedCategories) {
        this.selectedCategories = selectedCategories;
    //#Categories.java:190: method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.setSelectedCategories(String[])
    //#input(void setSelectedCategories(String[])): selectedCategories
    //#input(void setSelectedCategories(String[])): this
    //#output(void setSelectedCategories(String[])): this.selectedCategories
    //#post(void setSelectedCategories(String[])): this.selectedCategories == selectedCategories
    //#post(void setSelectedCategories(String[])): init'ed(this.selectedCategories)
    }
    //#Categories.java:191: end of method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.setSelectedCategories(String[])

    public String getTargetCategoryId() {
        return targetCategoryId;
    //#Categories.java:194: method: String org.apache.roller.weblogger.ui.struts2.editor.Categories.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)
    //#Categories.java:194: end of method: String org.apache.roller.weblogger.ui.struts2.editor.Categories.getTargetCategoryId()
    }

    public void setTargetCategoryId(String targetCategoryId) {
        this.targetCategoryId = targetCategoryId;
    //#Categories.java:198: method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.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)
    }
    //#Categories.java:199: end of method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.setTargetCategoryId(String)

    public Set getAllCategories() {
        return allCategories;
    //#Categories.java:202: method: Set org.apache.roller.weblogger.ui.struts2.editor.Categories.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)
    //#Categories.java:202: end of method: Set org.apache.roller.weblogger.ui.struts2.editor.Categories.getAllCategories()
    }

    public void setAllCategories(Set allCategories) {
        this.allCategories = allCategories;
    //#Categories.java:206: method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.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)
    }
    //#Categories.java:207: end of method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.setAllCategories(Set)

    public List getCategoryPath() {
        return categoryPath;
    //#Categories.java:210: method: List org.apache.roller.weblogger.ui.struts2.editor.Categories.getCategoryPath()
    //#input(List getCategoryPath()): this
    //#input(List getCategoryPath()): this.categoryPath
    //#output(List getCategoryPath()): return_value
    //#pre[2] (List getCategoryPath()): init'ed(this.categoryPath)
    //#post(List getCategoryPath()): return_value == this.categoryPath
    //#post(List getCategoryPath()): init'ed(return_value)
    //#Categories.java:210: end of method: List org.apache.roller.weblogger.ui.struts2.editor.Categories.getCategoryPath()
    }

    public void setCategoryPath(List categoryPath) {
        this.categoryPath = categoryPath;
    //#Categories.java:214: method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.setCategoryPath(List)
    //#input(void setCategoryPath(List)): categoryPath
    //#input(void setCategoryPath(List)): this
    //#output(void setCategoryPath(List)): this.categoryPath
    //#post(void setCategoryPath(List)): this.categoryPath == categoryPath
    //#post(void setCategoryPath(List)): init'ed(this.categoryPath)
    }
    //#Categories.java:215: end of method: void org.apache.roller.weblogger.ui.struts2.editor.Categories.setCategoryPath(List)
    
}
    //#Categories.java:: end of class: org.apache.roller.weblogger.ui.struts2.editor.Categories
