use hibernate and breakup dbdao and papservlet
[policy/engine.git] / ONAP-REST / src / main / java / org / onap / policy / rest / jpa / PolicyVersion.java
index 6770463..f6512af 100644 (file)
@@ -2,14 +2,14 @@
  * ============LICENSE_START=======================================================
  * ONAP-REST
  * ================================================================================
- * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
+ * Copyright (C) 2017-2019 AT&T Intellectual Property. All rights reserved.
  * ================================================================================
  * Licensed under the Apache License, Version 2.0 (the "License");
  * you may not use this file except in compliance with the License.
  * You may obtain a copy of the License at
- * 
+ *
  *      http://www.apache.org/licenses/LICENSE-2.0
- * 
+ *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@@ -23,7 +23,6 @@ package org.onap.policy.rest.jpa;
 import java.io.Serializable;
 import java.util.Date;
 import java.util.Objects;
-
 import javax.persistence.Column;
 import javax.persistence.Entity;
 import javax.persistence.GeneratedValue;
@@ -68,23 +67,6 @@ public class PolicyVersion implements Serializable {
     @Column(name="created_date", nullable=false)
     private Date createdDate;
 
-
-    public int getActiveVersion() {
-        return activeVersion;
-    }
-
-    public void setActiveVersion(int activeVersion) {
-        this.activeVersion = activeVersion;
-    }
-
-    public int getHigherVersion() {
-        return higherVersion;
-    }
-
-    public void setHigherVersion(int higherVersion) {
-        this.higherVersion = higherVersion;
-    }
-
     @Column(name="CREATED_BY", nullable=false, length=45)
     private String createdBy;
 
@@ -96,6 +78,11 @@ public class PolicyVersion implements Serializable {
     @Column(name="modified_by", nullable=false, length=45)
     private String modifiedBy;
 
+    public PolicyVersion() {
+        this.modifiedDate = new Date();
+        this.createdDate = new Date();
+    }
+
     public PolicyVersion(String domain, String loginUserId) {
         this(domain);
         this.createdBy = loginUserId;
@@ -106,10 +93,23 @@ public class PolicyVersion implements Serializable {
         this.policyName = domain;
     }
 
-    public PolicyVersion(){
-        // Empty constructor
+    public int getActiveVersion() {
+        return activeVersion;
     }
 
+    public void setActiveVersion(int activeVersion) {
+        this.activeVersion = activeVersion;
+    }
+
+    public int getHigherVersion() {
+        return higherVersion;
+    }
+
+    public void setHigherVersion(int higherVersion) {
+        this.higherVersion = higherVersion;
+    }
+
+
     @PrePersist
     public void        prePersist() {
         Date date = new Date();