001    package edu.nrao.sss.model;
002    
003    import java.util.Date;
004    
005    /**
006      * Interface used to record user accountability with respect to object
007      * creation and modification. User ids should be unique.
008      */
009    public interface UserAccountable
010    {
011            /**
012             * Represents an unknown, undefined, or uninitialized user ID.
013             * 
014             * TODO: This might not belong in this class, but belong
015             *       instead to a yet-to-be-defined class in pkg model.user.
016             */
017            public static final Long NULL_USER_ID = new Long(-1);
018    
019            /**
020             * Returns the ID of the user who most recently updated this object.
021             * <p>
022             * If this object does not know the identity of the user who lasted
023             * updated it, the returned ID will be {@link #NULL_USER_ID}.</p>
024             *
025             * @return the ID of the user who most recently updated this object.
026             */
027            public Long getLastUpdatedBy();
028    
029            /**
030             * Sets the ID of the user who most recently updated this object.
031             * <p>
032             * If {@code userId} is <i>null</i>, this object will be updated
033             * not with <i>null</i> but with {@link #NULL_USER_ID} instead.</p>
034             * 
035             * @param userId the ID of the user who most recently updated this object.
036             */
037            public void setLastUpdatedBy(Long userId);
038    
039            /**
040             * Returns the ID of the user who created this object.
041             * <p>
042             * If this object does not know the identity of the user who created
043             * it, the returned ID will be {@link #NULL_USER_ID}.</p>
044             *
045             * @return the ID of the user who created this object.
046             */
047            public Long getCreatedBy();
048    
049            /**
050             * Sets the ID of the user who created this object.
051             * <p>
052             * If {@code userId} is <i>null</i>, this object will be updated
053             * not with <i>null</i> but with {@link #NULL_USER_ID} instead.</p>
054             * 
055             * @param userId the ID of the user who most recently updated this object.
056             */
057            public void setCreatedBy(Long userId);
058    
059            /**
060             * Returns the most recent date on which this object was updated.
061             *
062             * @return the most recent date on which this object was updated.
063             */
064            public Date getLastUpdatedOn();
065    
066            /**
067             * Sets the date on which this object was most recently updated.
068             * <p>
069             * If {@code d} is <i>null</i> it will be ignored and this method
070             * will do nothing.</p>
071             *
072             * @param d the date on which this object was most recently updated.
073             */
074            public void setLastUpdatedOn(Date d);
075    
076            /**
077             * Returns the date on which this object was created.
078             *
079             * @return the date on which this object was created.
080             */
081            public Date getCreatedOn();
082    
083            /**
084             * Sets the date on which this object was created.
085             * <p>
086             * If {@code d} is <i>null</i> it will be ignored and this method
087             * will do nothing.</p>
088             *
089             * @param d the date on which this object was created.
090             */
091            public void setCreatedOn(Date d);
092    }