|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
     | 
  |  17 |     | 
   package org.kuali.rice.kns.bo;  | 
  |  18 |     | 
     | 
  |  19 |     | 
   import org.hibernate.annotations.GenericGenerator;  | 
  |  20 |     | 
   import org.hibernate.annotations.Parameter;  | 
  |  21 |     | 
   import org.kuali.rice.core.api.services.CoreApiServiceLocator;  | 
  |  22 |     | 
   import org.kuali.rice.kim.api.services.KimApiServiceLocator;  | 
  |  23 |     | 
   import org.kuali.rice.kim.bo.Person;  | 
  |  24 |     | 
   import org.kuali.rice.kns.util.KNSConstants;  | 
  |  25 |     | 
     | 
  |  26 |     | 
   import javax.persistence.CascadeType;  | 
  |  27 |     | 
   import javax.persistence.Column;  | 
  |  28 |     | 
   import javax.persistence.Entity;  | 
  |  29 |     | 
   import javax.persistence.FetchType;  | 
  |  30 |     | 
   import javax.persistence.GeneratedValue;  | 
  |  31 |     | 
   import javax.persistence.Id;  | 
  |  32 |     | 
   import javax.persistence.JoinColumn;  | 
  |  33 |     | 
   import javax.persistence.OneToOne;  | 
  |  34 |     | 
   import javax.persistence.Table;  | 
  |  35 |     | 
   import javax.persistence.Transient;  | 
  |  36 |     | 
   import java.sql.Timestamp;  | 
  |  37 |     | 
     | 
  |  38 |     | 
     | 
  |  39 |     | 
     | 
  |  40 |     | 
     | 
  |  41 |     | 
   @Entity  | 
  |  42 |     | 
   @Table(name="KRNS_NTE_T")  | 
  |  43 |     | 
   public class Note extends PersistableBusinessObjectBase { | 
  |  44 |     | 
       private static final long serialVersionUID = -7647166354016356770L;  | 
  |  45 |     | 
     | 
  |  46 |     | 
       @Id  | 
  |  47 |     | 
       @GeneratedValue(generator="KRNS_NTE_S")  | 
  |  48 |     | 
           @GenericGenerator(name="KRNS_NTE_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ | 
  |  49 |     | 
                           @Parameter(name="sequence_name",value="KRNS_NTE_S"),  | 
  |  50 |     | 
                           @Parameter(name="value_column",value="id")  | 
  |  51 |     | 
           })  | 
  |  52 |     | 
           @Column(name="NTE_ID")  | 
  |  53 |     | 
           private Long noteIdentifier;  | 
  |  54 |     | 
       @Column(name="RMT_OBJ_ID")  | 
  |  55 |     | 
           private String remoteObjectIdentifier;  | 
  |  56 |     | 
       @Column(name="AUTH_PRNCPL_ID")  | 
  |  57 |     | 
           private String authorUniversalIdentifier;  | 
  |  58 |     | 
           @Column(name="POST_TS")  | 
  |  59 |     | 
           private Timestamp notePostedTimestamp;  | 
  |  60 |     | 
       @Column(name="NTE_TYP_CD")  | 
  |  61 |     | 
           private String noteTypeCode;  | 
  |  62 |     | 
       @Column(name="TXT")  | 
  |  63 |     | 
           private String noteText;  | 
  |  64 |     | 
       @Column(name="TPC_TXT")  | 
  |  65 |     | 
           private String noteTopicText;  | 
  |  66 |     | 
       @Column(name="PRG_CD")  | 
  |  67 |     | 
           private String notePurgeCode;  | 
  |  68 |     | 
       @Transient  | 
  |  69 |     | 
       private String attachmentIdentifier;  | 
  |  70 |     | 
     | 
  |  71 |     | 
       @OneToOne(fetch=FetchType.EAGER)  | 
  |  72 |     | 
           @JoinColumn(name="NTE_TYP_CD", insertable=false, updatable=false)  | 
  |  73 |     | 
           private NoteType noteType;  | 
  |  74 |     | 
       @Transient  | 
  |  75 |     | 
       private Person authorUniversal;  | 
  |  76 |     | 
       @OneToOne(fetch = FetchType.EAGER, cascade = { CascadeType.ALL }) | 
  |  77 |     | 
           @JoinColumn(name = "NTE_ID", insertable = false, updatable = false)  | 
  |  78 |     | 
           private Attachment attachment;  | 
  |  79 |     | 
       @Transient  | 
  |  80 |     | 
       private AdHocRouteRecipient adHocRouteRecipient;  | 
  |  81 |     | 
     | 
  |  82 |     | 
         | 
  |  83 |     | 
     | 
  |  84 |     | 
     | 
  |  85 |     | 
       public Note() { | 
  |  86 |    0 |            super();  | 
  |  87 |     | 
     | 
  |  88 |     | 
             | 
  |  89 |    0 |            this.setNoteText(KNSConstants.EMPTY_STRING);  | 
  |  90 |     | 
             | 
  |  91 |    0 |            this.setNoteTypeCode("DH"); | 
  |  92 |     | 
     | 
  |  93 |    0 |            this.setAdHocRouteRecipient(new AdHocRoutePerson());  | 
  |  94 |    0 |        }  | 
  |  95 |     | 
         | 
  |  96 |     | 
         | 
  |  97 |     | 
     | 
  |  98 |     | 
     | 
  |  99 |     | 
       public void setNotePostedTimestampToCurrent() { | 
  |  100 |    0 |                final Timestamp now = CoreApiServiceLocator.getDateTimeService().getCurrentTimestamp();  | 
  |  101 |    0 |                this.setNotePostedTimestamp(now);  | 
  |  102 |    0 |        }  | 
  |  103 |     | 
     | 
  |  104 |     | 
         | 
  |  105 |     | 
     | 
  |  106 |     | 
     | 
  |  107 |     | 
     | 
  |  108 |     | 
     | 
  |  109 |     | 
       public Long getNoteIdentifier() { | 
  |  110 |    0 |            return noteIdentifier;  | 
  |  111 |     | 
       }  | 
  |  112 |     | 
     | 
  |  113 |     | 
         | 
  |  114 |     | 
     | 
  |  115 |     | 
     | 
  |  116 |     | 
     | 
  |  117 |     | 
     | 
  |  118 |     | 
       public void setNoteIdentifier(Long noteIdentifier) { | 
  |  119 |    0 |            this.noteIdentifier = noteIdentifier;  | 
  |  120 |    0 |        }  | 
  |  121 |     | 
     | 
  |  122 |     | 
         | 
  |  123 |     | 
     | 
  |  124 |     | 
     | 
  |  125 |     | 
     | 
  |  126 |     | 
     | 
  |  127 |     | 
       public String getRemoteObjectIdentifier() { | 
  |  128 |    0 |            return remoteObjectIdentifier;  | 
  |  129 |     | 
       }  | 
  |  130 |     | 
     | 
  |  131 |     | 
         | 
  |  132 |     | 
     | 
  |  133 |     | 
     | 
  |  134 |     | 
     | 
  |  135 |     | 
     | 
  |  136 |     | 
       public void setRemoteObjectIdentifier(String remoteObjectIdentifier) { | 
  |  137 |    0 |            this.remoteObjectIdentifier = remoteObjectIdentifier;  | 
  |  138 |    0 |        }  | 
  |  139 |     | 
     | 
  |  140 |     | 
     | 
  |  141 |     | 
         | 
  |  142 |     | 
     | 
  |  143 |     | 
     | 
  |  144 |     | 
     | 
  |  145 |     | 
     | 
  |  146 |     | 
       public String getAuthorUniversalIdentifier() { | 
  |  147 |    0 |            return authorUniversalIdentifier;  | 
  |  148 |     | 
       }  | 
  |  149 |     | 
     | 
  |  150 |     | 
         | 
  |  151 |     | 
     | 
  |  152 |     | 
     | 
  |  153 |     | 
     | 
  |  154 |     | 
     | 
  |  155 |     | 
       public void setAuthorUniversalIdentifier(String noteAuthorIdentifier) { | 
  |  156 |    0 |            this.authorUniversalIdentifier = noteAuthorIdentifier;  | 
  |  157 |    0 |        }  | 
  |  158 |     | 
     | 
  |  159 |     | 
     | 
  |  160 |     | 
         | 
  |  161 |     | 
     | 
  |  162 |     | 
     | 
  |  163 |     | 
     | 
  |  164 |     | 
     | 
  |  165 |     | 
       public Timestamp getNotePostedTimestamp() { | 
  |  166 |    0 |            return notePostedTimestamp;  | 
  |  167 |     | 
       }  | 
  |  168 |     | 
     | 
  |  169 |     | 
         | 
  |  170 |     | 
     | 
  |  171 |     | 
     | 
  |  172 |     | 
     | 
  |  173 |     | 
     | 
  |  174 |     | 
       public void setNotePostedTimestamp(Timestamp notePostedTimestamp) { | 
  |  175 |    0 |            this.notePostedTimestamp = notePostedTimestamp;  | 
  |  176 |    0 |        }  | 
  |  177 |     | 
     | 
  |  178 |     | 
     | 
  |  179 |     | 
         | 
  |  180 |     | 
     | 
  |  181 |     | 
     | 
  |  182 |     | 
     | 
  |  183 |     | 
     | 
  |  184 |     | 
       public String getNoteTypeCode() { | 
  |  185 |    0 |            return noteTypeCode;  | 
  |  186 |     | 
       }  | 
  |  187 |     | 
     | 
  |  188 |     | 
         | 
  |  189 |     | 
     | 
  |  190 |     | 
     | 
  |  191 |     | 
     | 
  |  192 |     | 
     | 
  |  193 |     | 
       public void setNoteTypeCode(String noteTypeCode) { | 
  |  194 |    0 |            this.noteTypeCode = noteTypeCode;  | 
  |  195 |    0 |        }  | 
  |  196 |     | 
     | 
  |  197 |     | 
     | 
  |  198 |     | 
         | 
  |  199 |     | 
     | 
  |  200 |     | 
     | 
  |  201 |     | 
     | 
  |  202 |     | 
     | 
  |  203 |     | 
       public String getNoteText() { | 
  |  204 |    0 |            return noteText;  | 
  |  205 |     | 
       }  | 
  |  206 |     | 
     | 
  |  207 |     | 
         | 
  |  208 |     | 
     | 
  |  209 |     | 
     | 
  |  210 |     | 
     | 
  |  211 |     | 
     | 
  |  212 |     | 
       public void setNoteText(String noteText) { | 
  |  213 |    0 |            this.noteText = noteText;  | 
  |  214 |    0 |        }  | 
  |  215 |     | 
     | 
  |  216 |     | 
     | 
  |  217 |     | 
         | 
  |  218 |     | 
     | 
  |  219 |     | 
     | 
  |  220 |     | 
     | 
  |  221 |     | 
     | 
  |  222 |     | 
       public String getNoteTopicText() { | 
  |  223 |    0 |            return noteTopicText;  | 
  |  224 |     | 
       }  | 
  |  225 |     | 
     | 
  |  226 |     | 
         | 
  |  227 |     | 
     | 
  |  228 |     | 
     | 
  |  229 |     | 
     | 
  |  230 |     | 
     | 
  |  231 |     | 
       public void setNoteTopicText(String noteTopicText) { | 
  |  232 |    0 |            this.noteTopicText = noteTopicText;  | 
  |  233 |    0 |        }  | 
  |  234 |     | 
     | 
  |  235 |     | 
         | 
  |  236 |     | 
     | 
  |  237 |     | 
     | 
  |  238 |     | 
     | 
  |  239 |     | 
     | 
  |  240 |     | 
       public String getNotePurgeCode() { | 
  |  241 |    0 |            return notePurgeCode;  | 
  |  242 |     | 
       }  | 
  |  243 |     | 
     | 
  |  244 |     | 
         | 
  |  245 |     | 
     | 
  |  246 |     | 
     | 
  |  247 |     | 
     | 
  |  248 |     | 
     | 
  |  249 |     | 
       public void setNotePurgeCode(String notePurgeCode) { | 
  |  250 |    0 |            this.notePurgeCode = notePurgeCode;  | 
  |  251 |    0 |        }  | 
  |  252 |     | 
     | 
  |  253 |     | 
         | 
  |  254 |     | 
     | 
  |  255 |     | 
     | 
  |  256 |     | 
     | 
  |  257 |     | 
     | 
  |  258 |     | 
       public NoteType getNoteType() { | 
  |  259 |    0 |            return noteType;  | 
  |  260 |     | 
       }  | 
  |  261 |     | 
     | 
  |  262 |     | 
         | 
  |  263 |     | 
     | 
  |  264 |     | 
     | 
  |  265 |     | 
     | 
  |  266 |     | 
     | 
  |  267 |     | 
     | 
  |  268 |     | 
       public void setNoteType(NoteType noteType) { | 
  |  269 |    0 |            this.noteType = noteType;  | 
  |  270 |    0 |        }  | 
  |  271 |     | 
     | 
  |  272 |     | 
         | 
  |  273 |     | 
     | 
  |  274 |     | 
     | 
  |  275 |     | 
     | 
  |  276 |     | 
     | 
  |  277 |     | 
       public Person getAuthorUniversal() { | 
  |  278 |    0 |            authorUniversal = KimApiServiceLocator.getPersonService().updatePersonIfNecessary(authorUniversalIdentifier, authorUniversal);  | 
  |  279 |    0 |            return authorUniversal;  | 
  |  280 |     | 
       }  | 
  |  281 |     | 
     | 
  |  282 |     | 
         | 
  |  283 |     | 
     | 
  |  284 |     | 
     | 
  |  285 |     | 
     | 
  |  286 |     | 
     | 
  |  287 |     | 
     | 
  |  288 |     | 
       public void setAuthorUniversal(Person authorUniversal) { | 
  |  289 |    0 |            this.authorUniversal = authorUniversal;  | 
  |  290 |    0 |        }  | 
  |  291 |     | 
     | 
  |  292 |     | 
         | 
  |  293 |     | 
     | 
  |  294 |     | 
     | 
  |  295 |     | 
     | 
  |  296 |     | 
     | 
  |  297 |     | 
       public Attachment getAttachment() { | 
  |  298 |    0 |            return attachment;  | 
  |  299 |     | 
       }  | 
  |  300 |     | 
     | 
  |  301 |     | 
         | 
  |  302 |     | 
     | 
  |  303 |     | 
     | 
  |  304 |     | 
     | 
  |  305 |     | 
     | 
  |  306 |     | 
       public void setAttachment(Attachment attachment) { | 
  |  307 |    0 |            this.attachment = attachment;  | 
  |  308 |    0 |        }  | 
  |  309 |     | 
     | 
  |  310 |     | 
         | 
  |  311 |     | 
     | 
  |  312 |     | 
     | 
  |  313 |     | 
     | 
  |  314 |     | 
     | 
  |  315 |     | 
       public String getAttachmentIdentifier() { | 
  |  316 |    0 |            return attachmentIdentifier;  | 
  |  317 |     | 
       }  | 
  |  318 |     | 
     | 
  |  319 |     | 
         | 
  |  320 |     | 
     | 
  |  321 |     | 
     | 
  |  322 |     | 
     | 
  |  323 |     | 
     | 
  |  324 |     | 
       public void setAttachmentIdentifier(String attachmentIdentifier) { | 
  |  325 |    0 |            this.attachmentIdentifier = attachmentIdentifier;  | 
  |  326 |    0 |        }  | 
  |  327 |     | 
     | 
  |  328 |     | 
         | 
  |  329 |     | 
     | 
  |  330 |     | 
     | 
  |  331 |     | 
     | 
  |  332 |     | 
     | 
  |  333 |     | 
     | 
  |  334 |     | 
       public void addAttachment(Attachment attachment) { | 
  |  335 |    0 |            setAttachmentIdentifier(attachment.getAttachmentIdentifier());  | 
  |  336 |    0 |            setAttachment(attachment);  | 
  |  337 |     | 
     | 
  |  338 |     | 
             | 
  |  339 |    0 |            attachment.setNoteIdentifier(noteIdentifier);  | 
  |  340 |     | 
             | 
  |  341 |     | 
             | 
  |  342 |    0 |            attachment.setNote(this);  | 
  |  343 |    0 |        }  | 
  |  344 |     | 
     | 
  |  345 |     | 
         | 
  |  346 |     | 
     | 
  |  347 |     | 
     | 
  |  348 |     | 
     | 
  |  349 |     | 
       public void removeAttachment() { | 
  |  350 |    0 |            setAttachment(null);  | 
  |  351 |    0 |            setAttachmentIdentifier(null);  | 
  |  352 |    0 |        }  | 
  |  353 |     | 
     | 
  |  354 |     | 
         | 
  |  355 |     | 
     | 
  |  356 |     | 
     | 
  |  357 |     | 
       public AdHocRouteRecipient getAdHocRouteRecipient() { | 
  |  358 |    0 |            return adHocRouteRecipient;  | 
  |  359 |     | 
       }  | 
  |  360 |     | 
     | 
  |  361 |     | 
         | 
  |  362 |     | 
     | 
  |  363 |     | 
     | 
  |  364 |     | 
       public void setAdHocRouteRecipient(AdHocRouteRecipient adHocRouteRecipient) { | 
  |  365 |    0 |            this.adHocRouteRecipient = adHocRouteRecipient;  | 
  |  366 |    0 |        }  | 
  |  367 |     | 
     | 
  |  368 |     | 
   }  | 
  |  369 |     | 
     | 
  |  370 |     | 
     |