/*
 * Created on Jan 7, 2005
 *
 * TODO To change the template for this generated file go to
 * Window - Preferences - Java - Code Style - Code Templates
 */
package gov.va.med.esr.ui.taglib;

import javax.servlet.jsp.*;

import gov.va.med.esr.ui.common.util.JspUtils;

public class DisplaySSN extends BaseDisplayTag 
{
	private static final long serialVersionUID = 7266672117172106619L;
    
    private String scope = null;  //The scope to be searched to retrieve the specified source bean
	private String name = null;  //Name of the source bean that contains the data that needs to be rendered.
	private String ssnProperty = null;  //Name of the property to be accessed to retrieve the SSN value on the specified source bean.

   /**
     * Process the start tag.
     *
     * @exception JspException if a JSP exception has occurred
     */	
    public int doStartTag() throws JspException
    {    	
    	//Look up the requested property value
    	Object value = super.lookup(pageContext, name, ssnProperty, scope);		
    	if (value == null)
            return (SKIP_BODY); // Nothing to output
    	
    	String output = null;
        //format the ssn
    	try
		{
          output = JspUtils.displaySSN(value.toString());
		}
    	catch (Exception ex)
		{
    	  throw new JspException(ex.getMessage());
		}
        //Print the string value to the output writer      
        super.write(pageContext, output, false);
        return (SKIP_BODY);
    }
    
        

    public String getName() 
    {
        return (this.name);
    }
    public void setName(String name) 
    {
        this.name = name;
    }

    

    public String getSsnProperty() 
    {
        return (this.ssnProperty);
    }
    public void setSsnProperty(String ssnProperty) 
    {
        this.ssnProperty = ssnProperty;
    }

    
    
    public String getScope() 
    {
        return (this.scope);
    }
    public void setScope(String scope) 
    {
        this.scope = scope;
    }
    
    
}