|  1 |     | 
     | 
  |  2 |     | 
     | 
  |  3 |     | 
     | 
  |  4 |     | 
     | 
  |  5 |     | 
     | 
  |  6 |     | 
     | 
  |  7 |     | 
     | 
  |  8 |     | 
     | 
  |  9 |     | 
     | 
  |  10 |     | 
     | 
  |  11 |     | 
     | 
  |  12 |     | 
     | 
  |  13 |     | 
     | 
  |  14 |     | 
     | 
  |  15 |     | 
     | 
  |  16 |     | 
     | 
  |  17 |     | 
   package org.kuali.rice.kew.notes;  | 
  |  18 |     | 
     | 
  |  19 |     | 
   import org.hibernate.annotations.Fetch;  | 
  |  20 |     | 
   import org.hibernate.annotations.FetchMode;  | 
  |  21 |     | 
   import org.hibernate.annotations.GenericGenerator;  | 
  |  22 |     | 
   import org.hibernate.annotations.Parameter;  | 
  |  23 |     | 
   import org.kuali.rice.core.framework.persistence.jpa.OrmUtils;  | 
  |  24 |     | 
   import org.kuali.rice.core.util.RiceConstants;  | 
  |  25 |     | 
   import org.kuali.rice.kew.service.KEWServiceLocator;  | 
  |  26 |     | 
   import org.kuali.rice.kew.util.KEWConstants;  | 
  |  27 |     | 
     | 
  |  28 |     | 
   import javax.persistence.*;  | 
  |  29 |     | 
   import java.io.Serializable;  | 
  |  30 |     | 
   import java.sql.Timestamp;  | 
  |  31 |     | 
   import java.text.DateFormat;  | 
  |  32 |     | 
   import java.text.SimpleDateFormat;  | 
  |  33 |     | 
   import java.util.ArrayList;  | 
  |  34 |     | 
   import java.util.Calendar;  | 
  |  35 |     | 
   import java.util.Date;  | 
  |  36 |     | 
   import java.util.List;  | 
  |  37 |     | 
     | 
  |  38 |     | 
     | 
  |  39 |     | 
     | 
  |  40 |     | 
     | 
  |  41 |     | 
     | 
  |  42 |     | 
     | 
  |  43 |     | 
     | 
  |  44 |     | 
     | 
  |  45 |     | 
     | 
  |  46 |     | 
   @Entity(name="org.kuali.rice.kew.notes.Note")  | 
  |  47 |     | 
   @Table(name="KREW_DOC_NTE_T")  | 
  |  48 |     | 
     | 
  |  49 |     | 
   @NamedQueries({ | 
  |  50 |     | 
           @NamedQuery(name="KewNote.FindNoteByNoteId",query="select n from org.kuali.rice.kew.notes.Note as n where n.noteId = :noteId"),  | 
  |  51 |     | 
           @NamedQuery(name="KewNote.FindNoteByRouteHeaderId", query="select n from org.kuali.rice.kew.notes.Note as n where n.routeHeaderId = :routeHeaderId order by n.noteId")  | 
  |  52 |     | 
   })  | 
  |  53 |    0 |    public class Note implements Serializable { | 
  |  54 |     | 
     | 
  |  55 |     | 
           private static final long serialVersionUID = -6136544551121011531L;  | 
  |  56 |     | 
           @Id  | 
  |  57 |     | 
           @GeneratedValue(generator="KREW_DOC_NTE_S")  | 
  |  58 |     | 
           @GenericGenerator(name="KREW_DOC_NTE_S",strategy="org.hibernate.id.enhanced.SequenceStyleGenerator",parameters={ | 
  |  59 |     | 
                           @Parameter(name="sequence_name",value="KREW_DOC_NTE_S"),  | 
  |  60 |     | 
                           @Parameter(name="value_column",value="id")  | 
  |  61 |     | 
           })  | 
  |  62 |     | 
           @Column(name="DOC_NTE_ID")  | 
  |  63 |     | 
           private Long noteId;  | 
  |  64 |     | 
       @Column(name="DOC_HDR_ID")  | 
  |  65 |     | 
           private Long routeHeaderId;  | 
  |  66 |     | 
       @Column(name="AUTH_PRNCPL_ID")  | 
  |  67 |     | 
           private String noteAuthorWorkflowId;  | 
  |  68 |     | 
           @Column(name="CRT_DT")  | 
  |  69 |     | 
           private Timestamp noteCreateDate;  | 
  |  70 |     | 
       @Column(name="TXT")  | 
  |  71 |     | 
           private String noteText;  | 
  |  72 |     | 
       @Version  | 
  |  73 |     | 
           @Column(name="VER_NBR")  | 
  |  74 |     | 
           private Integer lockVerNbr;  | 
  |  75 |     | 
         | 
  |  76 |    0 |        @OneToMany(fetch=FetchType.EAGER, cascade={CascadeType.REMOVE, CascadeType.MERGE, CascadeType.PERSIST}, | 
  |  77 |     | 
               targetEntity=org.kuali.rice.kew.notes.Attachment.class, mappedBy="note")  | 
  |  78 |     | 
       @Fetch(value = FetchMode.SELECT)  | 
  |  79 |     | 
       private List<Attachment> attachments = new ArrayList<Attachment>();  | 
  |  80 |     | 
     | 
  |  81 |     | 
         | 
  |  82 |     | 
       @Transient  | 
  |  83 |     | 
       private String noteAuthorEmailAddress;  | 
  |  84 |     | 
       @Transient  | 
  |  85 |     | 
       private String noteAuthorNetworkId;  | 
  |  86 |     | 
       @Transient  | 
  |  87 |     | 
       private String noteAuthorFullName;  | 
  |  88 |     | 
       @Transient  | 
  |  89 |     | 
       private Long noteCreateLongDate;  | 
  |  90 |     | 
       @Transient  | 
  |  91 |     | 
       private Boolean authorizedToEdit;   | 
  |  92 |     | 
       @Transient  | 
  |  93 |     | 
       private Boolean editingNote;  | 
  |  94 |     | 
         | 
  |  95 |     | 
       public Integer getLockVerNbr() { | 
  |  96 |    0 |            return lockVerNbr;  | 
  |  97 |     | 
       }  | 
  |  98 |     | 
     | 
  |  99 |     | 
       public void setLockVerNbr(Integer lockVerNbr) { | 
  |  100 |    0 |            this.lockVerNbr = lockVerNbr;  | 
  |  101 |    0 |        }  | 
  |  102 |     | 
     | 
  |  103 |     | 
       public String getNoteAuthorWorkflowId() { | 
  |  104 |    0 |            return noteAuthorWorkflowId;  | 
  |  105 |     | 
       }  | 
  |  106 |     | 
     | 
  |  107 |     | 
       public void setNoteAuthorWorkflowId(String noteAuthorWorkflowId) { | 
  |  108 |    0 |            this.noteAuthorWorkflowId = noteAuthorWorkflowId;  | 
  |  109 |    0 |        }  | 
  |  110 |     | 
     | 
  |  111 |     | 
       public Timestamp getNoteCreateDate() { | 
  |  112 |    0 |            return noteCreateDate;  | 
  |  113 |     | 
       }  | 
  |  114 |     | 
     | 
  |  115 |     | 
       public void setNoteCreateDate(Timestamp noteCreateDate) { | 
  |  116 |    0 |            this.noteCreateDate = noteCreateDate;  | 
  |  117 |    0 |        }  | 
  |  118 |     | 
     | 
  |  119 |     | 
       public Long getNoteId() { | 
  |  120 |    0 |            return noteId;  | 
  |  121 |     | 
       }  | 
  |  122 |     | 
      | 
  |  123 |     | 
       public void setNoteId(Long noteId) { | 
  |  124 |    0 |            this.noteId = noteId;  | 
  |  125 |    0 |        }  | 
  |  126 |     | 
      | 
  |  127 |     | 
       public String getNoteText() { | 
  |  128 |    0 |            return noteText;  | 
  |  129 |     | 
       }  | 
  |  130 |     | 
     | 
  |  131 |     | 
       public void setNoteText(String noteText) { | 
  |  132 |    0 |            this.noteText = noteText;  | 
  |  133 |    0 |        }  | 
  |  134 |     | 
     | 
  |  135 |     | 
       public Long getRouteHeaderId() { | 
  |  136 |    0 |            return routeHeaderId;  | 
  |  137 |     | 
       }  | 
  |  138 |     | 
     | 
  |  139 |     | 
       public void setRouteHeaderId(Long routeHeaderId) { | 
  |  140 |    0 |            this.routeHeaderId = routeHeaderId;  | 
  |  141 |    0 |        }  | 
  |  142 |     | 
     | 
  |  143 |     | 
       public String getNoteAuthorEmailAddress() { | 
  |  144 |    0 |            return noteAuthorEmailAddress;  | 
  |  145 |     | 
       }  | 
  |  146 |     | 
      | 
  |  147 |     | 
       public void setNoteAuthorEmailAddress(String noteAuthorEmailAddress) { | 
  |  148 |    0 |            this.noteAuthorEmailAddress = noteAuthorEmailAddress;  | 
  |  149 |    0 |        }  | 
  |  150 |     | 
     | 
  |  151 |     | 
       public String getNoteAuthorFullName() { | 
  |  152 |    0 |            return noteAuthorFullName;  | 
  |  153 |     | 
       }  | 
  |  154 |     | 
     | 
  |  155 |     | 
       public void setNoteAuthorFullName(String noteAuthorFullName) { | 
  |  156 |    0 |            this.noteAuthorFullName = noteAuthorFullName;  | 
  |  157 |    0 |        }  | 
  |  158 |     | 
     | 
  |  159 |     | 
       public String getNoteAuthorNetworkId() { | 
  |  160 |    0 |            return noteAuthorNetworkId;  | 
  |  161 |     | 
       }  | 
  |  162 |     | 
     | 
  |  163 |     | 
       public void setNoteAuthorNetworkId(String noteAuthorNetworkId) { | 
  |  164 |    0 |            this.noteAuthorNetworkId = noteAuthorNetworkId;  | 
  |  165 |    0 |        }  | 
  |  166 |     | 
     | 
  |  167 |     | 
       public Long getNoteCreateLongDate() { | 
  |  168 |    0 |            return noteCreateLongDate;  | 
  |  169 |     | 
       }  | 
  |  170 |     | 
     | 
  |  171 |     | 
       public void setNoteCreateLongDate(Long noteCreateLongDate) { | 
  |  172 |    0 |            this.noteCreateLongDate = noteCreateLongDate;  | 
  |  173 |    0 |        }  | 
  |  174 |     | 
     | 
  |  175 |     | 
       public Boolean getAuthorizedToEdit() { | 
  |  176 |    0 |            return authorizedToEdit;  | 
  |  177 |     | 
       }  | 
  |  178 |     | 
     | 
  |  179 |     | 
       public void setAuthorizedToEdit(Boolean authorizedToEdit) { | 
  |  180 |    0 |            this.authorizedToEdit = authorizedToEdit;  | 
  |  181 |    0 |        }  | 
  |  182 |     | 
     | 
  |  183 |     | 
       public Boolean getEditingNote() { | 
  |  184 |    0 |            return editingNote;  | 
  |  185 |     | 
       }  | 
  |  186 |     | 
     | 
  |  187 |     | 
       public void setEditingNote(Boolean editingNote) { | 
  |  188 |    0 |            this.editingNote = editingNote;  | 
  |  189 |    0 |        }  | 
  |  190 |     | 
     | 
  |  191 |     | 
       public String getFormattedCreateDateTime() { | 
  |  192 |    0 |            long time = getNoteCreateDate().getTime();  | 
  |  193 |    0 |            Calendar calendar = Calendar.getInstance();  | 
  |  194 |    0 |            calendar.setTimeInMillis(time);  | 
  |  195 |    0 |            Date date = calendar.getTime();  | 
  |  196 |    0 |            DateFormat dateFormat = new SimpleDateFormat(KEWConstants.TIMESTAMP_DATE_FORMAT_PATTERN2);  | 
  |  197 |    0 |            return dateFormat.format(date);  | 
  |  198 |     | 
       }  | 
  |  199 |     | 
     | 
  |  200 |     | 
       public String getFormattedCreateDate() { | 
  |  201 |    0 |            long time = getNoteCreateDate().getTime();  | 
  |  202 |    0 |            Calendar calendar = Calendar.getInstance();  | 
  |  203 |    0 |            calendar.setTimeInMillis(time);  | 
  |  204 |    0 |            Date date = calendar.getTime();  | 
  |  205 |    0 |            DateFormat dateFormat = RiceConstants.getDefaultDateFormat();  | 
  |  206 |    0 |            return dateFormat.format(date);  | 
  |  207 |     | 
       }  | 
  |  208 |     | 
         | 
  |  209 |     | 
       public String getFormattedCreateTime() { | 
  |  210 |    0 |            long time = getNoteCreateDate().getTime();  | 
  |  211 |    0 |            Calendar calendar = Calendar.getInstance();  | 
  |  212 |    0 |            calendar.setTimeInMillis(time);  | 
  |  213 |    0 |            Date date = calendar.getTime();  | 
  |  214 |    0 |            DateFormat dateFormat = RiceConstants.getDefaultTimeFormat();  | 
  |  215 |    0 |            return dateFormat.format(date);  | 
  |  216 |     | 
       }  | 
  |  217 |     | 
     | 
  |  218 |     | 
           public List<Attachment> getAttachments() { | 
  |  219 |    0 |                    return attachments;  | 
  |  220 |     | 
           }  | 
  |  221 |     | 
     | 
  |  222 |     | 
           public void setAttachments(List<Attachment> attachments) { | 
  |  223 |    0 |                    this.attachments = attachments;  | 
  |  224 |    0 |            }  | 
  |  225 |     | 
             | 
  |  226 |     | 
             | 
  |  227 |     | 
           public void beforeInsert(){ | 
  |  228 |    0 |                    OrmUtils.populateAutoIncValue(this, KEWServiceLocator.getEntityManagerFactory().createEntityManager());  | 
  |  229 |    0 |            }  | 
  |  230 |     | 
             | 
  |  231 |     | 
     | 
  |  232 |     | 
   }  | 
  |  233 |     | 
     |