Subversion Repositories general

Rev

Rev 945 | Rev 1010 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

package ak.hostadmiral.core.model;

import java.util.Date;
import ak.hostadmiral.util.ModelException;
import ak.hostadmiral.util.ModelSecurityException;

public abstract class GeneralModelObject
        implements ModelObject
{
        private Long    id;
        private Boolean enabled;
        private String  comment;
        private Date    modStamp;
        private User    modUser;

        /**
         *
         * @hibernate.id generator-class="native"
         */
        public Long getId()
        {
                return id;
        }

        protected void setId(Long id)
        {
                this.id = id;
        }

        /**
         *
         * @hibernate.property
         */
        public Boolean getEnabled()
        {
                return enabled;
        }

        protected void setEnabled(Boolean enabled)
        {
                this.enabled = enabled;
        }

        public void setEnabled(User editor, Boolean enabled)
                throws ModelException
        {
                if(!editableBy(editor))
                        throw new ModelSecurityException();

                this.enabled = enabled;
        }

        /**
         *
         * @hibernate.property
         */
        public String getComment()
        {
                return comment;
        }

        protected void setComment(String comment)
        {
                this.comment = comment;
        }

        public void setComment(User editor, String comment)
                throws ModelException
        {
                if(!editableBy(editor))
                        throw new ModelSecurityException();

                this.comment = comment;
        }

        /**
         *
         * @hibernate.timestamp column="mod_stamp"
         */
        public Date getModStamp()
        {
                return modStamp;
        }

        protected void setModStamp(Date modStamp)
        {
                this.modStamp = modStamp;
        }

        /**
         *
         * @hibernate.many-to-one column="mod_user"
         */
        public User getModUser()
        {
                return modUser;
        }

        protected void setModUser(User modUser)
        {
                this.modUser = modUser;
        }
}