diff options
author | pa834y <pa834y@att.com> | 2019-03-11 10:34:22 -0400 |
---|---|---|
committer | pa834y <pa834y@att.com> | 2019-03-20 15:30:20 -0400 |
commit | 2903daf20f5e473a96a36342151a26e9f2e55005 (patch) | |
tree | e6da180b8eda43c4f20c05121e265b403fdb1b4a /ONAP-REST/src/main/java/org | |
parent | d71b3cf8a983a95fced20eed0cb09aea84aa1b3c (diff) |
use hibernate and breakup dbdao and papservlet
Change-Id: Ifa655d56bda0ab4c748f188767122e7bd927155b
Issue-ID: POLICY-1417
Signed-off-by: pa834y <pa834y@att.com>
Diffstat (limited to 'ONAP-REST/src/main/java/org')
10 files changed, 91 insertions, 70 deletions
diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java index 94838b4b5..cd2ea591d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopD2Services.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017-2018 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. @@ -20,11 +20,10 @@ package org.onap.policy.rest.jpa; /* - * + * */ import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -75,6 +74,11 @@ public class ClosedLoopD2Services implements Serializable{ @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public ClosedLoopD2Services() { + this.setModifiedDate(new Date()); + } + + public UserInfo getUserCreatedBy() { return userCreatedBy; } @@ -91,10 +95,6 @@ public class ClosedLoopD2Services implements Serializable{ this.userModifiedBy = userModifiedBy; } - public ClosedLoopD2Services(){ - //An empty constructor - } - @PrePersist public void prePersist() { Date date = new Date(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java index e81f6123b..52b5a2a4a 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/ClosedLoopSite.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017-2018 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. @@ -21,11 +21,10 @@ package org.onap.policy.rest.jpa; /* - * + * */ import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -77,6 +76,11 @@ public class ClosedLoopSite implements Serializable{ @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public ClosedLoopSite() { + this.setModifiedDate(new Date()); + } + + public UserInfo getUserCreatedBy() { return userCreatedBy; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java index e43135854..9b0ea0d7f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/GroupEntity.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. @@ -18,15 +18,16 @@ * ============LICENSE_END========================================================= */ package org.onap.policy.rest.jpa; +import com.fasterxml.jackson.annotation.JsonManagedReference; /* */ import java.io.Serializable; import java.util.Date; import java.util.List; - import javax.persistence.CascadeType; import javax.persistence.Column; import javax.persistence.Entity; +import javax.persistence.FetchType; import javax.persistence.GeneratedValue; import javax.persistence.GenerationType; import javax.persistence.Id; @@ -42,8 +43,6 @@ import javax.persistence.Temporal; import javax.persistence.TemporalType; import javax.persistence.Version; -import com.fasterxml.jackson.annotation.JsonManagedReference; - /* * The Entity class to persist a policy object and its configuration data */ @@ -78,7 +77,7 @@ public class GroupEntity implements Serializable { @Column(name="version") private int version; - @ManyToMany(cascade = CascadeType.ALL) + @ManyToMany(fetch = FetchType.EAGER, cascade = CascadeType.ALL) @JoinTable(name="PolicyGroupEntity",joinColumns={@JoinColumn(name="groupKey")}, inverseJoinColumns={@JoinColumn(name="policyId")}) @JsonManagedReference private List<PolicyEntity> policies; diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java index 3abc01267..f9413b860 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PEPOptions.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017-2018 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. @@ -20,11 +20,10 @@ package org.onap.policy.rest.jpa; /* - * + * * */ import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -78,6 +77,10 @@ public class PEPOptions implements Serializable { @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public PEPOptions() { + this.modifiedDate = new Date(); + } + public UserInfo getUserCreatedBy() { return userCreatedBy; } @@ -94,7 +97,6 @@ public class PEPOptions implements Serializable { this.userModifiedBy = userModifiedBy; } - @PrePersist public void prePersist() { Date date = new Date(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java index 1bfa46bf9..62fd0266e 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/PolicyEditorScopes.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017-2018 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. @@ -22,7 +22,6 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -69,6 +68,10 @@ public class PolicyEditorScopes implements Serializable{ @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public PolicyEditorScopes() { + this.modifiedDate = new Date(); + } + @PrePersist public void prePersist() { Date date = new Date(); 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(); diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java index 95d2ae5de..a87cf2a6b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/TermList.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017-2018 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. @@ -22,7 +22,6 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -100,6 +99,10 @@ public class TermList implements Serializable { @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public TermList() { + this.modifiedDate = new Date(); + } + public Date getCreatedDate() { return this.createdDate; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java index bf4284a1d..3d7c7f67b 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VNFType.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017-2018 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. @@ -22,7 +22,6 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -74,6 +73,10 @@ public class VNFType implements Serializable { @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public VNFType() { + this.modifiedDate = new Date(); + } + public UserInfo getUserCreatedBy() { return userCreatedBy; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java index cd0c46da7..e5aac971d 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VSCLAction.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017-2018 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. @@ -22,7 +22,6 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -73,6 +72,10 @@ public class VSCLAction implements Serializable { @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public VSCLAction() { + this.setModifiedDate(new Date()); + } + public UserInfo getUserCreatedBy() { return userCreatedBy; } diff --git a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java index b123511f3..aee187e6f 100644 --- a/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java +++ b/ONAP-REST/src/main/java/org/onap/policy/rest/jpa/VarbindDictionary.java @@ -2,14 +2,14 @@ * ============LICENSE_START======================================================= * ONAP-REST * ================================================================================ - * Copyright (C) 2017-2018 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. @@ -22,7 +22,6 @@ package org.onap.policy.rest.jpa; import java.io.Serializable; import java.util.Date; - import javax.persistence.Column; import javax.persistence.Entity; import javax.persistence.GeneratedValue; @@ -75,6 +74,11 @@ public class VarbindDictionary implements Serializable{ @JoinColumn(name="modified_by") private UserInfo userModifiedBy; + public VarbindDictionary() { + this.setModifiedDate(new Date()); + } + + public UserInfo getUserCreatedBy() { return userCreatedBy; } |