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

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.UserManager;
import org.apache.roller.weblogger.ui.struts2.util.UIAction;


/**
 * Page used to display Roller isntall instructions.
 */
public class Setup extends UIAction {
    
    private static final Log log = LogFactory.getLog(Setup.class);
    //#Setup.java:34: method: org.apache.roller.weblogger.ui.struts2.core.Setup.org.apache.roller.weblogger.ui.struts2.core.Setup__static_init
    //#Setup.java:34: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.core.Setup
    //#    method: org.apache.roller.weblogger.ui.struts2.core.Setup__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/core/Setup]
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.execute()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.getBlogCount()J
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.getUserCount()J
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.isUserRequired()Z
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.isWeblogRequired()Z
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.setBlogCount(J)V
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.setUserCount(J)V
    //#output(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): log
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/core/Setup] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.execute()Ljava/lang/String; == &execute
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.getBlogCount()J == &getBlogCount
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.getUserCount()J == &getUserCount
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.isUserRequired()Z == &isUserRequired
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.isWeblogRequired()Z == &isWeblogRequired
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.setBlogCount(J)V == &setBlogCount
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): __Dispatch_Table.setUserCount(J)V == &setUserCount
    //#post(org.apache.roller.weblogger.ui.struts2.core.Setup__static_init): init'ed(log)
    //#Setup.java:34: end of method: org.apache.roller.weblogger.ui.struts2.core.Setup.org.apache.roller.weblogger.ui.struts2.core.Setup__static_init
    
    private long userCount = 0;
    private long blogCount = 0;
    
    
    public Setup() {
    //#Setup.java:40: method: void org.apache.roller.weblogger.ui.struts2.core.Setup.org.apache.roller.weblogger.ui.struts2.core.Setup()
    //#Setup.java:40: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.util.UIAction()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.core.Setup
    //#    method: void org.apache.roller.weblogger.ui.struts2.core.Setup()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.util.UIAction()
    //#input(void org.apache.roller.weblogger.ui.struts2.core.Setup()): this
    //#output(void org.apache.roller.weblogger.ui.struts2.core.Setup()): this.blogCount
    //#output(void org.apache.roller.weblogger.ui.struts2.core.Setup()): this.pageTitle
    //#output(void org.apache.roller.weblogger.ui.struts2.core.Setup()): this.userCount
    //#post(void org.apache.roller.weblogger.ui.struts2.core.Setup()): this.blogCount == 0
    //#post(void org.apache.roller.weblogger.ui.struts2.core.Setup()): this.userCount == 0
    //#post(void org.apache.roller.weblogger.ui.struts2.core.Setup()): this.pageTitle == &"index.heading"
        // TODO: i18n
        this.pageTitle = "index.heading";
    }
    //#Setup.java:43: end of method: void org.apache.roller.weblogger.ui.struts2.core.Setup.org.apache.roller.weblogger.ui.struts2.core.Setup()
    
    
    @Override
    public boolean isUserRequired() {
        return false;
    //#Setup.java:48: method: bool org.apache.roller.weblogger.ui.struts2.core.Setup.isUserRequired()
    //#output(bool isUserRequired()): return_value
    //#post(bool isUserRequired()): return_value == 0
    //#Setup.java:48: end of method: bool org.apache.roller.weblogger.ui.struts2.core.Setup.isUserRequired()
    }
    
    @Override
    public boolean isWeblogRequired() {
        return false;
    //#Setup.java:53: method: bool org.apache.roller.weblogger.ui.struts2.core.Setup.isWeblogRequired()
    //#output(bool isWeblogRequired()): return_value
    //#post(bool isWeblogRequired()): return_value == 0
    //#Setup.java:53: end of method: bool org.apache.roller.weblogger.ui.struts2.core.Setup.isWeblogRequired()
    }
    
    
    public String execute() {
        
        try {
            UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
    //#Setup.java:60: method: String org.apache.roller.weblogger.ui.struts2.core.Setup.execute()
    //#Setup.java:60: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.core.Setup
    //#    method: String execute()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#Setup.java:60: Warning: method not available
    //#    -- call on UserManager org.apache.roller.weblogger.business.Weblogger:getUserManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.core.Setup
    //#    method: String execute()
    //#    unanalyzed callee: UserManager org.apache.roller.weblogger.business.Weblogger:getUserManager()
    //#input(String execute()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/core/Setup]
    //#input(String execute()): __Descendant_Table[others]
    //#input(String execute()): __Dispatch_Table.setBlogCount(J)V
    //#input(String execute()): __Dispatch_Table.setUserCount(J)V
    //#input(String execute()): log
    //#input(String execute()): this
    //#input(String execute()): this.__Tag
    //#output(String execute()): return_value
    //#output(String execute()): this.blogCount
    //#output(String execute()): this.userCount
    //#pre[4] (String execute()): (soft) this.__Tag == org/apache/roller/weblogger/ui/struts2/core/Setup
    //#presumption(String execute()): org.apache.commons.logging.LogFactory:getLog(...)@34 != null
    //#presumption(String execute()): org.apache.roller.weblogger.business.Weblogger:getUserManager(...)@60 != null
    //#presumption(String execute()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@60 != null
    //#post(String execute()): return_value == &"success"
    //#post(String execute()): possibly_updated(this.blogCount)
    //#post(String execute()): possibly_updated(this.userCount)
            setUserCount(umgr.getUserCount());
    //#Setup.java:61: Warning: method not available
    //#    -- call on long org.apache.roller.weblogger.business.UserManager:getUserCount()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.core.Setup
    //#    method: String execute()
    //#    unanalyzed callee: long org.apache.roller.weblogger.business.UserManager:getUserCount()
            setBlogCount(umgr.getWeblogCount());
    //#Setup.java:62: Warning: method not available
    //#    -- call on long org.apache.roller.weblogger.business.UserManager:getWeblogCount()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.core.Setup
    //#    method: String execute()
    //#    unanalyzed callee: long org.apache.roller.weblogger.business.UserManager:getWeblogCount()
        } catch (WebloggerException ex) {
            log.error("Error getting user/weblog counts", ex);
    //#Setup.java:64: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:error(Object, Throwable)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.core.Setup
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
        }
        
        return SUCCESS;
    //#Setup.java:67: end of method: String org.apache.roller.weblogger.ui.struts2.core.Setup.execute()
    }

    
    public long getUserCount() {
        return userCount;
    //#Setup.java:72: method: long org.apache.roller.weblogger.ui.struts2.core.Setup.getUserCount()
    //#input(long getUserCount()): this
    //#input(long getUserCount()): this.userCount
    //#output(long getUserCount()): return_value
    //#pre[2] (long getUserCount()): init'ed(this.userCount)
    //#post(long getUserCount()): return_value == this.userCount
    //#post(long getUserCount()): init'ed(return_value)
    //#Setup.java:72: end of method: long org.apache.roller.weblogger.ui.struts2.core.Setup.getUserCount()
    }

    public void setUserCount(long userCount) {
        this.userCount = userCount;
    //#Setup.java:76: method: void org.apache.roller.weblogger.ui.struts2.core.Setup.setUserCount(long)
    //#input(void setUserCount(long)): this
    //#input(void setUserCount(long)): userCount
    //#output(void setUserCount(long)): this.userCount
    //#post(void setUserCount(long)): this.userCount == userCount
    //#post(void setUserCount(long)): init'ed(this.userCount)
    }
    //#Setup.java:77: end of method: void org.apache.roller.weblogger.ui.struts2.core.Setup.setUserCount(long)

    public long getBlogCount() {
        return blogCount;
    //#Setup.java:80: method: long org.apache.roller.weblogger.ui.struts2.core.Setup.getBlogCount()
    //#input(long getBlogCount()): this
    //#input(long getBlogCount()): this.blogCount
    //#output(long getBlogCount()): return_value
    //#pre[2] (long getBlogCount()): init'ed(this.blogCount)
    //#post(long getBlogCount()): return_value == this.blogCount
    //#post(long getBlogCount()): init'ed(return_value)
    //#Setup.java:80: end of method: long org.apache.roller.weblogger.ui.struts2.core.Setup.getBlogCount()
    }

    public void setBlogCount(long blogCount) {
        this.blogCount = blogCount;
    //#Setup.java:84: method: void org.apache.roller.weblogger.ui.struts2.core.Setup.setBlogCount(long)
    //#input(void setBlogCount(long)): blogCount
    //#input(void setBlogCount(long)): this
    //#output(void setBlogCount(long)): this.blogCount
    //#post(void setBlogCount(long)): this.blogCount == blogCount
    //#post(void setBlogCount(long)): init'ed(this.blogCount)
    }
    //#Setup.java:85: end of method: void org.apache.roller.weblogger.ui.struts2.core.Setup.setBlogCount(long)
    
}
    //#Setup.java:: end of class: org.apache.roller.weblogger.ui.struts2.core.Setup
