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

package org.apache.roller.weblogger.ui.struts2.editor;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.roller.weblogger.WebloggerException;
import org.apache.roller.weblogger.config.WebloggerConfig;
import org.apache.roller.weblogger.business.WebloggerFactory;
import org.apache.roller.weblogger.business.UserManager;
import org.apache.roller.weblogger.pojos.WeblogPermission;
import org.apache.roller.weblogger.pojos.User;
import org.apache.roller.weblogger.ui.struts2.util.UIAction;
import org.apache.roller.weblogger.util.MailUtil;


/**
 * Allows website admin to invite new members to website.
 *
 * TODO: handle 'disabled' result
 */
public class MembersInvite extends UIAction {
    
    private static Log log = LogFactory.getLog(MembersInvite.class);
    //#MembersInvite.java:40: method: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init
    //#MembersInvite.java:40: Warning: method not available
    //#    -- call on Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init
    //#    unanalyzed callee: Log org.apache.commons.logging.LogFactory:getLog(Class)
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/MembersInvite]
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.execute()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.getPermissionsMask()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.getUserName()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.requiredWeblogPermissions()S
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.save()Ljava/lang/String;
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.setPermissionsMask(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.setUserName(Ljava/lang/String;)V
    //#output(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): log
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/MembersInvite] == &__Dispatch_Table
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.execute()Ljava/lang/String; == &execute
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.getPermissionsMask()Ljava/lang/String; == &getPermissionsMask
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.getUserName()Ljava/lang/String; == &getUserName
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.requiredWeblogPermissions()S == &requiredWeblogPermissions
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.save()Ljava/lang/String; == &save
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.setPermissionsMask(Ljava/lang/String;)V == &setPermissionsMask
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): __Dispatch_Table.setUserName(Ljava/lang/String;)V == &setUserName
    //#post(org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init): init'ed(log)
    //#MembersInvite.java:40: end of method: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.org.apache.roller.weblogger.ui.struts2.editor.MembersInvite__static_init
    
    // user being invited
    private String userName = null;
    
    // permissions being given to user
    private String permissionsMask = null;
    
    
    public MembersInvite() {
    //#MembersInvite.java:49: method: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()
    //#MembersInvite.java:49: 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.MembersInvite
    //#    method: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.util.UIAction()
    //#input(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.actionName
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.desiredMenu
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.pageTitle
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.permissionsMask
    //#output(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.userName
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.actionName == &"invite"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.desiredMenu == &"editor"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.pageTitle == &"inviteMember.title"
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.permissionsMask == null
    //#post(void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()): this.userName == null
        this.actionName = "invite";
        this.desiredMenu = "editor";
        this.pageTitle = "inviteMember.title";
    }
    //#MembersInvite.java:53: end of method: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.org.apache.roller.weblogger.ui.struts2.editor.MembersInvite()
    
    
    // admin perms required
    public short requiredWeblogPermissions() {
        return WeblogPermission.ADMIN;
    //#MembersInvite.java:58: method: short org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.requiredWeblogPermissions()
    //#input(short requiredWeblogPermissions()): org.apache.roller.weblogger.pojos.WeblogPermission.ADMIN
    //#output(short requiredWeblogPermissions()): return_value
    //#presumption(short requiredWeblogPermissions()): init'ed(org.apache.roller.weblogger.pojos.WeblogPermission.ADMIN)
    //#post(short requiredWeblogPermissions()): return_value == org.apache.roller.weblogger.pojos.WeblogPermission.ADMIN
    //#post(short requiredWeblogPermissions()): (soft) init'ed(return_value)
    //#MembersInvite.java:58: end of method: short org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.requiredWeblogPermissions()
    }
    
    
    public String execute() {
        
        // if group blogging is disabled then you can't change permissions
        if (!WebloggerConfig.getBooleanProperty("groupblogging.enabled")) {
    //#MembersInvite.java:65: method: String org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.execute()
    //#MembersInvite.java:65: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String execute()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(String)
    //#input(String execute()): log
    //#input(String execute()): this
    //#output(String execute()): return_value
    //#pre[1] (String execute()): (soft) log != null
    //#post(String execute()): return_value in Addr_Set{&"input",&"success"}
    //#test_vector(String execute()): org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(...)@65: {1}, {0}
            // TODO: i18n
            addError("invitations disabled");
    //#MembersInvite.java:67: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
            return SUCCESS;
        }
        
        log.debug("Showing weblog inivitation form");
    //#MembersInvite.java:71: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String execute()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        
        return INPUT;
    //#MembersInvite.java:73: end of method: String org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.execute()
    }
    
    
    /**
     * Save the new invitation and notify the user.
     */
    public String save() {
        
        // if group blogging is disabled then you can't change permissions
        if (!WebloggerConfig.getBooleanProperty("groupblogging.enabled")) {
    //#MembersInvite.java:83: method: String org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.save()
    //#MembersInvite.java:83: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(String)
    //#input(String save()): "Error looking up permissions for weblog - "._tainted
    //#input(String save()): "Error looking up user by id - "._tainted
    //#input(String save()): __Descendant_Table[org/apache/roller/weblogger/ui/struts2/editor/MembersInvite]
    //#input(String save()): __Descendant_Table[others]
    //#input(String save()): __Dispatch_Table.getPermissionsMask()Ljava/lang/String;
    //#input(String save()): __Dispatch_Table.getUserName()Ljava/lang/String;
    //#input(String save()): log
    //#input(String save()): this
    //#input(String save()): this.__Tag
    //#input(String save()): this.permissionsMask
    //#input(String save()): this.userName
    //#input(String save()): this.userName._tainted
    //#output(String save()): return_value
    //#pre[1] (String save()): (soft) log != null
    //#pre[3] (String save()): (soft) this.__Tag == org/apache/roller/weblogger/ui/struts2/editor/MembersInvite
    //#pre[4] (String save()): (soft) init'ed(this.permissionsMask)
    //#pre[5] (String save()): (soft) init'ed(this.userName)
    //#presumption(String save()): org.apache.roller.weblogger.business.Weblogger:getUserManager(...)@91 != null
    //#presumption(String save()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@131 != null
    //#presumption(String save()): org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger(...)@91 != null
    //#presumption(String save()): org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog(...)@122 != null
    //#post(String save()): return_value in Addr_Set{&"success",&"input"}
    //#test_vector(String save()): org.apache.roller.weblogger.business.UserManager:getPermissions(...)@113: Addr_Set{null}, Inverse{null}
    //#test_vector(String save()): org.apache.roller.weblogger.business.UserManager:getUserByUserName(...)@96: Inverse{null}, Addr_Set{null}
    //#test_vector(String save()): org.apache.roller.weblogger.config.WebloggerConfig:getBooleanProperty(...)@83: {1}, {0}
    //#test_vector(String save()): org.apache.roller.weblogger.pojos.WeblogPermission:isPending(...)@115: {0}, {1}
    //#test_vector(String save()): org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:hasActionErrors(...)@107: {0}, {1}
    //#test_vector(String save()): org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:hasActionErrors(...)@128: {1}, {0}
    //#test_vector(String save()): org.apache.roller.weblogger.util.MailUtil:isMailConfigured(...)@135: {0}, {1}
            // TODO: i18n
            addError("invitations disabled");
    //#MembersInvite.java:85: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
            return SUCCESS;
        }
        
        log.debug("Attempting to process weblog invitation");
    //#MembersInvite.java:89: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        
        UserManager umgr = WebloggerFactory.getWeblogger().getUserManager();
    //#MembersInvite.java:91: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#MembersInvite.java:91: Warning: method not available
    //#    -- call on UserManager org.apache.roller.weblogger.business.Weblogger:getUserManager()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: UserManager org.apache.roller.weblogger.business.Weblogger:getUserManager()
        
        // user being invited
        User user = null;
        try {
            user = umgr.getUserByUserName(getUserName());
    //#MembersInvite.java:96: Warning: method not available
    //#    -- call on User org.apache.roller.weblogger.business.UserManager:getUserByUserName(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: User org.apache.roller.weblogger.business.UserManager:getUserByUserName(String)
            if (user == null) {
                addError("inviteMember.error.userNotFound");
    //#MembersInvite.java:98: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
            }
        } catch(WebloggerException ex) {
            log.error("Error looking up user by id - "+getUserName(), ex);
    //#MembersInvite.java:101: 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.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            // TODO: i18n
            addError("Error looking up invitee");
    //#MembersInvite.java:103: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
        }
        
        // if we already have an error then bail now
        if(hasActionErrors()) {
    //#MembersInvite.java:107: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:hasActionErrors()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:hasActionErrors()
            return INPUT;
        }
        
        // check for existing permissions or invitation
        try {
            WeblogPermission perms = umgr.getPermissions(getActionWeblog(), user);
    //#MembersInvite.java:113: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog()
    //#MembersInvite.java:113: Warning: method not available
    //#    -- call on WeblogPermission org.apache.roller.weblogger.business.UserManager:getPermissions(Weblog, User)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: WeblogPermission org.apache.roller.weblogger.business.UserManager:getPermissions(Weblog, User)
            
            if (perms != null && perms.isPending()) {
    //#MembersInvite.java:115: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.pojos.WeblogPermission:isPending()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.pojos.WeblogPermission:isPending()
                addError("inviteMember.error.userAlreadyInvited");
    //#MembersInvite.java:116: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
            } else if (perms != null) {
                addError("inviteMember.error.userAlreadyMember");
    //#MembersInvite.java:118: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
            }
            
        } catch (WebloggerException ex) {
            log.error("Error looking up permissions for weblog - "+getActionWeblog().getHandle(), ex);
    //#MembersInvite.java:122: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog()
    //#MembersInvite.java:122: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.pojos.Weblog:getHandle()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: String org.apache.roller.weblogger.pojos.Weblog:getHandle()
    //#MembersInvite.java:122: 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.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            // TODO: i18n
            addError("Error checking existing permissions");
    //#MembersInvite.java:124: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
        }
        
        // if no errors then send the invitation
        if(!hasActionErrors()) try {
    //#MembersInvite.java:128: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:hasActionErrors()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:hasActionErrors()
            
            umgr.inviteUser(getActionWeblog(), user, Short.parseShort(getPermissionsMask()));
    //#MembersInvite.java:130: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog()
    //#MembersInvite.java:130: Warning: method not available
    //#    -- call on WeblogPermission org.apache.roller.weblogger.business.UserManager:inviteUser(Weblog, User, short)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: WeblogPermission org.apache.roller.weblogger.business.UserManager:inviteUser(Weblog, User, short)
            WebloggerFactory.getWeblogger().flush();
    //#MembersInvite.java:131: Warning: method not available
    //#    -- call on Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: Weblogger org.apache.roller.weblogger.business.WebloggerFactory:getWeblogger()
    //#MembersInvite.java:131: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.business.Weblogger:flush()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.business.Weblogger:flush()
            
            addMessage("inviteMember.userInvited");
    //#MembersInvite.java:133: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addMessage(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addMessage(String)
            
            if (MailUtil.isMailConfigured()) try {
    //#MembersInvite.java:135: Warning: method not available
    //#    -- call on bool org.apache.roller.weblogger.util.MailUtil:isMailConfigured()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: bool org.apache.roller.weblogger.util.MailUtil:isMailConfigured()
                MailUtil.sendWeblogInvitation(getActionWeblog(), user);
    //#MembersInvite.java:136: Warning: method not available
    //#    -- call on Weblog org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: Weblog org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:getActionWeblog()
    //#MembersInvite.java:136: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.util.MailUtil:sendWeblogInvitation(Weblog, User)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.util.MailUtil:sendWeblogInvitation(Weblog, User)
            } catch (WebloggerException e) {
                // TODO: this should be an error except that struts2 misbehaves
                // when we chain this action to the next one thinking that an error
                // means that validation broke during the chain
                addMessage("error.untranslated", e.getMessage());
    //#MembersInvite.java:141: Warning: method not available
    //#    -- call on String org.apache.roller.weblogger.WebloggerException:getMessage()
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: String org.apache.roller.weblogger.WebloggerException:getMessage()
    //#MembersInvite.java:141: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addMessage(String, String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addMessage(String, String)
            }
            
            log.debug("Invitation successfully recorded");
    //#MembersInvite.java:144: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
            
            return SUCCESS;
            
        } catch (Exception ex) {
            log.error("Error creating user invitation", ex);
    //#MembersInvite.java:149: 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.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:error(Object, Throwable)
            // TODO: i18n
            addError("Error creating user invitation");
    //#MembersInvite.java:151: Warning: method not available
    //#    -- call on void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite:addError(String)
        }
        
        log.debug("Invitation had errors, giving user another chance");
    //#MembersInvite.java:154: Warning: method not available
    //#    -- call on void org.apache.commons.logging.Log:debug(Object)
    //#    severity: INFORMATIONAL
    //#    class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
    //#    method: String save()
    //#    unanalyzed callee: void org.apache.commons.logging.Log:debug(Object)
        
        return INPUT;
    //#MembersInvite.java:156: end of method: String org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.save()
    }
    

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

    public void setUserName(String userId) {
        this.userName = userId;
    //#MembersInvite.java:165: method: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.setUserName(String)
    //#input(void setUserName(String)): this
    //#input(void setUserName(String)): userId
    //#output(void setUserName(String)): this.userName
    //#post(void setUserName(String)): this.userName == userId
    //#post(void setUserName(String)): init'ed(this.userName)
    }
    //#MembersInvite.java:166: end of method: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.setUserName(String)

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

    public void setPermissionsMask(String permission) {
        this.permissionsMask = permission;
    //#MembersInvite.java:173: method: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.setPermissionsMask(String)
    //#input(void setPermissionsMask(String)): permission
    //#input(void setPermissionsMask(String)): this
    //#output(void setPermissionsMask(String)): this.permissionsMask
    //#post(void setPermissionsMask(String)): this.permissionsMask == permission
    //#post(void setPermissionsMask(String)): init'ed(this.permissionsMask)
    }
    //#MembersInvite.java:174: end of method: void org.apache.roller.weblogger.ui.struts2.editor.MembersInvite.setPermissionsMask(String)
    
}
    //#MembersInvite.java:: end of class: org.apache.roller.weblogger.ui.struts2.editor.MembersInvite
