aboutsummaryrefslogtreecommitdiffstats
path: root/cmso-service/src/main
diff options
context:
space:
mode:
Diffstat (limited to 'cmso-service/src/main')
-rwxr-xr-xcmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java2
-rwxr-xr-xcmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java6
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java9
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java4
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java3
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java25
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java10
-rw-r--r--cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java15
11 files changed, 28 insertions, 58 deletions
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java
index c34e4b0..332ca73 100755
--- a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafAuthProvider.java
@@ -55,7 +55,7 @@ public class AafAuthProvider implements AuthenticationProvider {
AafClientCache clientCache;
@Override
- public Authentication authenticate(Authentication authentication) throws AuthenticationException {
+ public Authentication authenticate(Authentication authentication) {
String name = authentication.getName();
String password = authentication.getCredentials().toString();
String sessionId = null;
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java
index d324f18..b8e7f5b 100755
--- a/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/aaf/AafPerm.java
@@ -90,9 +90,9 @@ public class AafPerm {
*/
public boolean ok(AafPerm userPerm) {
if (type.equals(userPerm.getType())) {
- if (userPerm.getInstance().equals("*") || instance.equals("*") || userPerm.getInstance().equals(instance)) {
+ if ("*".equals(userPerm.getInstance()) || "*".equals(instance) || userPerm.getInstance().equals(instance)) {
for (String userAction : userPerm.getActions()) {
- if (userAction.equals("*") || actions.contains("*") || actions.contains(userAction)) {
+ if ("*".equals(userAction) || actions.contains("*") || actions.contains(userAction)) {
return true;
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java
index c31c275..f6197a3 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/CmsoClient.java
@@ -163,8 +163,7 @@ public class CmsoClient {
}
}
- private void processScheduleResponse(ChangeManagementSchedule cmSchedule, Schedule schedule, Response response)
- throws SchedulerException {
+ private void processScheduleResponse(ChangeManagementSchedule cmSchedule, Schedule schedule, Response response) {
WfChangeManagementResponse resp = response.readEntity(WfChangeManagementResponse.class);
for (WfVidCmResponse cmResponse : resp.getCmResponses()) {
if (cmResponse.getVnfName().equals(cmSchedule.getVnfName())) {
@@ -182,8 +181,7 @@ public class CmsoClient {
updateScheduleStatus(cmSchedule, schedule);
}
- private void processScheduleResponse200(ChangeManagementSchedule cmSchedule, Schedule schedule, Response response)
- throws SchedulerException {
+ private void processScheduleResponse200(ChangeManagementSchedule cmSchedule, Schedule schedule, Response response){
JsonNode node = response.readEntity(JsonNode.class);
log.info("Message returned from VID callback: " + node.toString());
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
index ccbc430..f663240 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/DispatchJob.java
@@ -140,10 +140,8 @@ public class DispatchJob {
// Validate ticket is still active with tm
//
// TODO
- if (cmSchedule.getTmChangeId() != null && !cmSchedule.getTmChangeId().equals("")) {
- if (!isChangeApproved(schedule, cmSchedule, scheduleImmediateEnabled)) {
+ if (cmSchedule.getTmChangeId() != null && !cmSchedule.getTmChangeId().equals("") && !isChangeApproved(schedule, cmSchedule, scheduleImmediateEnabled)) {
return false;
- }
}
// *******************************************************************
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
index 84ff91e..d8fd7c3 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/dispatcher/rs/DispatcherServiceImpl.java
@@ -75,8 +75,7 @@ public class DispatcherServiceImpl implements DispacherService {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
}
- Response response = Response.ok().build();
- return response;
+ return Response.ok().build();
}
@Override
@@ -105,8 +104,7 @@ public class DispatcherServiceImpl implements DispacherService {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
}
- Response response = Response.ok().build();
- return response;
+ return Response.ok().build();
}
@Override
@@ -119,8 +117,7 @@ public class DispatcherServiceImpl implements DispacherService {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
debug.error(e.getMessage(), e);
}
- Response response = Response.ok().build();
- return response;
+ return Response.ok().build();
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java b/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java
index d43c60b..804fe68 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/filters/CmsoClientFilters.java
@@ -72,10 +72,8 @@ public class CmsoClientFilters implements ClientRequestFilter, ClientResponseFil
String transactionId = (String) headers.getFirst(MessageHeaders.HeadersEnum.TransactionID.toString());
String mdcId = MDC.get(MDC_KEY_REQUEST_ID);
- if (transactionId == null || transactionId.equals("")) {
- if (mdcId != null) {
+ if ((transactionId == null || "".equals(transactionId)) && (mdcId != null)) {
headers.add(HeadersEnum.TransactionID.toString(), mdcId);
- }
}
headers.add(HeadersEnum.FromAppID.toString(), appId);
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java b/cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java
index d671768..7aba1a2 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/filters/MessageHeaders.java
@@ -69,7 +69,7 @@ public class MessageHeaders {
}
/** The Constant supportedMajorVersions. */
- private static final Map<String, String> supportedMajorVersions = new HashMap<String, String>();
+ private static final Map<String, String> supportedMajorVersions = new HashMap<>();
static {
supportedMajorVersions.put("v1", "0");
@@ -77,7 +77,7 @@ public class MessageHeaders {
}
/** The Constant supportedMajorMinorVersions. */
- private static final Set<String> supportedMajorMinorVersions = new HashSet<String>();
+ private static final Set<String> supportedMajorMinorVersions = new HashSet<>();
static {
supportedMajorMinorVersions.add("v1.0");
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java
index fa182b4..79ceb44 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/AdminToolImpl.java
@@ -62,8 +62,7 @@ public class AdminToolImpl implements AdminTool {
return Response.ok("").build();
}
String encrypted = PropertiesManagement.getEncryptedValue(id);
- Response response = Response.ok(encrypted).build();
- return response;
+ return Response.ok(encrypted).build();
}
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
index 1e4a46a..0d81377 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/service/rs/CmQueryParameters.java
@@ -120,8 +120,8 @@ public class CmQueryParameters {
private static String formatString(String urlName, List<String> values, QueryColumns qc) {
StringBuilder clause = new StringBuilder();
- List<String> likes = new ArrayList<String>();
- List<String> in = new ArrayList<String>();
+ List<String> likes = new ArrayList<>();
+ List<String> in = new ArrayList<>();
for (String value : values) {
if (value.contains("%")) {
likes.add(value);
@@ -170,7 +170,7 @@ public class CmQueryParameters {
}
private static String formatDate(String urlName, List<String> values, QueryColumns qc) throws CmsoException {
- List<String> clauses = new ArrayList<String>();
+ List<String> clauses = new ArrayList<>();
for (String value : values) {
String[] dates = value.split(",");
switch (dates.length) {
@@ -224,27 +224,12 @@ public class CmQueryParameters {
private static DateTime convertDate(String utcDate, String urlName) throws CmsoException {
try {
- DateTime dateTime = ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
- return dateTime;
+ return ISODateTimeFormat.dateTimeParser().parseDateTime(utcDate);
}
catch (Exception e) {
throw new CmsoException(Status.BAD_REQUEST, LogMessages.INVALID_DATE_FILTER, urlName, utcDate);
}
}
- // public static void main(String argv[])
- // {
- // List<String> values = new ArrayList<String>();
- // values.add("2017-07-08T11:12:13Z,2017-07-08T11:12:13Z");
- // values.add("2017-07-09T11:12:13Z,2017-07-09T11:12:13Z");
- // values.add(",2017-07-09T11:12:13Z");
- // values.add(" 2017-07-09T11:12:13Z");
- // try {
- // System.out.println(buildClause("request.createDateTime", values));
- // } catch (SchedulerException e) {
- // // TODO Auto-generated catch block
- // e.printStackTrace();
- // }
- //
- // }
+
}
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java
index 1864da7..b2b4479 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/TmClient.java
@@ -234,7 +234,7 @@ public class TmClient {
}
}
- Map<String, Object> variables = new HashMap<String, Object>();
+ Map<String, Object> variables = new HashMap<>();
variables.put(Variables.status.toString(), "Closed");
variables.put(Variables.requesterId.toString(), requesterId);
@@ -248,7 +248,7 @@ public class TmClient {
private Map<String, Object> getCancelVariables(Schedule schedule, String changeId) {
String requesterId = schedule.getUserId();
- Map<String, Object> variables = new HashMap<String, Object>();
+ Map<String, Object> variables = new HashMap<>();
if (requesterId.length() > Variables.requesterId.getMaxLength()) {
requesterId = requesterId.substring(0, Variables.requesterId.getMaxLength());
}
@@ -259,7 +259,7 @@ public class TmClient {
private Map<String, Object> getUpdateVariables(Schedule schedule, String changeId) {
String requesterId = schedule.getUserId();
- Map<String, Object> variables = new HashMap<String, Object>();
+ Map<String, Object> variables = new HashMap<>();
if (requesterId.length() > Variables.requesterId.getMaxLength()) {
requesterId = requesterId.substring(0, Variables.requesterId.getMaxLength());
}
@@ -275,7 +275,7 @@ public class TmClient {
Response response = null;
debug.debug("postCloseChangeTicket {}", closeChangeRecord.asText());
Observation.report(LogMessages.TM_CLOSE_CHANGE_RECORD, "Begin", scheduleId, changeId);
- // response = vtmPost(url, closeChangeRecord, scheduleId);
+
response = tmPost(Endpoint.CLOSE, closeChangeRecord, scheduleId);
Observation.report(LogMessages.TM_CLOSE_CHANGE_RECORD, "End", scheduleId, changeId);
switch (response.getStatus()) {
@@ -338,7 +338,7 @@ public class TmClient {
}
private List<TmAsset> getAssetList(List<String> vnfNames) {
- List<TmAsset> assetList = new ArrayList<TmAsset>();
+ List<TmAsset> assetList = new ArrayList<>();
for (String vnfName : vnfNames) {
TmAsset asset = new TmAsset();
asset.setAssetId(vnfName);
diff --git a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java
index 8c8cd6f..8ab915c 100644
--- a/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java
+++ b/cmso-service/src/main/java/org/onap/optf/cmso/ticketmgt/bean/BuildCreateRequest.java
@@ -104,8 +104,7 @@ public class BuildCreateRequest {
public JsonNode createChangeRecordRequest(Map<String, Object> variables, List<TmAsset> assetList,
String workflowName) {
JsonNode rawjson = getYaml("CreateChangeTicket");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
/**
@@ -116,8 +115,7 @@ public class BuildCreateRequest {
*/
public JsonNode createCloseCancelChangeRecord(Map<String, Object> variables) {
JsonNode rawjson = getYaml("CloseCancelChangeRecord");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
/**
@@ -128,8 +126,7 @@ public class BuildCreateRequest {
*/
public JsonNode createCancelChangeRecord(Map<String, Object> variables) {
JsonNode rawjson = getYaml("CancelChangeRecord");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
/**
@@ -140,8 +137,7 @@ public class BuildCreateRequest {
*/
public JsonNode createUpdateChangeRecord(Map<String, Object> variables) {
JsonNode rawjson = getYaml("UpdateChangeRecord");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
/**
@@ -152,8 +148,7 @@ public class BuildCreateRequest {
*/
public JsonNode createGetChangeRecord(Map<String, Object> variables) {
JsonNode rawjson = getYaml("GetChangeRecord");
- JsonNode json = substituteJson(rawjson, variables);
- return json;
+ return substituteJson(rawjson, variables);
}
private JsonNode substituteJson(JsonNode json, Map<String, Object> variables) {