001/** 002 * Copyright 2005-2017 The Kuali Foundation 003 * 004 * Licensed under the Educational Community License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.opensource.org/licenses/ecl2.php 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016package org.kuali.rice.kew.impl.stuck; 017 018import org.kuali.rice.krad.data.jpa.PortableSequenceGenerator; 019 020import javax.persistence.Column; 021import javax.persistence.Entity; 022import javax.persistence.EnumType; 023import javax.persistence.Enumerated; 024import javax.persistence.GeneratedValue; 025import javax.persistence.Id; 026import javax.persistence.NamedQueries; 027import javax.persistence.NamedQuery; 028import javax.persistence.Table; 029import java.sql.Timestamp; 030 031/** 032 * @author Eric Westfall 033 */ 034@Entity 035@Table(name = "KREW_STUCK_DOC_INCIDENT_T") 036public class StuckDocumentIncident { 037 038 public static StuckDocumentIncident startNewIncident(String documentId) { 039 StuckDocumentIncident incident = new StuckDocumentIncident(); 040 incident.setDocumentId(documentId); 041 incident.setStartDate(new Timestamp(System.currentTimeMillis())); 042 incident.setStatus(Status.PENDING); 043 return incident; 044 } 045 046 @Id 047 @GeneratedValue(generator = "KREW_STUCK_DOC_INCIDENT_S") 048 @PortableSequenceGenerator(name = "KREW_STUCK_DOC_INCIDENT_S") 049 @Column(name = "STUCK_DOC_INCIDENT_ID", nullable = false) 050 private String stuckDocumentIncidentId; 051 052 @Column(name = "DOC_HDR_ID", nullable = false) 053 private String documentId; 054 055 @Column(name = "START_DT", nullable = false) 056 private Timestamp startDate; 057 058 @Column(name = "END_DT") 059 private Timestamp endDate; 060 061 @Enumerated(EnumType.STRING) 062 @Column(name = "STATUS", nullable = false) 063 private Status status; 064 065 public String getStuckDocumentIncidentId() { 066 return stuckDocumentIncidentId; 067 } 068 069 public void setStuckDocumentIncidentId(String stuckDocumentIncidentId) { 070 this.stuckDocumentIncidentId = stuckDocumentIncidentId; 071 } 072 073 public String getDocumentId() { 074 return documentId; 075 } 076 077 public void setDocumentId(String documentId) { 078 this.documentId = documentId; 079 } 080 081 public Timestamp getStartDate() { 082 return startDate; 083 } 084 085 public void setStartDate(Timestamp startDate) { 086 this.startDate = startDate; 087 } 088 089 public Timestamp getEndDate() { 090 return endDate; 091 } 092 093 public void setEndDate(Timestamp endDate) { 094 this.endDate = endDate; 095 } 096 097 public Status getStatus() { 098 return status; 099 } 100 101 public void setStatus(Status status) { 102 this.status = status; 103 } 104 105 public static enum Status { 106 PENDING, FIXING, FAILED, FIXED 107 } 108 109}