View Javadoc
1   package org.kuali.ole.alert.document;
2   
3   import org.kuali.ole.alert.bo.AlertBo;
4   import org.kuali.rice.krad.maintenance.Maintainable;
5   import org.kuali.rice.krad.maintenance.MaintenanceDocumentBase;
6   
7   import javax.persistence.Entity;
8   import javax.persistence.MappedSuperclass;
9   import javax.persistence.Table;
10  import javax.persistence.Transient;
11  import java.util.ArrayList;
12  import java.util.List;
13  
14  /**
15   * Created by maheswarang on 12/18/14.
16   */
17  @MappedSuperclass
18  @Entity
19  @Table(name = "KRNS_MAINT_DOC_T")
20  public class OleMaintenanceDocumentBase extends MaintenanceDocumentBase {
21      @Transient
22      public List<AlertBo> alertBoList = new ArrayList();
23  
24      public List<AlertBo> getAlertBoList() {
25          return alertBoList;
26      }
27  
28      public void setAlertBoList(List<AlertBo> alertBoList) {
29          this.alertBoList = alertBoList;
30      }
31  
32      public OleMaintenanceDocumentBase() {
33          super();
34          fieldsClearedOnCopy = false;
35          alertBoList=new ArrayList<>();
36      }
37  
38      public OleMaintenanceDocumentBase(String documentTypeName) {
39          this();
40          Class clazz = getDocumentDictionaryService().getMaintainableClass(documentTypeName);
41          try {
42              oldMaintainableObject = (Maintainable) clazz.newInstance();
43              newMaintainableObject = (Maintainable) clazz.newInstance();
44  
45              // initialize maintainable with a data object
46              Class<?> dataObjectClazz = getDocumentDictionaryService().getMaintenanceDataObjectClass(documentTypeName);
47              oldMaintainableObject.setDataObject(dataObjectClazz.newInstance());
48              oldMaintainableObject.setDataObjectClass(dataObjectClazz);
49              newMaintainableObject.setDataObject(dataObjectClazz.newInstance());
50              newMaintainableObject.setDataObjectClass(dataObjectClazz);
51          } catch (InstantiationException e) {
52             // LOG.error("Unable to initialize maintainables of type " + clazz.getName());
53              throw new RuntimeException("Unable to initialize maintainables of type " + clazz.getName());
54          } catch (IllegalAccessException e) {
55          //    LOG.error("Unable to initialize maintainables of type " + clazz.getName());
56              throw new RuntimeException("Unable to initialize maintainables of type " + clazz.getName());
57          }
58      }
59  }