/*
 * Copyright 2006-2007 The Kuali Foundation.
 * 
 * Licensed under the Educational Community License, Version 1.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.opensource.org/licenses/ecl1.php
 * 
 * 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.
 */
package org.kuali.module.labor.web.struts.form;

import static org.kuali.core.util.SpringServiceLocator.getUniversalUserService;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.kuali.core.bo.SourceAccountingLine;
import org.kuali.core.bo.user.UniversalUser;
import org.kuali.core.exceptions.UserNotFoundException;
import org.kuali.core.util.KualiDecimal;
import org.kuali.module.labor.document.SalaryExpenseTransferDocument;

/**
 * This class is the form class for the Salary Expense Transfer document. This method extends the parent
 * KualiTransactionalDocumentFormBase class which contains all of the common form methods and form attributes needed by the
 * Salary Expense Transfer document. It adds a new method which is a convenience method for getting at the Salary Expense Transfer document easier.
 * 
 * 
 */
public class SalaryExpenseTransferForm extends LaborDocumentFormBase {
    private UniversalUser user;
    private String userId;

    /**
     * Constructs a SalaryExpenseTransferForm instance and sets up the appropriately casted document.
     */
    public SalaryExpenseTransferForm() {
        super();
        setDocument(new SalaryExpenseTransferDocument());
    }

    /**
     * @return Returns the salaryExpenseTransferDocument.
     */
    public SalaryExpenseTransferDocument getSalaryExpenseTransferDocument() {
        return (SalaryExpenseTransferDocument) getDocument();
    }
    
    /**
     * Sets the <code>{@link UniversalUser}</code> through the <code>personUserIdentifier</code> attribute value
     *
     * @param uid <code>personUserIdentifier</code>
     */
    public void setUserId(String uid) throws UserNotFoundException {
        if (uid != null) {
            //  This may happen during populate when there is no initial user
            user = getUniversalUserService().getUniversalUser(uid);
        }
    }
    
    /**
     * Gets the <code>personUserIdentifier</code> attribute value from the <code>{@link UniversalUser}</code> instance
     *
     * @return String <code>personUserIdentifier</code>
     */
    public String getUserId() {
        String retval = null;
        if (user != null) {
            retval = user.getPersonUniversalIdentifier();
        }
        return retval;
    }

    /**
     * Sets the <code>{@link UniversalUser}</code> through the <code>personUserIdentifier</code> attribute value
     *
     * @param uid <code>personUserIdentifier</code>
     */
    public void setPersonName(String personName) throws UserNotFoundException {
        if (personName != null) {
            //  This may happen during populate when there is no initial user
            user = getUniversalUserService().getUniversalUser(personName);
        }
    }
    /**
     * Gets the <code>personName</code> attribute value from the <code>{@link UniversalUser}</code> instance
     *
     * @return String <code>personName</code>
     */
    public String getPersonName() {
        String retval = null;
        if (user != null) {
            retval = user.getPersonName();
        }
        return retval;
    }   
}

@@ -1601,16 +1601,43 @@
  userId;
+%0A    private String emplid;
 %0A%0A    /*
@@ -3761,10 +3761,814 @@
    %7D   %0A
+    /**%0A     * Sets the %3Ccode%3E%7B@link UniversalUser%7D%3C/code%3E through the %3Ccode%3EpersonUserIdentifier%3C/code%3E attribute value%0A     *%0A     * @param uid %3Ccode%3EpersonUserIdentifier%3C/code%3E%0A     */%0A    public void setEmplid(String emplid) throws UserNotFoundException %7B%0A        if (emplid != null) %7B%0A            //  This may happen during populate when there is no initial user%0A            user = getUniversalUserService().getUniversalUser(emplid);%0A        %7D%0A    %7D%0A    /**%0A     * Gets the %3Ccode%3EpersonName%3C/code%3E attribute value from the %3Ccode%3E%7B@link UniversalUser%7D%3C/code%3E instance%0A     *%0A     * @return String %3Ccode%3EpersonName%3C/code%3E%0A     */%0A    public String getEmplid() %7B%0A        String retval = null;%0A        if (user != null) %7B%0A            retval = user.getEmplid();%0A        %7D%0A        return retval;%0A    %7D   %0A
 %7D%0A

Create Necessary JSP and TagLibrary Definitions for Salary Expense Transfer Document Proof-of-Concept