com.pureinfo.ark.auth2.model.ActionDef.java Source code

Java tutorial

Introduction

Here is the source code for com.pureinfo.ark.auth2.model.ActionDef.java

Source

/**
 * PureInfo Ark
 * @(#)ActionDef.java   1.0 2006-9-29
 * 
 * Copyright(c) 2004-2005, PureInfo Information Technology Corp. Ltd. 
 * All rights reserved, see the license file.
 * 
 * www.pureinfo.com.cn
 */

package com.pureinfo.ark.auth2.model;

import org.dom4j.Element;

import com.pureinfo.force.exception.PureException;
import com.pureinfo.force.xml.IXMLSupporter;
import com.pureinfo.force.xml.XMLUtil;

/**
 * <P>
 * Created on 2006-9-29 21:22:40 <BR>
 * Last modified on 2006-9-29
 * </P>
 * ActionDef: definition of action.
 * 
 * @author Why
 * @version 1.0, 2006-9-29
 * @since Ark 1.2
 */
public class ActionDef implements IXMLSupporter {
    private int m_nIndex;

    private String m_sName;

    private String m_sDesc;

    /**
     * Constructor: default
     */
    public ActionDef() {
        super();
    }

    /**
     * Returns the index.
     * 
     * @return the index.
     */
    public int getIndex() {
        return m_nIndex;
    }

    /**
     * Sets the index.
     * 
     * @param _nIndex
     *            the index to set.
     */
    public void setIndex(int _nIndex) {
        m_nIndex = _nIndex;
    }

    /**
     * Returns the name.
     * 
     * @return the name.
     */
    public String getName() {
        return m_sName;
    }

    /**
     * Sets the name.
     * 
     * @param _sName
     *            the name to set.
     */
    public void setName(String _sName) {
        m_sName = _sName;
    }

    /**
     * Returns the desc.
     * 
     * @return the desc.
     */
    public String getDesc() {
        return m_sDesc;
    }

    /**
     * Sets the desc.
     * 
     * @param _sDesc
     *            the desc to set.
     */
    public void setDesc(String _sDesc) {
        m_sDesc = _sDesc;
    }

    //=========================================================================
    //implementation for IXMLSupporter

    /**
     * @see com.pureinfo.force.xml.IXMLSupporter#toXMLElement(org.dom4j.Element)
     */
    public void toXMLElement(Element _element) throws PureException {
        _element.addAttribute("index", String.valueOf(m_nIndex));
        _element.addAttribute("name", m_sName);
        _element.addAttribute("desc", m_sDesc);
    }

    /**
     * @see com.pureinfo.force.xml.IXMLSupporter#fromXML(org.dom4j.Element)
     */
    public void fromXML(Element _element) throws PureException {
        this.setIndex(XMLUtil.getAttributeValueAsInt(_element, "index"));
        this.setName(XMLUtil.getAttributeValueTrim(_element, "name"));
        this.setDesc(XMLUtil.getAttributeValueTrim(_element, "desc"));
    }

}