X-Git-Url: https://gerrit.onap.org/r/gitweb?a=blobdiff_plain;f=ONAP-REST%2Fsrc%2Fmain%2Fjava%2Forg%2Fonap%2Fpolicy%2Frest%2Fjpa%2FPolicyVersion.java;h=f6512af88916e2314385be20c0d752c7bb3290dd;hb=0c20d1c294fe146e1018f14b07a8d861c29fe527;hp=677046326d455800e2becab6c981cee6dea25ac9;hpb=023280727ac52e777b4128d726e212c9e8abd435;p=policy%2Fengine.git diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java index 677046326..f6512af88 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyVersion.java @@ -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();