diff options
Diffstat (limited to 'cmso-service/src/main/java/org')
17 files changed, 279 insertions, 92 deletions
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/Application.java b/cmso-service/src/main/java/org/onap/optf/cmso/Application.java index 7327124..f0580bd 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/Application.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/Application.java @@ -97,6 +97,7 @@ public class Application extends SpringBootServletInitializer { TomcatServletWebServerFactory tomcat = new TomcatServletWebServerFactory();
int port = Integer.parseInt(dispatchPort);
tomcat.addAdditionalTomcatConnectors(createStandardConnector(port));
+ org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter ss = null;
return tomcat;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ApplicationPropertiesFiles.java b/cmso-service/src/main/java/org/onap/optf/cmso/ApplicationPropertiesFiles.java new file mode 100644 index 0000000..912a6e1 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/ApplicationPropertiesFiles.java @@ -0,0 +1,46 @@ +/* + * Copyright © 2018 AT&T Intellectual Property. + * Modifications Copyright © 2018 IBM. + * + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ +package org.onap.optf.cmso; + +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.PropertySource; +import org.springframework.context.annotation.PropertySources; + + +@Configuration +@PropertySources({ + @PropertySource("file:etc/config/cmso.properties"), + @PropertySource("file:etc/config/optimizer.properties"), + @PropertySource("file:etc/config/ticketmgt.properties"), +}) +public class ApplicationPropertiesFiles +{ +}
\ No newline at end of file diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/AuthProvider.java b/cmso-service/src/main/java/org/onap/optf/cmso/AuthProvider.java new file mode 100644 index 0000000..e002b7d --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/AuthProvider.java @@ -0,0 +1,66 @@ +/* + * Copyright © 2018 AT&T Intellectual Property. + * Modifications Copyright © 2018 IBM. + * + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ +package org.onap.optf.cmso; + +import java.util.ArrayList; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.core.env.Environment; +import org.springframework.security.authentication.AuthenticationProvider; +import org.springframework.security.authentication.UsernamePasswordAuthenticationToken; +import org.springframework.security.core.Authentication; +import org.springframework.security.core.AuthenticationException; +import org.springframework.stereotype.Component; + +@Component +public class AuthProvider + implements AuthenticationProvider { + + @Autowired + Environment env; + + @Override + public Authentication authenticate(Authentication authentication) + throws AuthenticationException { + org.springframework.security.web.authentication.www.BasicAuthenticationFilter f = null; + String name = authentication.getName(); + String password = authentication.getCredentials().toString(); + //TODO check credentials until we enable AAF + return new UsernamePasswordAuthenticationToken( + name, password, new ArrayList<>()); + } + + @Override + public boolean supports(Class<?> authentication) { + return authentication.equals( + UsernamePasswordAuthenticationToken.class); + } +} diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java b/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java index d1ccb7e..e5aca31 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/CMSEnvironmentPostProcessor.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -41,7 +41,8 @@ import org.springframework.core.env.MapPropertySource; import org.springframework.core.env.MutablePropertySources;
public class CMSEnvironmentPostProcessor implements EnvironmentPostProcessor {
-
+ // TODO tested in ONAP springboot and this is called before all of the properties files have been loaded...
+ // perhaps there is a post post processor? Until this works. DB password will be in the clear in the proeprties files.
@Override
public void postProcessEnvironment(ConfigurableEnvironment environment, SpringApplication application) {
String pwd = environment.getProperty("cmso.database.password");
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/SecurityConfig.java b/cmso-service/src/main/java/org/onap/optf/cmso/SecurityConfig.java new file mode 100644 index 0000000..a4802d2 --- /dev/null +++ b/cmso-service/src/main/java/org/onap/optf/cmso/SecurityConfig.java @@ -0,0 +1,61 @@ +/* + * Copyright © 2018 AT&T Intellectual Property. + * Modifications Copyright © 2018 IBM. + * + * 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. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * + * Unless otherwise specified, all documentation contained herein is licensed + * under the Creative Commons License, Attribution 4.0 Intl. (the "License"); + * you may not use this documentation except in compliance with the License. + * You may obtain a copy of the License at + * + * https://creativecommons.org/licenses/by/4.0/ + * + * Unless required by applicable law or agreed to in writing, documentation + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. +*/ +package org.onap.optf.cmso; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder; +import org.springframework.security.config.annotation.web.builders.HttpSecurity; +import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity; +import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter; + +@Configuration +@EnableWebSecurity +@ComponentScan("org.onap.optf") +public class SecurityConfig extends WebSecurityConfigurerAdapter { + + @Autowired + private AuthProvider authProvider; + + @Override + protected void configure(AuthenticationManagerBuilder auth) throws Exception { + + auth.authenticationProvider(authProvider); + } + + @Override + protected void configure(HttpSecurity http) throws Exception { + + http.csrf().disable().authorizeRequests().anyRequest().authenticated().and().httpBasic(); + + } +}
\ No newline at end of file diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java index d4ab593..121774b 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ApprovalType.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import java.io.Serializable; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@@ -50,11 +51,11 @@ public class ApprovalType implements Serializable { private static final long serialVersionUID = 1L;
@Id
- @GeneratedValue
- private int id;
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ private Integer id;
@Column(name = "approval_count")
- private int approvalCount;
+ private Integer approvalCount;
@Column(name = "approval_type")
private String approvalType;
@@ -65,19 +66,19 @@ public class ApprovalType implements Serializable { public ApprovalType() {}
- public int getId() {
+ public Integer getId() {
return this.id;
}
- public void setId(int id) {
+ public void setId(Integer id) {
this.id = id;
}
- public int getApprovalCount() {
+ public Integer getApprovalCount() {
return this.approvalCount;
}
- public void setApprovalCount(int approvalCount) {
+ public void setApprovalCount(Integer approvalCount) {
this.approvalCount = approvalCount;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java index ceece9a..7224508 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementChangeWindow.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import java.io.Serializable; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@@ -58,8 +59,8 @@ public class ChangeManagementChangeWindow implements Serializable { @JsonIgnore
@Id
- @GeneratedValue
- private int id;
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ private Integer id;
@JsonIgnore
@Column(name = "finish_time")
@@ -81,15 +82,15 @@ public class ChangeManagementChangeWindow implements Serializable { @JsonIgnore
@Column(name = "change_management_groups_id")
- private int changeManagementGroupsId;
+ private Integer changeManagementGroupsId;
public ChangeManagementChangeWindow() {}
- public int getId() {
+ public Integer getId() {
return this.id;
}
- public void setId(int id) {
+ public void setId(Integer id) {
this.id = id;
}
@@ -109,11 +110,11 @@ public class ChangeManagementChangeWindow implements Serializable { public void setStartTime(String startTime) {}
- public int getChangeManagementGroupsId() {
+ public Integer getChangeManagementGroupsId() {
return changeManagementGroupsId;
}
- public void setChangeManagementGroupsId(int changeManagementGroupsId) {
+ public void setChangeManagementGroupsId(Integer changeManagementGroupsId) {
this.changeManagementGroupsId = changeManagementGroupsId;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java index 3b82c62..31c4a2b 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementDetail.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ package org.onap.optf.cmso.model; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Transient;
@@ -58,8 +59,8 @@ import io.swagger.annotations.ApiModelProperty; public class ChangeManagementDetail {
@Id
@JsonIgnore
- @GeneratedValue
- private int id;
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ private Integer id;
@ApiModelProperty(value = "Name of the VNF.")
@Column(name = "vnf_name")
@@ -167,7 +168,7 @@ public class ChangeManagementDetail { private String msoTime;
@JsonIgnore
- private int schedules_id;
+ private Integer schedules_id;
public String getVnfName() {
return vnfName;
@@ -241,11 +242,11 @@ public class ChangeManagementDetail { this.policyId = policyId;
}
- public int getSchedulesId() {
+ public Integer getSchedulesId() {
return schedules_id;
}
- public void setSchedulesId(int schedules_id) {
+ public void setSchedulesId(Integer schedules_id) {
this.schedules_id = schedules_id;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java index 0664851..6aeb325 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementGroup.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -36,6 +36,7 @@ import java.util.List; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@@ -59,8 +60,8 @@ public class ChangeManagementGroup implements Serializable { @JsonIgnore
@Id
- @GeneratedValue
- private int id;
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ private Integer id;
@JsonIgnore
@Column(name = "finish_time")
@@ -95,19 +96,19 @@ public class ChangeManagementGroup implements Serializable { @JsonIgnore
@Column(name = "schedules_id")
- private int schedulesId;
+ private Integer schedulesId;
@Column(name = "additional_duration_in_secs")
@ApiModelProperty(value = "Time added to the workflow interval to allow for rollback in case of failure.")
- private int additionalDurationInSecs;
+ private Integer additionalDurationInSecs;
@ApiModelProperty(value = "The maximum number of workflows that should be started simultaneiously.")
@Column(name = "concurrency_limit")
- private int concurrencyLimit;
+ private Integer concurrencyLimit;
@ApiModelProperty(value = "Expected duration of a successful workflow execution.")
@Column(name = "normal_duration_in_secs")
- private int normalDurationInSecs;
+ private Integer normalDurationInSecs;
@ApiModelProperty(
value = "The name of the schedule optimization policy used by the change management schedule optimizer.")
@@ -121,11 +122,11 @@ public class ChangeManagementGroup implements Serializable { public ChangeManagementGroup() {}
- public int getId() {
+ public Integer getId() {
return this.id;
}
- public void setId(int id) {
+ public void setId(Integer id) {
this.id = id;
}
@@ -161,35 +162,35 @@ public class ChangeManagementGroup implements Serializable { public void setStartTime(String startTime) {}
- public int getSchedulesId() {
+ public Integer getSchedulesId() {
return schedulesId;
}
- public void setSchedulesId(int schedulesId) {
+ public void setSchedulesId(Integer schedulesId) {
this.schedulesId = schedulesId;
}
- public int getAdditionalDurationInSecs() {
+ public Integer getAdditionalDurationInSecs() {
return additionalDurationInSecs;
}
- public void setAdditionalDurationInSecs(int additionalDurationInSecs) {
+ public void setAdditionalDurationInSecs(Integer additionalDurationInSecs) {
this.additionalDurationInSecs = additionalDurationInSecs;
}
- public int getConcurrencyLimit() {
+ public Integer getConcurrencyLimit() {
return concurrencyLimit;
}
- public void setConcurrencyLimit(int concurrencyLimit) {
+ public void setConcurrencyLimit(Integer concurrencyLimit) {
this.concurrencyLimit = concurrencyLimit;
}
- public int getNormalDurationInSecs() {
+ public Integer getNormalDurationInSecs() {
return normalDurationInSecs;
}
- public void setNormalDurationInSecs(int normalDurationInSecs) {
+ public void setNormalDurationInSecs(Integer normalDurationInSecs) {
this.normalDurationInSecs = normalDurationInSecs;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java index 779e8ca..9690290 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ChangeManagementSchedule.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import java.io.Serializable; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
@@ -60,7 +61,7 @@ public class ChangeManagementSchedule implements Serializable { @JsonIgnore
@Id
- @GeneratedValue
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
private Integer id;
@ApiModelProperty(value = "TM Change Id")
@@ -108,7 +109,7 @@ public class ChangeManagementSchedule implements Serializable { @Column(name = "change_management_groups_id")
@JsonIgnore
- private int changeManagementGroupsId;
+ private Integer changeManagementGroupsId;
@JsonIgnore
@Column(name = "dispatch_time")
@@ -161,11 +162,11 @@ public class ChangeManagementSchedule implements Serializable { public ChangeManagementSchedule() {}
- public int getId() {
+ public Integer getId() {
return this.id;
}
- public void setId(int id) {
+ public void setId(Integer id) {
this.id = id;
}
@@ -217,11 +218,11 @@ public class ChangeManagementSchedule implements Serializable { this.tmChangeId = tmChangeId;
}
- public int getChangeManagementGroupsId() {
+ public Integer getChangeManagementGroupsId() {
return changeManagementGroupsId;
}
- public void setChangeManagementGroupsId(int changeManagementGroupsId) {
+ public void setChangeManagementGroupsId(Integer changeManagementGroupsId) {
this.changeManagementGroupsId = changeManagementGroupsId;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java index f32ff98..fc86964 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/DomainData.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,7 @@ package org.onap.optf.cmso.model; import java.io.Serializable;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@@ -55,8 +56,8 @@ public class DomainData implements Serializable { @JsonIgnore
@Id
- @GeneratedValue
- private int id;
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ private Integer id;
private String name;
@@ -69,11 +70,11 @@ public class DomainData implements Serializable { public DomainData() {}
- public int getId() {
+ public Integer getId() {
return this.id;
}
- public void setId(int id) {
+ public void setId(Integer id) {
this.id = id;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java index 3a13563..d6fe4f9 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/Schedule.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -38,6 +38,7 @@ import javax.persistence.CascadeType; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
@@ -63,8 +64,8 @@ public class Schedule implements Serializable { @JsonIgnore
@Id
- @GeneratedValue
- private int id;
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ private Integer id;
@JsonIgnore
@Column(name = "create_date_time")
@@ -93,7 +94,7 @@ public class Schedule implements Serializable { @JsonIgnore
@Column(name = "optimizer_attempts_to_schedule")
- private int optimizerAttemptsToSchedule;
+ private Integer optimizerAttemptsToSchedule;
@JsonIgnore
@Column(name = "optimizer_return_date_time")
@@ -159,11 +160,11 @@ public class Schedule implements Serializable { public Schedule() {}
- public int getId() {
+ public Integer getId() {
return this.id;
}
- public void setId(int id) {
+ public void setId(Integer id) {
this.id = id;
}
@@ -307,11 +308,11 @@ public class Schedule implements Serializable { return sa;
}
- public int getOptimizerAttemptsToSchedule() {
+ public Integer getOptimizerAttemptsToSchedule() {
return optimizerAttemptsToSchedule;
}
- public void setOptimizerAttemptsToSchedule(int optimizerAttemptsToSchedule) {
+ public void setOptimizerAttemptsToSchedule(Integer optimizerAttemptsToSchedule) {
this.optimizerAttemptsToSchedule = optimizerAttemptsToSchedule;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java index adfafd1..dee3c42 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleApproval.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -35,6 +35,7 @@ import java.io.Serializable; import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
@@ -59,9 +60,9 @@ public class ScheduleApproval implements Serializable { private static final long serialVersionUID = 1L;
@Id
- @GeneratedValue
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
@JsonIgnore
- private int id;
+ private Integer id;
@JsonIgnore
@Column(name = "approval_date_time")
@@ -91,11 +92,11 @@ public class ScheduleApproval implements Serializable { public ScheduleApproval() {}
- public int getId() {
+ public Integer getId() {
return this.id;
}
- public void setId(int id) {
+ public void setId(Integer id) {
this.id = id;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java index 97a96f0..46cb46e 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/model/ScheduleEvent.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -34,6 +34,8 @@ package org.onap.optf.cmso.model; import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.Entity;
+import javax.persistence.GeneratedValue;
+import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.NamedQuery;
@@ -54,7 +56,8 @@ public class ScheduleEvent implements Serializable { private static final long serialVersionUID = 1L;
@Id
- private int id;
+ @GeneratedValue(strategy=GenerationType.IDENTITY)
+ private Integer id;
private String domain;
@@ -79,17 +82,17 @@ public class ScheduleEvent implements Serializable { private String reminderTime;
@Column(name = "schedules_id")
- private int schedulesId;
+ private Integer schedulesId;
private String status;
public ScheduleEvent() {}
- public int getId() {
+ public Integer getId() {
return this.id;
}
- public void setId(int id) {
+ public void setId(Integer id) {
this.id = id;
}
@@ -109,11 +112,11 @@ public class ScheduleEvent implements Serializable { this.eventText = eventText;
}
- public int getSchedulesId() {
+ public Integer getSchedulesId() {
return this.schedulesId;
}
- public void setSchedulesId(int schedulesId) {
+ public void setSchedulesId(Integer schedulesId) {
this.schedulesId = schedulesId;
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java index 8dbafbc..2e0cfeb 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/BaseSchedulerServiceImpl.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -91,6 +91,7 @@ public class BaseSchedulerServiceImpl { // are 1<=>1 at this
// point.
s.setScheduleName(scheduleMessage.getScheduleName());
+ s.setOptimizerAttemptsToSchedule(0);
s.setScheduleInfo(scheduleMessage.getSchedulingInfo().toString());
s.setStatus(CMSStatusEnum.PendingSchedule.toString());
scheduleDAO.save(s);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java index f994dc8..a3a4ae8 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/HealthCheckImpl.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -80,8 +80,8 @@ public class HealthCheckImpl implements HealthCheck { if (checkInterfaces) {
addToHealthCheckMessage(hc, tmClient.healthCheck());
- addToHealthCheckMessage(hc, sniroClient.healthCheck());
addToHealthCheckMessage(hc, msoStatusClient.healthCheck());
+ addToHealthCheckMessage(hc, sniroClient.healthCheck());
}
addToHealthCheckMessage(hc, this.healthCheck());
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java index 42f282a..8cbe459 100644 --- a/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java +++ b/cmso-service/src/main/java/org/onap/optf/cmso/sostatus/MsoStatusClient.java @@ -1,6 +1,6 @@ /*
- * Copyright © 2017-2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
+ * Copyright © 2017-2018 AT&T Intellectual Property.
+ * Modifications Copyright © 2018 IBM.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -247,8 +247,8 @@ public class MsoStatusClient { public HealthCheckComponent healthCheck() {
Map<String, String> mdcSave = Mdc.save();
String requestId = "healthCheck";
- String url = env.getProperty("so.url");
- String user = env.getProperty("so.user");
+ String url = env.getProperty("so.url", "");
+ String user = env.getProperty("so.user", "");
String pass = pm.getProperty("so.pass", "");
if (!url.endsWith("/"))
url = url + "/";
|