<!-- ============LICENSE_START=======================================================
- ECOMP CMSO ================================================================================
+ CMSO ================================================================================
Copyright (C) 2018 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
import org.slf4j.MDC;
/**
- * ECOMP EELF logging MDC fields not defined in the MDC Configuration (i.e. MDC_ALERT_SEVERITY)
+ * EELF logging MDC fields not defined in the MDC Configuration (i.e. MDC_ALERT_SEVERITY)
**/
public class Mdc {
/*
- * Copyright © 2018 AT&T Intellectual Property.
- * Modifications Copyright © 2018 IBM.
- *
+ * 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;
@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
+@PropertySources({@PropertySource("file:etc/config/cmso.properties"),
+ @PropertySource("file:etc/config/optimizer.properties"),
+ @PropertySource("file:etc/config/ticketmgt.properties"),})
+public class ApplicationPropertiesFiles {
+}
\r
package org.onap.optf.cmso;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import org.quartz.spi.TriggerFiredBundle;\r
import org.springframework.beans.factory.config.AutowireCapableBeanFactory;\r
import org.springframework.context.ApplicationContext;\r
import org.springframework.context.ApplicationContextAware;\r
import org.springframework.scheduling.quartz.SpringBeanJobFactory;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-\r
/**\r
* This class makes it possible to use @Autowired references in QuartzJobBeans.\r
- *\r
* Also enables @Autowire of the SchedulerFactoryBean the add Triggers\r
* for @Autowired QuartzJobBeans for ChangeManagement events. Making a big\r
* investment in SpringBoot Quartz. It had better work ;-)\r
*\r
*/\r
+\r
public final class AutowiringSpringBeanJobFactory extends SpringBeanJobFactory implements ApplicationContextAware {\r
private static EELFLogger log = EELFManager.getInstance().getLogger(AutowiringSpringBeanJobFactory.class);\r
\r
*/
public class AafUserRole {
private String url = "";
- private String pathParts[] = {};
+ private String[] pathParts = {};
private String perm = "";
private String method = "";
private List<AafPerm> aafPerms = new ArrayList<>();
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property. Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
* in compliance with the License. You may obtain a copy of the License at\r
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property. Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
* in compliance with the License. You may obtain a copy of the License at\r
\r
package org.onap.optf.cmso.common;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import java.io.IOException;\r
import java.io.UnsupportedEncodingException;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.ws.rs.client.ClientRequestFilter;\r
import javax.ws.rs.core.MultivaluedMap;\r
import javax.xml.bind.DatatypeConverter;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
\r
+/**\r
+ * The Class BasicAuthenticatorFilter.\r
+ */\r
public class BasicAuthenticatorFilter implements ClientRequestFilter {\r
private static EELFLogger log = EELFManager.getInstance().getLogger(BasicAuthenticatorFilter.class);\r
private final String user;\r
private final String password;\r
\r
+ /**\r
+ * Instantiates a new basic authenticator filter.\r
+ *\r
+ * @param user the user\r
+ * @param password the password\r
+ */\r
public BasicAuthenticatorFilter(String user, String password) {\r
this.user = user;\r
this.password = password;\r
log.info("user: " + user + " pass:" + password);\r
}\r
\r
+ /**\r
+ * Filter.\r
+ *\r
+ * @param requestContext the request context\r
+ * @throws IOException Signals that an I/O exception has occurred.\r
+ */\r
@Override\r
public void filter(ClientRequestContext requestContext) throws IOException {\r
MultivaluedMap<String, Object> headers = requestContext.getHeaders();\r
}\r
}\r
\r
+ /**\r
+ * Gets the user.\r
+ *\r
+ * @param request the request\r
+ * @return the user\r
+ */\r
public static String getUser(HttpServletRequest request) {\r
String user = "";\r
String header = request.getHeader("Authorization");\r
/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
\r
package org.onap.optf.cmso.common;\r
\r
-import java.io.Serializable;\r
-import java.util.ArrayList;\r
-import java.util.List;\r
import com.att.eelf.configuration.EELFLogger;\r
import com.att.eelf.configuration.EELFManager;\r
import com.fasterxml.jackson.annotation.JsonProperty;\r
+import java.io.Serializable;\r
+import java.util.ArrayList;\r
+import java.util.List;\r
\r
public class CMSRequestError implements Serializable {\r
private static final long serialVersionUID = 1L;\r
this.variables = variables;\r
}\r
\r
+ @Override\r
public String toString() {\r
StringBuffer sb = new StringBuffer();\r
sb.append(messageId).append(":").append(text).append(":").append(variables);\r
}\r
}\r
\r
+ @Override\r
public String toString() {\r
return requestError.toString();\r
}\r
package org.onap.optf.cmso.common;\r
\r
public enum CMSStatusEnum {\r
- PendingSchedule(\r
- "Pending Schedule",\r
- "Schedule request as been accepted. Pending determination of recommended schedule."),\r
- SchedulingFailed("Scheduling Failed", "Failed to determine recommended schedule."),\r
- ScheduleFailed("Schedule Failed", "Determination of recommended schedule failed."),\r
- OptimizationInProgress(\r
- "Optimization In Progress", "Determination of recommended schedule is in progress."),\r
- PendingApproval("Pending Approval", "Pending approval of the recommended schedule."),\r
- OptimizationFailed("Optimization Failed", "Unable to determine recommended schedule."),\r
- Accepted("Accepted", "Recommended schedule has been accepted."),\r
- Scheduled("Scheduled", "All approvals received. Recommended schedule is pending execution."),\r
- ScheduledImmediate(\r
- "Scheduled Immediate", "All approvals received. Event is scheduled for immediate execution."),\r
- Triggered("Triggered", "Scheduled event has been triggered."),\r
- ApprovalRejected("Approval Rejected", "Recommended schedule has been rejected."),\r
- PastDue("Past due", "Scheduled event time has passed. Queued event was not dispatched."),\r
- Error("Error", "Attempt to displatch event failed."),\r
- Failed("Failed", "Triggered event reported a failure."),\r
- Rejected("Rejected", "Recommended schedule has been rejected."),\r
- NotificationsInitiated(\r
- "Notifications Initiated", "Notifications of scheduled events has been initiated."),\r
- Completed("Completed", "Notification of all scheduled events have been sent."),\r
- CompletedWithError(\r
- "Completed with error(s)", "All scheduled events have completed, some with errors."),\r
- Deleted("Deleted", "Schedule deleted prior to acceptance or after execution."),\r
- Cancelled("Cancelled", "Scheduled event cancelled before execution."),\r
- NotScheduled("Not scheduled by optimizer", "Element not included in the schedule by optimizer."),\r
- ;\r
+ PendingSchedule("Pending Schedule",\r
+ "Schedule request as been accepted. Pending determination of recommended schedule."),\r
+ SchedulingFailed("Scheduling Failed", "Failed to determine recommended schedule."),\r
+ ScheduleFailed("Schedule Failed", "Determination of recommended schedule failed."),\r
+ OptimizationInProgress("Optimization In Progress", "Determination of recommended schedule is in progress."),\r
+ PendingApproval("Pending Approval", "Pending approval of the recommended schedule."),\r
+ OptimizationFailed("Optimization Failed", "Unable to determine recommended schedule."),\r
+ Accepted("Accepted", "Recommended schedule has been accepted."),\r
+ Scheduled("Scheduled", "All approvals received. Recommended schedule is pending execution."),\r
+ ScheduledImmediate("Scheduled Immediate", "All approvals received. Event is scheduled for immediate execution."),\r
+ Triggered("Triggered", "Scheduled event has been triggered."),\r
+ ApprovalRejected("Approval Rejected", "Recommended schedule has been rejected."),\r
+ PastDue("Past due", "Scheduled event time has passed. Queued event was not dispatched."),\r
+ Error("Error", "Attempt to displatch event failed."),\r
+ Failed("Failed", "Triggered event reported a failure."),\r
+ Rejected("Rejected", "Recommended schedule has been rejected."),\r
+ NotificationsInitiated("Notifications Initiated", "Notifications of scheduled events has been initiated."),\r
+ Completed("Completed", "Notification of all scheduled events have been sent."),\r
+ CompletedWithError("Completed with error(s)", "All scheduled events have completed, some with errors."),\r
+ Deleted("Deleted", "Schedule deleted prior to acceptance or after execution."),\r
+ Cancelled("Cancelled", "Scheduled event cancelled before execution."),\r
+ NotScheduled("Not scheduled by optimizer", "Element not included in the schedule by optimizer."),;\r
\r
- private final String text;\r
- private final String description;\r
+ private final String text;\r
+ private final String description;\r
\r
- private CMSStatusEnum(String text, String description) {\r
- this.text = text;\r
- this.description = description;\r
- }\r
+ private CMSStatusEnum(String text, String description) {\r
+ this.text = text;\r
+ this.description = description;\r
+ }\r
\r
- @Override\r
- public String toString() {\r
- return text;\r
- }\r
+ @Override\r
+ public String toString() {\r
+ return text;\r
+ }\r
\r
- public CMSStatusEnum fromString(String text) {\r
- for (CMSStatusEnum e : CMSStatusEnum.values()) if (e.text.equals(text)) return e;\r
- return null;\r
- }\r
+ public CMSStatusEnum fromString(String text) {\r
+ for (CMSStatusEnum e : CMSStatusEnum.values())\r
+ if (e.text.equals(text))\r
+ return e;\r
+ return null;\r
+ }\r
\r
- // To include in the AID.\r
- public static void main(String argv[]) {\r
- StringBuilder sb = new StringBuilder();\r
- sb.append("<html><body><table border=\"1\">\n");\r
- for (CMSStatusEnum v : CMSStatusEnum.values())\r
- sb.append("<tr><td>")\r
- .append(v.text)\r
- .append("</td><td>")\r
- .append(v.description)\r
- .append("</td></tr>\n");\r
- sb.append("</table></body></html>\n");\r
- System.out.println(sb.toString());\r
- }\r
+ // To include in the AID.\r
+ public static void main(String argv[]) {\r
+ StringBuilder sb = new StringBuilder();\r
+ sb.append("<html><body><table border=\"1\">\n");\r
+ for (CMSStatusEnum v : CMSStatusEnum.values())\r
+ sb.append("<tr><td>").append(v.text).append("</td><td>").append(v.description).append("</td></tr>\n");\r
+ sb.append("</table></body></html>\n");\r
+ System.out.println(sb.toString());\r
+ }\r
}\r
import org.onap.optf.cmso.service.rs.models.CmDomainDataEnum;\r
\r
/**\r
- * Collection of commann static helper methods for CHangeManagement\r
+ * Collection of commann static helper methods for CHangeManagement.\r
*\r
* @author jf9860\r
*\r
return getDomainData(schedule.getDomainData(), key);\r
}\r
\r
+ /**\r
+ * Gets the domain data.\r
+ *\r
+ * @param domainData the domain data\r
+ * @param key the key\r
+ * @return the domain data\r
+ */\r
public static String getDomainData(List<DomainData> domainData, CmDomainDataEnum key) {\r
for (DomainData map : domainData) {\r
- if (map.getName().equals(key.toString()))\r
+ if (map.getName().equals(key.toString())) {\r
return map.getValue();\r
+ }\r
}\r
return null;\r
}\r
\r
- public static String getEventData(Schedule schedule, CmDomainDataEnum key) {\r
- return getDomainData(schedule.getDomainData(), key);\r
- }\r
+ public static String getEventData(Schedule schedule, CmDomainDataEnum key) {\r
+ return getDomainData(schedule.getDomainData(), key);\r
+ }\r
\r
- public static String getElementData(List<ElementData> eventData, CmDomainDataEnum key) {\r
- for (ElementData map : eventData) {\r
- if (map.getName().equals(key.toString()))\r
- return map.getValue();\r
- }\r
- return null;\r
- }\r
+ /**\r
+ * Gets the element data.\r
+ *\r
+ * @param eventData the event data\r
+ * @param key the key\r
+ * @return the element data\r
+ */\r
+ public static String getElementData(List<ElementData> eventData, CmDomainDataEnum key) {\r
+ for (ElementData map : eventData) {\r
+ if (map.getName().equals(key.toString())) {\r
+ return map.getValue();\r
+ }\r
+ }\r
+ return null;\r
+ }\r
\r
}\r
import com.att.eelf.utils.Stopwatch;\r
\r
/**\r
- * ECOMP EELF logging MDC fields not defined in the MDC Configuration (i.e.\r
+ * EELF logging MDC fields not defined in the MDC Configuration (i.e.\r
* MDC_ALERT_SEVERITY)\r
**/\r
public class Mdc {\r
MDC.put(MDC_SERVER_FQDN, e.getMessage());\r
}\r
MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");\r
- MDC.put(MDC_SERVICE_NAME, "ecomp-cmso");\r
+ MDC.put(MDC_SERVICE_NAME, "cmso");\r
// MDC.put(MDC_STATUS_CODE, "");\r
setPartherTargetFromUri(request.getRequestURL().toString());\r
// Override partner hostname with username\r
MDC.put(MDC_SERVER_FQDN, e.getMessage());\r
}\r
MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");\r
- MDC.put(MDC_SERVICE_NAME, "ecomp-cmso");\r
+ MDC.put(MDC_SERVICE_NAME, "cmso");\r
// MDC.put(MDC_STATUS_CODE, "");\r
// MDC.put(MDC_TARGET_ENTITY, "");\r
// MDC.put(MDC_TARGET_SERVICE_NAME, "");\r
// InetAddress.getLocalHost().getHostAddress()); } catch (Exception e){\r
// MDC.put(MDC_SERVER_FQDN, e.getMessage());}\r
// MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");\r
- // MDC.put(MDC_SERVICE_NAME, "ecomp-cmso");\r
+ // MDC.put(MDC_SERVICE_NAME, "cmso");\r
// MDC.put(MDC_STATUS_CODE, "");\r
// MDC.put(MDC_TARGET_ENTITY, "");\r
// MDC.put(MDC_TARGET_SERVICE_NAME, "");\r
// InetAddress.getLocalHost().getHostAddress()); } catch (Exception e){\r
// MDC.put(MDC_SERVER_FQDN, e.getMessage());}\r
// MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");\r
- // MDC.put(MDC_SERVICE_NAME, "ecomp-cmso");\r
+ // MDC.put(MDC_SERVICE_NAME, "cmso");\r
// MDC.put(MDC_STATUS_CODE, "");\r
setPartherTargetFromUri(url);\r
// MDC.put(MDC_TARGET_ENTITY, "");\r
// InetAddress.getLocalHost().getHostAddress()); } catch (Exception e){\r
// MDC.put(MDC_SERVER_FQDN, e.getMessage());}\r
// MDC.put(MDC_SERVICE_INSTANCE_ID, "UNKNOWN");\r
- // MDC.put(MDC_SERVICE_NAME, "ecomp-cmso");\r
+ // MDC.put(MDC_SERVICE_NAME, "cmso");\r
MDC.put(MDC_STATUS_CODE, "COMPLETE");\r
if (response.getStatus() == 500)\r
MDC.put(MDC_STATUS_CODE, "ERROR");\r
/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
\r
package org.onap.optf.cmso.common;\r
\r
-import java.io.UnsupportedEncodingException;\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import javax.crypto.Cipher;\r
import javax.crypto.spec.IvParameterSpec;\r
import javax.crypto.spec.SecretKeySpec;\r
-import javax.xml.bind.DatatypeConverter;\r
import org.apache.commons.codec.binary.Base64;\r
import org.springframework.beans.factory.annotation.Autowired;\r
import org.springframework.core.env.Environment;\r
import org.springframework.stereotype.Component;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
\r
+/**\r
+ * The Class PropertiesManagement.\r
+ */\r
@Component\r
public class PropertiesManagement {\r
\r
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();\r
\r
- private final static String algorithm = "AES";\r
- private final static String cipherMode = "CBC";\r
- private final static String paddingScheme = "PKCS5Padding";\r
- private final static String transformation = algorithm + "/" + cipherMode + "/" + paddingScheme;\r
-\r
+ private static final String algorithm = "AES";\r
+ private static final String cipherMode = "CBC";\r
+ private static final String paddingScheme = "PKCS5Padding";\r
+ private static final String transformation = algorithm + "/" + cipherMode + "/" + paddingScheme;\r
private static final String initVector = "ONAPCMSOVECTORIV"; // 16 bytes IV\r
\r
@Autowired\r
Environment env;\r
\r
+ /**\r
+ * Gets the property.\r
+ *\r
+ * @param key the key\r
+ * @param defaultValue the default value\r
+ * @return the property\r
+ */\r
public String getProperty(String key, String defaultValue) {\r
String value = env.getProperty(key, defaultValue);\r
value = getDecryptedValue(value);\r
return value;\r
}\r
\r
+ /**\r
+ * Gets the decrypted value.\r
+ *\r
+ * @param value the value\r
+ * @return the decrypted value\r
+ */\r
public static String getDecryptedValue(String value) {\r
if (value.startsWith("enc:")) {\r
String secret = getSecret();\r
return value;\r
}\r
\r
+ /**\r
+ * Gets the encrypted value.\r
+ *\r
+ * @param value the value\r
+ * @return the encrypted value\r
+ */\r
public static String getEncryptedValue(String value) {\r
String secret = getSecret();\r
value = encrypt(secret, initVector, value);\r
return "ONAPCMSOSECRETIV";\r
}\r
\r
- public static void main(String[] args) {\r
- try {\r
- String pass = getDecryptedValue("enc:bfodXf8qRfCqMvlxVBYNWQ==");\r
- //System.out.println("Decrypt - "+pass);\r
- pass = getEncryptedValue("cmso@onap.org");\r
- //System.out.println("Encrypt - "+pass);\r
- //System.out.println(DatatypeConverter.printBase64Binary("cmso@onap.org:cmso@onap.org".getBytes("UTF-8")));\r
- } catch (Exception e) {\r
- // TODO Auto-generated catch block\r
- e.printStackTrace();\r
- }\r
-\r
- }\r
}\r
/*\r
* Copyright © 2017-2019 AT&T Intellectual Property.\r
* Modifications Copyright © 2018 IBM.\r
- * \r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
\r
package org.onap.optf.cmso.dispatcher;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import java.util.Map;\r
import java.util.UUID;\r
-\r
import javax.ws.rs.client.Client;\r
import javax.ws.rs.client.ClientBuilder;\r
import javax.ws.rs.client.Invocation;\r
import javax.ws.rs.client.WebTarget;\r
import javax.ws.rs.core.MediaType;\r
import javax.ws.rs.core.Response;\r
-\r
import org.onap.observations.Mdc;\r
import org.onap.optf.cmso.common.BasicAuthenticatorFilter;\r
import org.onap.optf.cmso.common.LogMessages;\r
import org.springframework.core.env.Environment;\r
import org.springframework.stereotype.Component;\r
\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-\r
/**\r
- * This is the Quartz Job that is run to send the workflow to VID for execution\r
- * \r
+ * This is the Quartz Job that is run to send the workflow to VID for execution.\r
+ *\r
*\r
*/\r
@Component\r
CMSOClient vidClient;\r
\r
@Autowired\r
- ChangeManagementScheduleDAO cmScheduleDAO;\r
+ ChangeManagementScheduleDAO cmScheduleDao;\r
\r
@Autowired\r
ChangeManagementGroupDAO cmGroupDAO;\r
String pass = pm.getProperty("mechid.pass", "");\r
Client client = ClientBuilder.newClient();\r
client.register(new BasicAuthenticatorFilter(user, pass));\r
- client.register(new CmsoClientFilters());\r
+ client.register(new CmsoClientFilters());\r
WebTarget target = client.target(url);\r
Invocation.Builder invocationBuilder = target.request(MediaType.APPLICATION_JSON);\r
Response response = null;\r
/*\r
* Copyright © 2017-2018 AT&T Intellectual Property.\r
* Modifications Copyright © 2018 IBM.\r
- * \r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
\r
package org.onap.optf.cmso.dispatcher;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
+import com.att.eelf.i18n.EELFResourceManager;\r
import java.net.InetAddress;\r
import java.util.Date;\r
import java.util.HashSet;\r
import java.util.Set;\r
import java.util.UUID;\r
-\r
import org.onap.optf.cmso.common.CMSStatusEnum;\r
import org.onap.optf.cmso.common.LogMessages;\r
import org.onap.optf.cmso.model.ChangeManagementGroup;\r
import org.springframework.stereotype.Component;\r
import org.springframework.transaction.annotation.Transactional;\r
\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
-import com.att.eelf.i18n.EELFResourceManager;\r
-\r
/**\r
- * This is the service used to dispatch a job COuld not get QuartzJobBean to\r
+ * This is the service used to dispatch a job COuld not get QuartzJobBean to.\r
* be @Transactional\r
*\r
*/\r
@Component\r
public class DispatchJob {\r
private static EELFLogger log = EELFManager.getInstance().getLogger(DispatchJob.class);\r
- private static EELFLogger metrics = EELFManager.getInstance().getMetricsLogger();\r
private static EELFLogger errors = EELFManager.getInstance().getErrorLogger();\r
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
\r
// (Sleep until actual dispatch time...)\r
// leadTime allows for preparing call to VID to the start of workflow.\r
long sleep = (startMillis - leadTime) - System.currentTimeMillis();\r
- if (sleep > 0l) {\r
+ if (sleep > 0L) {\r
try {\r
Thread.sleep(sleep);\r
} catch (Exception e) {\r
/*\r
* Copyright © 2017-2018 AT&T Intellectual Property.\r
* Modifications Copyright © 2018 IBM.\r
- * \r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
\r
package org.onap.optf.cmso.dispatcher.rs;\r
\r
+import io.swagger.annotations.Api;\r
+import io.swagger.annotations.ApiOperation;\r
+import io.swagger.annotations.ApiParam;\r
+import io.swagger.annotations.ApiResponse;\r
+import io.swagger.annotations.ApiResponses;\r
import javax.servlet.http.HttpServletRequest;\r
import javax.ws.rs.GET;\r
import javax.ws.rs.Path;\r
import javax.ws.rs.core.Response;\r
import javax.ws.rs.core.UriInfo;\r
\r
-import io.swagger.annotations.Api;\r
-import io.swagger.annotations.ApiOperation;\r
-import io.swagger.annotations.ApiParam;\r
-import io.swagger.annotations.ApiResponse;\r
-import io.swagger.annotations.ApiResponses;\r
-\r
@Api\r
@Path("/dispatch")\r
@Produces({MediaType.APPLICATION_JSON})\r
@Override\r
@Transactional\r
public Response dispatchSchedule(String id, UriInfo uri, HttpServletRequest request) {\r
- debug.debug("dispatchSchedule entered {}" , id);\r
+ debug.debug("dispatchSchedule entered {}", id);\r
try {\r
- UUID uuid = UUID.fromString(id);\r
+ UUID uuid = UUID.fromString(id);\r
dispatchJob.execute(uuid);\r
} catch (Exception e) {\r
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());\r
public Response dispatchOptimizer(String id, UriInfo uri, HttpServletRequest request) {\r
debug.debug("dispatchOptimizer entered {}", id);\r
try {\r
- UUID uuid = UUID.fromString(id);\r
+ UUID uuid = UUID.fromString(id);\r
optimizerClient.scheduleOptimization(uuid);\r
} catch (Exception e) {\r
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());\r
\r
package org.onap.optf.cmso.eventq;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import java.util.Date;\r
import java.util.List;\r
import org.onap.optf.cmso.common.CMSStatusEnum;\r
import org.springframework.scheduling.quartz.SchedulerFactoryBean;\r
import org.springframework.stereotype.Component;\r
import org.springframework.transaction.annotation.Transactional;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
\r
/**\r
* This job will look for ChangeManagementSchedule approved jobs that are due\r
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
\r
@Autowired\r
- ChangeManagementScheduleDAO cmScheduleDAO;\r
+ ChangeManagementScheduleDAO cmScheduleDao;\r
\r
@Autowired\r
SchedulerFactoryBean qsScheduler;\r
@Autowired\r
DispatchedEventList dispatchedEventList;\r
\r
+ /**\r
+ * Queue imminent jobs.\r
+ *\r
+ * @return true, if successful\r
+ */\r
public boolean queueImminentJobs() {\r
Integer interval = env.getProperty("cmso.cm.polling.job.interval.ms", Integer.class, 10000);\r
Integer lookahead = env.getProperty("cmso.cm.polling.job.lookahead.intervals", Integer.class, 5);\r
long now = System.currentTimeMillis();\r
Long endTime = now + (interval * lookahead);\r
List<ChangeManagementSchedule> schedules =\r
- cmScheduleDAO.findByStatusAndEndTime(CMSStatusEnum.Scheduled.toString(), endTime);\r
- if (schedules.size() == 0)\r
+ cmScheduleDao.findByStatusAndEndTime(CMSStatusEnum.Scheduled.toString(), endTime);\r
+ if (schedules.size() == 0) {\r
return false;\r
+ }\r
for (ChangeManagementSchedule schedule : schedules) {\r
try {\r
if (!dispatchedEventList.isAlreadyDispatched(schedule.getUuid())) {\r
return false;\r
}\r
\r
+ /**\r
+ * Schedule cm job.\r
+ *\r
+ * @param schedule the schedule\r
+ * @throws Exception the scheduler exception\r
+ */\r
public void scheduleCmJob(ChangeManagementSchedule schedule) throws org.quartz.SchedulerException {\r
//\r
Integer dispatherLeadTime = env.getProperty("cmso.cm.dispatcher.lead.time.ms", Integer.class, 5000);\r
Long startTime = schedule.getStartTimeMillis();\r
\r
/// If startTIme is null, it is an immediate start\r
- if (startTime != null)\r
+ if (startTime != null) {\r
dispatchTime = startTime - dispatherLeadTime;\r
+ }\r
\r
JobDetail jobDetail = JobBuilder.newJob(CmJob.class).build();\r
jobDetail.getJobDataMap().put("key", schedule.getUuid().toString());\r
TriggerBuilder<Trigger> tb = TriggerBuilder.newTrigger().forJob(jobDetail);\r
\r
long now = System.currentTimeMillis();\r
- if (now > dispatchTime)\r
+ if (now > dispatchTime) {\r
tb.startNow();\r
- else\r
+ }\r
+ else {\r
tb.startAt(new Date(dispatchTime));\r
+ }\r
Trigger trigger = tb.build();\r
qsScheduler.getScheduler().scheduleJob(jobDetail, trigger);\r
\r
}\r
\r
+ /**\r
+ * Update schedule status.\r
+ *\r
+ * @param cmSchedule the cm schedule\r
+ */\r
@Transactional\r
public void updateScheduleStatus(ChangeManagementSchedule cmSchedule) {\r
- cmScheduleDAO.save(cmSchedule);\r
+ cmScheduleDao.save(cmSchedule);\r
\r
}\r
\r
\r
package org.onap.optf.cmso.eventq;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import org.onap.observations.Mdc;\r
import org.onap.optf.cmso.common.LogMessages;\r
import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;\r
import org.springframework.scheduling.quartz.QuartzJobBean;\r
import org.springframework.stereotype.Component;\r
import org.springframework.transaction.annotation.Transactional;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
\r
/**\r
* This quartz job runs periodically to query the ChangeManagementSChedule table\r
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();\r
\r
@Autowired\r
- CMSQueueJob qJob;\r
+ CMSQueueJob qqJob;\r
\r
// This is not called directly. Using @Autowired to ensure that startup\r
// Runs before the fist invocation of executeInternal\r
CmQuartzJobStartup startup;\r
\r
@Autowired\r
- ChangeManagementScheduleDAO cmScheduleDAO;\r
+ ChangeManagementScheduleDAO cmScheduleDao;\r
\r
@Override\r
@Transactional\r
boolean moreToSchedule = true;\r
while (moreToSchedule) {\r
try {\r
- moreToSchedule = qJob.queueImminentJobs();\r
+ moreToSchedule = qqJob.queueImminentJobs();\r
} catch (Exception e) {\r
debug.debug(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());\r
moreToSchedule = false;\r
/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
\r
package org.onap.optf.cmso.eventq;\r
\r
+import com.att.eelf.configuration.EELFLogger;\r
+import com.att.eelf.configuration.EELFManager;\r
import java.net.InetAddress;\r
import java.util.concurrent.atomic.AtomicBoolean;\r
import org.onap.optf.cmso.model.dao.ChangeManagementScheduleDAO;\r
import org.springframework.beans.factory.annotation.Autowired;\r
import org.springframework.stereotype.Component;\r
import org.springframework.transaction.annotation.Transactional;\r
-import com.att.eelf.configuration.EELFLogger;\r
-import com.att.eelf.configuration.EELFManager;\r
\r
/**\r
* This bean uses @AUtowired to ensure that it runs once at startup to reset all\r
* QueuedForDispatch rows that were in flight last time from this\r
* "dispatcherInstnace" shut down.\r
- * \r
* Potentially, in a distributed environment, when a "dispatcherInstance"\r
* shutdown is detected by another instance, it can run this query to requeue\r
* these items. We are a long way from there.\r
- * \r
* Chances are great that re-queued events will end up being Past Due events\r
- * \r
+ *\r
*/\r
@Component\r
public class CmQuartzJobStartup {\r
private static EELFLogger log = EELFManager.getInstance().getLogger(CmQuartzJobStartup.class);\r
\r
@Autowired\r
- ChangeManagementScheduleDAO cmScheduleDAO;\r
+ ChangeManagementScheduleDAO cmScheduleDao;\r
\r
private AtomicBoolean started = new AtomicBoolean(false);\r
\r
\r
}\r
\r
+ /**\r
+ * Startup.\r
+ */\r
@Transactional\r
public void startup() {\r
try {\r
- if (started.getAndSet(true))\r
+ if (started.getAndSet(true)) {\r
return;\r
- int rows = cmScheduleDAO.requeueQueuedForDispatch(InetAddress.getLocalHost().getHostAddress());\r
+ }\r
+ int rows = cmScheduleDao.requeueQueuedForDispatch(InetAddress.getLocalHost().getHostAddress());\r
log.info("{0} QUeued For Dispatch rows have been requeued at startup", rows);\r
} catch (Exception e) {\r
log.error("Exception caught in requeueing Queued for DIspatch rows at startup", e);\r
package org.onap.optf.cmso.filters;
import static com.att.eelf.configuration.Configuration.MDC_KEY_REQUEST_ID;
+
import java.io.IOException;
import javax.ws.rs.client.ClientRequestContext;
import javax.ws.rs.client.ClientRequestFilter;
@Override
public void filter(ClientRequestContext requestContext, ClientResponseContext responseContext) throws IOException {
- // On the way back
- Mdc.metricEnd(responseContext);
- Mdc.setCaller(17);
- Observation.report(LogMessages.OUTGOING_MESSAGE_RETURNED,
- requestContext.getMethod(),
- requestContext.getUri().getPath().toString(),
- responseContext.getStatusInfo().toString());
+ // On the way back
+ Mdc.metricEnd(responseContext);
+ Mdc.setCaller(17);
+ Observation.report(LogMessages.OUTGOING_MESSAGE_RETURNED, requestContext.getMethod(),
+ requestContext.getUri().getPath().toString(), responseContext.getStatusInfo().toString());
}
@Override
public void filter(ClientRequestContext requestContext) throws IOException {
- // On the way out
- Mdc.metricStart(requestContext);
- Mdc.setCaller(17);
- Observation.report(LogMessages.OUTGOING_MESSAGE,
- requestContext.getMethod(),
- requestContext.getUri().getPath().toString());
+ // On the way out
+ Mdc.metricStart(requestContext);
+ Mdc.setCaller(17);
+ Observation.report(LogMessages.OUTGOING_MESSAGE, requestContext.getMethod(),
+ requestContext.getUri().getPath().toString());
MultivaluedMap<String, Object> headers = requestContext.getHeaders();
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 || transactionId.equals("")) {
+ if (mdcId != null) {
headers.add(HeadersEnum.TransactionID.toString(), mdcId);
+ }
+ }
headers.add(HeadersEnum.FromAppID.toString(), appId);
}
/*
* Copyright © 2017-2019 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.
import java.io.IOException;
import java.util.UUID;
-
import javax.annotation.Priority;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.WebApplicationException;
import javax.ws.rs.core.Response;
import javax.ws.rs.core.Response.ResponseBuilder;
import javax.ws.rs.ext.Provider;
-
import org.onap.observations.Mdc;
import org.onap.observations.Observation;
import org.onap.optf.cmso.common.LogMessages;
public class CmsoContainerFilters implements ContainerRequestFilter, ContainerResponseFilter {
- @Context
- private HttpServletRequest servletRequest;
+ @Context
+ private HttpServletRequest servletRequest;
@Override
public void filter(ContainerRequestContext requestContext, ContainerResponseContext responseContext)
- throws IOException {
+ throws IOException {
try {
- Mdc.auditEnd(requestContext, responseContext);
- Observation.report(LogMessages.INCOMING_MESSAGE_RESPONSE,
- requestContext.getMethod(),
- requestContext.getUriInfo().getPath().toString(),
- responseContext.getStatusInfo().toString());
+ Mdc.auditEnd(requestContext, responseContext);
+ Observation.report(LogMessages.INCOMING_MESSAGE_RESPONSE, requestContext.getMethod(),
+ requestContext.getUriInfo().getPath().toString(),
+ responseContext.getStatusInfo().toString());
MultivaluedMap<String, String> reqHeaders = requestContext.getHeaders();
MultivaluedMap<String, Object> respHeaders = responseContext.getHeaders();
- String minorVersion = (String) reqHeaders.getFirst(HeadersEnum.MinorVersion.toString());
+ String minorVersion = reqHeaders.getFirst(HeadersEnum.MinorVersion.toString());
respHeaders.add(HeadersEnum.MinorVersion.toString(), minorVersion);
respHeaders.add(HeadersEnum.LatestVersion.toString(), MessageHeaders.latestVersion);
respHeaders.add(HeadersEnum.PatchVersion.toString(), MessageHeaders.patchVersion);
} catch (Exception e) {
if (e instanceof WebApplicationException) {
- Observation.report(LogMessages.EXPECTED_EXCEPTION, e.getMessage());
+ Observation.report(LogMessages.EXPECTED_EXCEPTION, e.getMessage());
} else {
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
}
}
}
public void filter(ContainerRequestContext requestContext) throws IOException {
try {
// On the way in
- Mdc.auditStart(requestContext, servletRequest);
- Observation.report(LogMessages.INCOMING_MESSAGE,
- requestContext.getMethod(),
- requestContext.getUriInfo().getPath().toString());
+ Mdc.auditStart(requestContext, servletRequest);
+ Observation.report(LogMessages.INCOMING_MESSAGE, requestContext.getMethod(),
+ requestContext.getUriInfo().getPath().toString());
String majorVersion = requestContext.getUriInfo().getPath();
if (majorVersion != null) {
- if (majorVersion.startsWith("dispatch/"))
+ if (majorVersion.startsWith("dispatch/")) {
return;
+ }
majorVersion = majorVersion.replaceAll("/.*$", "");
}
if (!MessageHeaders.validateMajorVersion(majorVersion)) {
throw new WebApplicationException(builder.build());
}
MultivaluedMap<String, String> headers = requestContext.getHeaders();
- String transactionId = (String) headers.getFirst(HeadersEnum.TransactionID.toString());
+ String transactionId = headers.getFirst(HeadersEnum.TransactionID.toString());
if (transactionId == null) {
transactionId = UUID.randomUUID().toString();
headers.add(HeadersEnum.TransactionID.toString(), transactionId);
}
- String minorVersion = (String) headers.getFirst(HeadersEnum.MinorVersion.toString());
+ String minorVersion = headers.getFirst(HeadersEnum.MinorVersion.toString());
if (minorVersion == null) {
minorVersion = MessageHeaders.supportedMajorVersions.get(majorVersion);
headers.add(HeadersEnum.MinorVersion.toString(), minorVersion);
Observation.report(LogMessages.EXPECTED_EXCEPTION, e.getMessage());
throw e;
} else {
- Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
+ Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e.getMessage());
}
}
/*\r
- * Copyright © 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright © 2018 IBM.\r
- * \r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
import java.util.Map;\r
import java.util.Set;\r
\r
+/**\r
+ * The Class MessageHeaders.\r
+ */\r
public class MessageHeaders {\r
+\r
+ /**\r
+ * The Enum HeadersEnum.\r
+ */\r
public enum HeadersEnum {\r
UNDEFINED("UNDEFINED"), TransactionID("X-TransactionId"), FromAppID("X-FromAppId"), MinorVersion(\r
"X-MinorVersion"), PatchVersion("X-PatchVersion"), LatestVersion("X-LatestVersion"),;\r
this.list = new ArrayList<>();\r
}\r
\r
+ /**\r
+ * To string.\r
+ *\r
+ * @return the string\r
+ */\r
@Override\r
public String toString() {\r
return text;\r
}\r
}\r
\r
+ /** The Constant supportedMajorVersions. */\r
public static final Map<String, String> supportedMajorVersions = new HashMap<String, String>();\r
+\r
static {\r
supportedMajorVersions.put("v1", "0");\r
supportedMajorVersions.put("v2", "0");\r
}\r
+\r
+ /** The Constant supportedMajorMinorVersions. */\r
public static final Set<String> supportedMajorMinorVersions = new HashSet<String>();\r
+\r
static {\r
supportedMajorMinorVersions.add("v1.0");\r
supportedMajorMinorVersions.add("v2.0");\r
}\r
+\r
+ /** The Constant latestVersion. */\r
public static final String latestVersion = "2.0.0";\r
+\r
+ /** The Constant patchVersion. */\r
public static final String patchVersion = "0";\r
\r
+ /**\r
+ * From string.\r
+ *\r
+ * @param text the text\r
+ * @return the headers enum\r
+ */\r
public static HeadersEnum fromString(String text) {\r
- for (HeadersEnum e : HeadersEnum.values())\r
- if (e.text.equals(text))\r
+ for (HeadersEnum e : HeadersEnum.values()) {\r
+ if (e.text.equals(text)) {\r
return e;\r
+ }\r
+ }\r
return HeadersEnum.UNDEFINED;\r
}\r
\r
+ /**\r
+ * Gets the patch version.\r
+ *\r
+ * @return the patch version\r
+ */\r
public static String getPatchVersion() {\r
return patchVersion;\r
}\r
\r
+ /**\r
+ * Gets the latest version.\r
+ *\r
+ * @return the latest version\r
+ */\r
public static String getLatestVersion() {\r
return latestVersion;\r
}\r
\r
+ /**\r
+ * Validate major version.\r
+ *\r
+ * @param major the major\r
+ * @return true, if successful\r
+ */\r
public static boolean validateMajorVersion(String major) {\r
String majorKey = major.toLowerCase();\r
- if (!supportedMajorVersions.containsKey(majorKey))\r
+ if (!supportedMajorVersions.containsKey(majorKey)) {\r
return false;\r
+ }\r
return true;\r
}\r
\r
+ /**\r
+ * Validate major minor version.\r
+ *\r
+ * @param major the major\r
+ * @param minor the minor\r
+ * @return true, if successful\r
+ */\r
public static boolean validateMajorMinorVersion(String major, String minor) {\r
String majorKey = major.toLowerCase();\r
- if (!supportedMajorVersions.containsKey(majorKey))\r
+ if (!supportedMajorVersions.containsKey(majorKey)) {\r
return false;\r
+ }\r
\r
if (minor != null) {\r
String majorMinorKey = majorKey + "." + minor;\r
* @return the start time\r
*/\r
public String getStartTime() {\r
- if (startTimeMillis != null)\r
+ if (startTimeMillis != null) {\r
return ISODateTimeFormat.dateTimeNoMillis().print(startTimeMillis);\r
+ }\r
return null;\r
}\r
\r
* @return the finish time\r
*/\r
public String getFinishTime() {\r
- if (finishTimeMillis != null)\r
+ if (finishTimeMillis != null) {\r
return ISODateTimeFormat.dateTimeNoMillis().print(finishTimeMillis);\r
+ }\r
return null;\r
}\r
\r
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property. Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.\r
* \r
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
* in compliance with the License. You may obtain a copy of the License at\r
/*\r
* Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.\r
- * \r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
* in compliance with the License. You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software distributed under the License\r
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
* or implied. See the License for the specific language governing permissions and limitations under\r
* the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed under the Creative\r
* Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except\r
* in compliance with the License. You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation distributed under the\r
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\r
* express or implied. See the License for the specific language governing permissions and\r
\r
/**\r
* The persistent class for the schedules database table.\r
- * \r
+ *\r
*/\r
@Entity\r
@Table(name = "SCHEDULES")\r
@Transient\r
List<ChangeManagementGroup> groups;\r
\r
+ /**\r
+ * Instantiates a new schedule.\r
+ */\r
public Schedule() {}\r
\r
+ /**\r
+ * Gets the uuid.\r
+ *\r
+ * @return the uuid\r
+ */\r
public UUID getUuid() {\r
return uuid;\r
}\r
\r
+ /**\r
+ * Sets the uuid.\r
+ *\r
+ * @param uuid the new uuid\r
+ */\r
public void setUuid(UUID uuid) {\r
this.uuid = uuid;\r
}\r
\r
+ /**\r
+ * Sets the domain data.\r
+ *\r
+ * @param domainData the new domain data\r
+ */\r
public void setDomainData(List<DomainData> domainData) {\r
this.domainData = domainData;\r
}\r
\r
+ /**\r
+ * Sets the schedule approvals.\r
+ *\r
+ * @param scheduleApprovals the new schedule approvals\r
+ */\r
public void setScheduleApprovals(List<ScheduleApproval> scheduleApprovals) {\r
this.scheduleApprovals = scheduleApprovals;\r
}\r
\r
+ /**\r
+ * Gets the creates the date time.\r
+ *\r
+ * @return the creates the date time\r
+ */\r
public String getCreateDateTime() {\r
- if (createDateTimeMillis != null)\r
+ if (createDateTimeMillis != null) {\r
return ISODateTimeFormat.dateTimeNoMillis().print(this.createDateTimeMillis);\r
+ }\r
return null;\r
}\r
\r
+ /**\r
+ * Sets the creates the date time.\r
+ *\r
+ * @param datetime the new creates the date time\r
+ */\r
public void setCreateDateTime(String datetime) {\r
// only set time via setCreateDateTimeMillis\r
}\r
\r
+ /**\r
+ * Sets the creates the date time millis.\r
+ *\r
+ * @param millis the new creates the date time millis\r
+ */\r
public void setCreateDateTimeMillis(Long millis) {\r
this.createDateTimeMillis = millis;\r
}\r
\r
+ /**\r
+ * Gets the creates the date time millis.\r
+ *\r
+ * @return the creates the date time millis\r
+ */\r
public long getCreateDateTimeMillis() {\r
return this.createDateTimeMillis;\r
}\r
\r
+ /**\r
+ * Gets the delete date time millis.\r
+ *\r
+ * @return the delete date time millis\r
+ */\r
public Long getDeleteDateTimeMillis() {\r
return deleteDateTimeMillis;\r
}\r
\r
+ /**\r
+ * Sets the delete date time millis.\r
+ *\r
+ * @param deleteDateTimeMillis the new delete date time millis\r
+ */\r
public void setDeleteDateTimeMillis(Long deleteDateTimeMillis) {\r
this.deleteDateTimeMillis = deleteDateTimeMillis;\r
}\r
\r
+ /**\r
+ * Gets the delete date time.\r
+ *\r
+ * @return the delete date time\r
+ */\r
public String getDeleteDateTime() {\r
- if (deleteDateTimeMillis != null)\r
+ if (deleteDateTimeMillis != null) {\r
return ISODateTimeFormat.dateTimeNoMillis().print(this.deleteDateTimeMillis);\r
+ }\r
return null;\r
}\r
\r
+ /**\r
+ * Sets the delete date time.\r
+ *\r
+ * @param deleteDateTime the new delete date time\r
+ */\r
public void setDeleteDateTime(String deleteDateTime) {}\r
\r
+ /**\r
+ * Gets the optimizer date time.\r
+ *\r
+ * @return the optimizer date time\r
+ */\r
public String getOptimizerDateTime() {\r
- if (optimizerDateTimeMillis != null)\r
+ if (optimizerDateTimeMillis != null) {\r
return ISODateTimeFormat.dateTimeNoMillis().print(this.optimizerDateTimeMillis);\r
+ }\r
return null;\r
}\r
\r
+ /**\r
+ * Sets the optimizer date time.\r
+ *\r
+ * @param optimizerDateTime the new optimizer date time\r
+ */\r
public void setOptimizerDateTime(String optimizerDateTime) {}\r
\r
+ /**\r
+ * Gets the optimizer message.\r
+ *\r
+ * @return the optimizer message\r
+ */\r
public String getOptimizerMessage() {\r
return this.optimizerMessage;\r
}\r
\r
+ /**\r
+ * Sets the optimizer message.\r
+ *\r
+ * @param optimizerMessage the new optimizer message\r
+ */\r
public void setOptimizerMessage(String optimizerMessage) {\r
this.optimizerMessage = optimizerMessage;\r
}\r
\r
+ /**\r
+ * Gets the optimizer status.\r
+ *\r
+ * @return the optimizer status\r
+ */\r
public String getOptimizerStatus() {\r
return this.optimizerStatus;\r
}\r
\r
+ /**\r
+ * Sets the optimizer status.\r
+ *\r
+ * @param optimizerStatus the new optimizer status\r
+ */\r
public void setOptimizerStatus(String optimizerStatus) {\r
this.optimizerStatus = optimizerStatus;\r
}\r
\r
+ /**\r
+ * Gets the schedule.\r
+ *\r
+ * @return the schedule\r
+ */\r
public String getSchedule() {\r
return this.schedule;\r
}\r
\r
+ /**\r
+ * Sets the schedule.\r
+ *\r
+ * @param schedule the new schedule\r
+ */\r
public void setSchedule(String schedule) {\r
this.schedule = schedule;\r
}\r
\r
+ /**\r
+ * Gets the schedule id.\r
+ *\r
+ * @return the schedule id\r
+ */\r
public String getScheduleId() {\r
return this.scheduleId;\r
}\r
\r
+ /**\r
+ * Sets the schedule id.\r
+ *\r
+ * @param scheduleId the new schedule id\r
+ */\r
public void setScheduleId(String scheduleId) {\r
this.scheduleId = scheduleId;\r
}\r
\r
+ /**\r
+ * Gets the schedule name.\r
+ *\r
+ * @return the schedule name\r
+ */\r
public String getScheduleName() {\r
return this.scheduleName;\r
}\r
\r
+ /**\r
+ * Sets the schedule name.\r
+ *\r
+ * @param scheduleName the new schedule name\r
+ */\r
public void setScheduleName(String scheduleName) {\r
this.scheduleName = scheduleName;\r
}\r
\r
+ /**\r
+ * Gets the schedule info.\r
+ *\r
+ * @return the schedule info\r
+ */\r
public String getScheduleInfo() {\r
return this.scheduleInfo;\r
}\r
\r
+ /**\r
+ * Sets the schedule info.\r
+ *\r
+ * @param scheduleInfo the new schedule info\r
+ */\r
public void setScheduleInfo(String scheduleInfo) {\r
this.scheduleInfo = scheduleInfo;\r
}\r
\r
+ /**\r
+ * Gets the status.\r
+ *\r
+ * @return the status\r
+ */\r
public String getStatus() {\r
return this.status;\r
}\r
\r
+ /**\r
+ * Sets the status.\r
+ *\r
+ * @param status the new status\r
+ */\r
public void setStatus(String status) {\r
this.status = status;\r
}\r
\r
+ /**\r
+ * Gets the user id.\r
+ *\r
+ * @return the user id\r
+ */\r
public String getUserId() {\r
return this.userId;\r
}\r
\r
+ /**\r
+ * Sets the user id.\r
+ *\r
+ * @param userId the new user id\r
+ */\r
public void setUserId(String userId) {\r
this.userId = userId;\r
}\r
\r
+ /**\r
+ * Gets the domain.\r
+ *\r
+ * @return the domain\r
+ */\r
public String getDomain() {\r
return domain;\r
}\r
\r
+ /**\r
+ * Sets the domain.\r
+ *\r
+ * @param domain the new domain\r
+ */\r
public void setDomain(String domain) {\r
this.domain = domain;\r
}\r
\r
+ /**\r
+ * Gets the domain data.\r
+ *\r
+ * @return the domain data\r
+ */\r
public List<DomainData> getDomainData() {\r
return domainData;\r
}\r
\r
+ /**\r
+ * Gets the schedule approvals.\r
+ *\r
+ * @return the schedule approvals\r
+ */\r
public List<ScheduleApproval> getScheduleApprovals() {\r
return scheduleApprovals;\r
}\r
\r
+ /**\r
+ * Adds the domain data.\r
+ *\r
+ * @param domainData the domain data\r
+ * @return the domain data\r
+ */\r
public DomainData addDomainData(DomainData domainData) {\r
List<DomainData> list = getDomainData();\r
- if (list == null)\r
+ if (list == null) {\r
list = new ArrayList<DomainData>();\r
+ }\r
list.add(domainData);\r
domainData.setSchedule(this);\r
return domainData;\r
}\r
\r
+ /**\r
+ * Adds the schedule approval.\r
+ *\r
+ * @param sa the sa\r
+ * @return the schedule approval\r
+ */\r
public ScheduleApproval addScheduleApproval(ScheduleApproval sa) {\r
List<ScheduleApproval> list = getScheduleApprovals();\r
- if (list == null)\r
+ if (list == null) {\r
list = new ArrayList<ScheduleApproval>();\r
+ }\r
list.add(sa);\r
sa.setSchedule(this);\r
return sa;\r
}\r
\r
+ /**\r
+ * Gets the optimizer attempts to schedule.\r
+ *\r
+ * @return the optimizer attempts to schedule\r
+ */\r
public Integer getOptimizerAttemptsToSchedule() {\r
return optimizerAttemptsToSchedule;\r
}\r
\r
+ /**\r
+ * Sets the optimizer attempts to schedule.\r
+ *\r
+ * @param optimizerAttemptsToSchedule the new optimizer attempts to schedule\r
+ */\r
public void setOptimizerAttemptsToSchedule(Integer optimizerAttemptsToSchedule) {\r
this.optimizerAttemptsToSchedule = optimizerAttemptsToSchedule;\r
}\r
\r
+ /**\r
+ * Gets the optimizer return date time.\r
+ *\r
+ * @return the optimizer return date time\r
+ */\r
public String getOptimizerReturnDateTime() {\r
- if (optimizerReturnDateTimeMillis != null)\r
+ if (optimizerReturnDateTimeMillis != null) {\r
return ISODateTimeFormat.dateTimeNoMillis().print(this.optimizerReturnDateTimeMillis);\r
+ }\r
return null;\r
}\r
\r
+ /**\r
+ * Sets the optimizer return date time.\r
+ *\r
+ * @param optimizerReturnDateTime the new optimizer return date time\r
+ */\r
public void setOptimizerReturnDateTime(String optimizerReturnDateTime) {\r
\r
}\r
\r
+ /**\r
+ * Gets the optimizer transaction id.\r
+ *\r
+ * @return the optimizer transaction id\r
+ */\r
public String getOptimizerTransactionId() {\r
return optimizerTransactionId;\r
}\r
\r
+ /**\r
+ * Sets the optimizer transaction id.\r
+ *\r
+ * @param optimizerTransactionId the new optimizer transaction id\r
+ */\r
public void setOptimizerTransactionId(String optimizerTransactionId) {\r
this.optimizerTransactionId = optimizerTransactionId;\r
}\r
\r
+ /**\r
+ * Gets the optimizer date time millis.\r
+ *\r
+ * @return the optimizer date time millis\r
+ */\r
public Long getOptimizerDateTimeMillis() {\r
return optimizerDateTimeMillis;\r
}\r
\r
+ /**\r
+ * Sets the optimizer date time millis.\r
+ *\r
+ * @param optimizerDateTimeMillis the new optimizer date time millis\r
+ */\r
public void setOptimizerDateTimeMillis(Long optimizerDateTimeMillis) {\r
this.optimizerDateTimeMillis = optimizerDateTimeMillis;\r
}\r
\r
+ /**\r
+ * Gets the optimizer return date time millis.\r
+ *\r
+ * @return the optimizer return date time millis\r
+ */\r
public Long getOptimizerReturnDateTimeMillis() {\r
return optimizerReturnDateTimeMillis;\r
}\r
\r
+ /**\r
+ * Sets the optimizer return date time millis.\r
+ *\r
+ * @param optimizerReturnDateTimeMillis the new optimizer return date time millis\r
+ */\r
public void setOptimizerReturnDateTimeMillis(Long optimizerReturnDateTimeMillis) {\r
this.optimizerReturnDateTimeMillis = optimizerReturnDateTimeMillis;\r
}\r
\r
+ /**\r
+ * Gets the groups.\r
+ *\r
+ * @return the groups\r
+ */\r
public List<ChangeManagementGroup> getGroups() {\r
return groups;\r
}\r
\r
+ /**\r
+ * Sets the groups.\r
+ *\r
+ * @param groups the new groups\r
+ */\r
public void setGroups(List<ChangeManagementGroup> groups) {\r
this.groups = groups;\r
}\r
/*\r
* Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.\r
- * \r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
* in compliance with the License. You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software distributed under the License\r
* is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\r
* or implied. See the License for the specific language governing permissions and limitations under\r
* the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed under the Creative\r
* Commons License, Attribution 4.0 Intl. (the "License"); you may not use this documentation except\r
* in compliance with the License. You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation distributed under the\r
* License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\r
* express or implied. See the License for the specific language governing permissions and\r
\r
/**\r
* The persistent class for the schedule_approvals database table.\r
- * \r
+ *\r
*/\r
@Entity\r
@Table(name = "SCHEDULE_APPROVALS")\r
public ScheduleApproval() {}\r
\r
\r
+ /**\r
+ * Gets the approval date time.\r
+ *\r
+ * @return the approval date time\r
+ */\r
public String getApprovalDateTime() {\r
- if (approvalDateTimeMillis != null)\r
+ if (approvalDateTimeMillis != null) {\r
return ISODateTimeFormat.dateTimeNoMillis().print(this.approvalDateTimeMillis);\r
+ }\r
return null;\r
}\r
\r
void delete(ChangeManagementChangeWindow toDelete);\r
\r
@Query(value = "SELECT d FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupUuid = ?1")\r
- List<ChangeManagementChangeWindow> findByGroupsUUID(UUID id);\r
+ List<ChangeManagementChangeWindow> findByGroupsUuid(UUID id);\r
\r
@Modifying\r
@Query(value = "DELETE FROM ChangeManagementChangeWindow d WHERE d.changeManagementGroupUuid = ?1")\r
void delete(ChangeManagementGroup toDelete);\r
\r
@Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesUuid = ?1")\r
- List<ChangeManagementGroup> findBySchedulesID(UUID id);\r
+ List<ChangeManagementGroup> findBySchedulesId(UUID id);\r
\r
@Query(value = "SELECT d FROM ChangeManagementGroup d WHERE d.schedulesUuid = ?1 AND d.groupId = ?2")\r
- ChangeManagementGroup findOneBySchedulesIDGroupID(UUID id, String groupId);\r
+ ChangeManagementGroup findOneBySchedulesIdGroupId(UUID id, String groupId);\r
\r
}\r
+ " AND g.groupId = ?2"\r
+ " AND d.changeManagementGroupUuid = g.uuid"\r
+ " AND d.vnfName = ?3")\r
- ChangeManagementSchedule findOneByScheduleUUIDGroupIdAndVnfName(UUID id, String groupId, String vnfName);\r
+ ChangeManagementSchedule findOneByScheduleUuidGroupIdAndVnfName(UUID id, String groupId, String vnfName);\r
\r
\r
- @Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE (d.status = ?1 AND d.startTimeMillis <= ?2) or d.status = 'Scheduled Immediate' order by d.startTimeMillis")\r
+ @Query(value = "SELECT d FROM ChangeManagementSchedule d"\r
+ + " WHERE (d.status = ?1 AND d.startTimeMillis <= ?2)"\r
+ + " or d.status = 'Scheduled Immediate' order by d.startTimeMillis")\r
List<ChangeManagementSchedule> findByStatusAndEndTime(String status, Long date);\r
\r
@Modifying\r
- @Query(value = "Update ChangeManagementSchedule d set d.status = 'Scheduled', d.dispatcherInstance = '' WHERE d.status = 'Queued for Dispatch' AND d.dispatcherInstance = ?1")\r
+ @Query(value = "Update ChangeManagementSchedule d set d.status = 'Scheduled',"\r
+ + " d.dispatcherInstance = ''"\r
+ + " WHERE d.status = 'Queued for Dispatch' AND d.dispatcherInstance = ?1")\r
public int requeueQueuedForDispatch(String dispatcherInstance);\r
\r
@Query(value = "SELECT d FROM ChangeManagementSchedule d WHERE d.status = 'Triggered'")\r
void delete(Schedule toDelete);\r
\r
@Query(value = "SELECT s FROM Schedule s WHERE s.domain = ?1 AND s.scheduleId= ?2 ")\r
- Schedule findByDomainScheduleID(String domain, String scheduleId);\r
+ Schedule findByDomainScheduleId(String domain, String scheduleId);\r
\r
@Query(value = "SELECT s FROM Schedule s WHERE s.domain = ?1 AND s.status = ?2 ")\r
- List<Schedule> findByDomainStatus(String domain, String Status);\r
+ List<Schedule> findByDomainStatus(String domain, String status);\r
\r
@Query(value = "SELECT s FROM Schedule s WHERE s.optimizerTransactionId= ?1")\r
Schedule findOneByTransactionId(String transactionId);\r
/*\r
* Copyright © 2017-2018 AT&T Intellectual Property.\r
* Modifications Copyright © 2018 IBM.\r
- * \r
+ *\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* http://www.apache.org/licenses/LICENSE-2.0\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, software\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
* See the License for the specific language governing permissions and\r
* limitations under the License.\r
- * \r
- * \r
+ *\r
+ *\r
* Unless otherwise specified, all documentation contained herein is licensed\r
* under the Creative Commons License, Attribution 4.0 Intl. (the "License");\r
* you may not use this documentation except in compliance with the License.\r
* You may obtain a copy of the License at\r
- * \r
+ *\r
* https://creativecommons.org/licenses/by/4.0/\r
- * \r
+ *\r
* Unless required by applicable law or agreed to in writing, documentation\r
* distributed under the License is distributed on an "AS IS" BASIS,\r
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ " left outer join APPROVAL_TYPES at on sa.approval_types_uuid = at.uuid ");\r
sql.append(where);\r
sql.append(" order by uuid ");\r
- if (limit > 0)\r
+ if (limit > 0) {\r
sql.append("LIMIT " + limit);\r
+ }\r
\r
- Query q = manager.createNativeQuery(sql.toString(), ScheduleQuery.class);\r
- List<ScheduleQuery> list = q.getResultList();\r
+ Query qry = manager.createNativeQuery(sql.toString(), ScheduleQuery.class);\r
+ List<ScheduleQuery> list = qry.getResultList();\r
return list;\r
}\r
}\r
private static EELFLogger debug = EELFManager.getInstance().getDebugLogger();
@Autowired
- ScheduleDAO scheduleDAO;
+ ScheduleDAO scheduleDao;
@Autowired
Environment env;
Map<String, String> mdcSave = Mdc.save();
try {
// Ensure that only one cmso is requsting this call to optimizer
- Schedule schedule = scheduleDAO.lockOne(uuid);
+ Schedule schedule = scheduleDao.lockOne(uuid);
if (schedule.getStatus().equals(CMSStatusEnum.PendingSchedule.toString())) {
scheduleNewOptimization(schedule);
}
break;
case 500:
default: {
- String message = response.readEntity(String.class);
// SHould probably track the number of retries.
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
int tries = schedule.getOptimizerAttemptsToSchedule();
tries++;
schedule.setStatus(CMSStatusEnum.ScheduleFailed.toString());
schedule.setOptimizerAttemptsToSchedule(tries);
+ String message = response.readEntity(String.class);
schedule.setOptimizerMessage(message);
updateScheduleStatus(schedule);
/// Got processing error response
public void pollOptimizer(Schedule schedule) {
try {
String optimizerurl = env.getProperty("cmso.optimizer.status.url");
- String username = env.getProperty("mechid.user");
- String password = pm.getProperty("mechid.pass", "");
Long timeout = env.getProperty("cmso.optimizer.request.timeout.secs", Long.class);
if (timeout == null) {
timeout = 3600L;
// If the request is successfully scheduled in optimizer, status will be
// updated to OptimizationInProgress.
Client client = ClientBuilder.newClient();
+ String username = env.getProperty("mechid.user");
+ String password = pm.getProperty("mechid.pass", "");
client.register(new BasicAuthenticatorFilter(username, password));
client.register(new CmsoClientFilters());
WebTarget optimizerTarget = client.target(optimizerurl);
schedule.setOptimizerStatus("Failed to parse optimizer request");
schedule.setOptimizerDateTimeMillis(System.currentTimeMillis());
schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
- scheduleDAO.save(schedule);
+ scheduleDao.save(schedule);
}
return null;
}
*/
@Transactional
public void updateScheduleStatus(Schedule schedule) {
- scheduleDAO.save(schedule);
+ scheduleDao.save(schedule);
}
/**
Environment env;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDAO;
+ ChangeManagementScheduleDAO cmScheduleDao;
@Autowired
- ScheduleDAO scheduleDAO;
+ ScheduleDAO scheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDAO;
+ ChangeManagementGroupDAO cmGroupDao;
@Autowired
- ChangeManagementChangeWindowDAO cmChangeWindowDAO;
+ ChangeManagementChangeWindowDAO cmChangeWindowDao;
@Autowired
- ChangeManagementDetailDAO cmDetailsDAO;
+ ChangeManagementDetailDAO cmDetailsDao;
/**
* Handle optimizer response.
// The dispatch logic ensures that we only every dispatch once.
case OptimizationInProgress:
processResponse(response, schedule);
- scheduleDAO.save(schedule);
+ scheduleDao.save(schedule);
break;
default:
throw new CMSException(Status.PRECONDITION_FAILED, LogMessages.OPTIMIZER_CALLBACK_STATE_ERROR,
default:
break;
}
- scheduleDAO.save(schedule);
+ scheduleDao.save(schedule);
} catch (CMSException e) {
Observation.report(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
schedule.setStatus(CMSStatusEnum.OptimizationFailed.toString());
return;
}
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(schedule.getUuid());
+ List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesId(schedule.getUuid());
Map<String, ChangeManagementGroup> updatedGroups = new HashMap<>();
for (ScheduledElement element : osi.getScheduledElements()) {
String groupId = element.getGroupId();
String vnfName = element.getElementId();
ChangeManagementSchedule cms =
- cmScheduleDAO.findOneByScheduleUUIDGroupIdAndVnfName(schedule.getUuid(), groupId, vnfName);
+ cmScheduleDao.findOneByScheduleUuidGroupIdAndVnfName(schedule.getUuid(), groupId, vnfName);
cms.setStartTimeMillis(element.getStartTime().getTime());
cms.setFinishTimeMillis(element.getEndTime().getTime());
cms.setStatus(CMSStatusEnum.PendingApproval.toString());
- cmScheduleDAO.save(cms);
+ cmScheduleDao.save(cms);
}
if (osi.getUnScheduledElements() != null) {
for (UnScheduledElement element : osi.getUnScheduledElements()) {
String groupId = element.getGroupId();
String vnfName = element.getElementId();
- ChangeManagementSchedule cms = cmScheduleDAO.findOneByScheduleUUIDGroupIdAndVnfName(schedule.getUuid(),
+ ChangeManagementSchedule cms = cmScheduleDao.findOneByScheduleUuidGroupIdAndVnfName(schedule.getUuid(),
groupId, vnfName);
cms.setStatus(CMSStatusEnum.NotScheduled.toString());
- cmScheduleDAO.save(cms);
+ cmScheduleDao.save(cms);
}
}
// Save any changes to the groups
for (ChangeManagementGroup cmg : updatedGroups.values()) {
- cmGroupDAO.save(cmg);
+ cmGroupDao.save(cmg);
}
schedule.setStatus(CMSStatusEnum.PendingApproval.toString());
}
import org.springframework.scheduling.quartz.QuartzJobBean;\r
import org.springframework.stereotype.Component;\r
\r
+/**\r
+ * The Class OptimizerQuartzJob.\r
+ */\r
@Component\r
@DisallowConcurrentExecution\r
public class OptimizerQuartzJob extends QuartzJobBean {\r
\r
}\r
\r
- public void scheduleOptimization(Schedule s) {\r
- UUID id = s.getUuid();\r
+ /**\r
+ * Schedule optimization.\r
+ *\r
+ * @param sch the s\r
+ */\r
+ public void scheduleOptimization(Schedule sch) {\r
+ UUID id = sch.getUuid();\r
Map<String, String> mdcSave = Mdc.save();\r
try {\r
String url = env.getProperty("cmso.dispatch.url", "http://localhost:8089");\r
* According to the documentation I read, Quartz would queue a job without waiting for the\r
* completion of the job with @DisallowConcurrentExecution to complete so that there would be a\r
* backlog of triggers to process\r
- *\r
* This was designed to spin though these stale triggers. When this didn't work, I discovered that\r
* the behavior is that Quartz will wait for the appropriate interval\r
* after @DisallowConcurrentExecution jobs complete.\r
- *\r
* I tested by adding a sleep for an interval > the trigger interval\r
- *\r
* QUartz appears to do what makes sense. Leaving this here in case issues arise...\r
*\r
*/\r
private static EELFLogger log = EELFManager.getInstance().getLogger(BaseSchedulerServiceImpl.class);\r
\r
@Autowired\r
- protected ScheduleDAO scheduleDAO;\r
+ protected ScheduleDAO scheduleDao;\r
\r
@Autowired\r
- DomainDataDAO domainDataDAO;\r
+ DomainDataDAO domainDataDao;\r
\r
@Autowired\r
- ApprovalTypeDAO approvalTypeDAO;\r
+ ApprovalTypeDAO approvalTypeDao;\r
\r
@Autowired\r
- ScheduleApprovalDAO scheduleApprovalDAO;\r
+ ScheduleApprovalDAO scheduleApprovalDao;\r
\r
protected Schedule validateAndAddScheduleRequest(OptimizedScheduleMessage scheduleMessage,\r
List<DomainData> domainData) throws CMSException {\r
messageValidations(scheduleMessage);\r
- Schedule sch = scheduleDAO.findByDomainScheduleID(scheduleMessage.getDomain(), scheduleMessage.getScheduleId());\r
+ Schedule sch = scheduleDao.findByDomainScheduleId(scheduleMessage.getDomain(), scheduleMessage.getScheduleId());\r
\r
if (sch != null) {\r
throw new CMSAlreadyExistsException(scheduleMessage.getDomain(), scheduleMessage.getScheduleId());\r
sch.setOptimizerAttemptsToSchedule(0);\r
sch.setScheduleInfo(scheduleMessage.getSchedulingData().toString());\r
sch.setStatus(CMSStatusEnum.PendingSchedule.toString());\r
- scheduleDAO.save(sch);\r
+ scheduleDao.save(sch);\r
for (DomainData dd : domainData) {\r
dd.setUuid(UUID.randomUUID());\r
sch.addDomainData(dd);\r
- domainDataDAO.save(dd);\r
+ domainDataDao.save(dd);\r
}\r
- scheduleDAO.save(sch);\r
+ scheduleDao.save(sch);\r
return sch;\r
}\r
\r
}\r
\r
protected void deleteScheduleRequest(String domain, String scheduleId) throws CMSException {\r
- Schedule sch = scheduleDAO.findByDomainScheduleID(domain, scheduleId);\r
+ Schedule sch = scheduleDao.findByDomainScheduleId(domain, scheduleId);\r
if (sch == null) {\r
throw new CMSNotFoundException(domain, scheduleId);\r
}\r
default:\r
sch.setStatus(CMSStatusEnum.Deleted.toString());\r
}\r
- scheduleDAO.save(sch);\r
+ scheduleDao.save(sch);\r
}\r
\r
protected Schedule processApproval(Schedule sch, String domain, ApprovalMessage approvalMessage)\r
throws CMSException {\r
String scheduleId = sch.getScheduleId();\r
ApprovalType approvalType =\r
- approvalTypeDAO.findByDomainAndType(domain, approvalMessage.getApprovalType().toString());\r
+ approvalTypeDao.findByDomainAndType(domain, approvalMessage.getApprovalType().toString());\r
if (approvalType == null) {\r
throw new CMSException(Status.BAD_REQUEST, LogMessages.INVALID_ATTRIBUTE, "approvalType",\r
approvalMessage.getApprovalType().toString());\r
sa.setStatus(approvalMessage.getApprovalStatus().toString());\r
sa.setSchedule(sch);\r
sch.addScheduleApproval(sa);\r
- scheduleDAO.save(sch);\r
+ scheduleDao.save(sch);\r
if (sa.getStatus().equals(ApprovalStatusEnum.Rejected.toString())) {\r
sch.setStatus(CMSStatusEnum.Rejected.toString());\r
} else {\r
sch.setStatus(CMSStatusEnum.Accepted.toString());\r
}\r
}\r
- scheduleDAO.save(sch);\r
+ scheduleDao.save(sch);\r
return sch;\r
}\r
\r
// for\r
// logging\r
\r
- List<ApprovalType> approvalTypes = approvalTypeDAO.findByDomain(schedule.getDomain());\r
+ List<ApprovalType> approvalTypes = approvalTypeDao.findByDomain(schedule.getDomain());\r
for (ApprovalType at : approvalTypes) {\r
UUID type = at.getUuid();\r
Integer count = at.getApprovalCount();\r
@Autowired
- ChangeManagementScheduleDAO cmScheduleDAO;
+ ChangeManagementScheduleDAO cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDAO;
+ ChangeManagementGroupDAO cmGroupDao;
@Autowired
- ChangeManagementChangeWindowDAO cmChangeWindowDAO;
+ ChangeManagementChangeWindowDAO cmChangeWindowDao;
@Autowired
- ChangeManagementDetailDAO cmDetailsDAO;
+ ChangeManagementDetailDAO cmDetailsDaoO;
/**
* Sniro callback.
// the response.
// If this lock times out, the schedule will remain in 'Optimization In
// Progress' and never complete.
- Schedule schedule = scheduleDAO.lockOneByTransactionId(transactionId);
+ Schedule schedule = scheduleDao.lockOneByTransactionId(transactionId);
if (schedule == null) {
throw new CMSNotFoundException(DomainsEnum.ChangeManagement.toString(),
// The dispatch logic ensures that we only every dispatch once.
case OptimizationInProgress:
processSniroResponse(sniroResponse, schedule);
- scheduleDAO.save(schedule);
+ scheduleDao.save(schedule);
response = Response.ok().build();
break;
default:
} catch (Exception e) {
errors.error(LogMessages.UNEXPECTED_EXCEPTION, e, e.getMessage());
response = Response.serverError().entity(e.getMessage()).build();
- } finally {
}
return response;
}
String groupId = sniroSchedule.getGroupId();
DateTime finishTime = convertDate(sniroSchedule.getFinishTime(), "finishTime");
DateTime startTime = convertDate(sniroSchedule.getStartTime(), "startTime");
- ChangeManagementGroup group = cmGroupDAO.findOneBySchedulesIDGroupID(schedule.getUuid(), groupId);
+ ChangeManagementGroup group = cmGroupDao.findOneBySchedulesIdGroupId(schedule.getUuid(), groupId);
if (group == null) {
throw new CMSException(Status.PRECONDITION_FAILED,
LogMessages.CHANGE_MANAGEMENT_GROUP_NOT_FOUND, schedule.getScheduleId(), groupId);
DateTime latestInstanceStartTime =
convertDate(sniroSchedule.getLatestInstanceStartTime(), "latestInstanceStartTime");
group.setLastInstanceStartTimeMillis(latestInstanceStartTime.getMillis());
- cmGroupDAO.save(group);
+ cmGroupDao.save(group);
long totalDuration =
(group.getAdditionalDurationInSecs() + group.getNormalDurationInSecs()) * 1000L;
Map<String, Map<String, Long>> startAndFinishTimeMap = new HashMap<String, Map<String, Long>>();
Long nextStartTime = null;
Long nextFinishTime = null;
for (int nodeNumber = 0; nodeNumber < nodeList.size(); nodeNumber++) {
- String node = nodeList.get(nodeNumber);
if (nodeNumber % concurrencyLimit == 0) {
if (nodeNumber == 0) {
nextStartTime = startTime;
Map<String, Long> map = new HashMap<String, Long>();
map.put("startTime", nextStartTime);
map.put("finishTime", nextFinishTime);
+ String node = nodeList.get(nodeNumber);
startAndFinishTimeMap.put(node, map);
}
private void processNode(Schedule schedule, ChangeManagementGroup group, String node,
Map<String, Map<String, Long>> startAndFinishTimeMap) throws CMSException {
Map<String, Long> map = startAndFinishTimeMap.get(node);
- ChangeManagementSchedule detail = cmScheduleDAO.findOneByGroupUuidAndVnfName(group.getUuid(), node);
+ ChangeManagementSchedule detail = cmScheduleDao.findOneByGroupUuidAndVnfName(group.getUuid(), node);
if (detail == null) {
throw new CMSException(Status.NOT_FOUND, LogMessages.UNABLE_TO_LOCATE_SCHEDULE_DETAIL,
schedule.getScheduleId(), group.getGroupId(), node);
detail.setFinishTimeMillis(map.get("finishTime"));
detail.setVnfId("");
detail.setStatus(CMSStatusEnum.PendingApproval.toString());
- cmScheduleDAO.save(detail);
+ cmScheduleDao.save(detail);
}
/**
if (sch != null) {
schedules.add(sch);
if (includeDetails) {
- List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesID(sch.getUuid());
+ List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesId(sch.getUuid());
sch.setGroups(groups);
for (ChangeManagementGroup g : groups) {
List<ChangeManagementSchedule> cmSchedules =
if (!name.equals(CmDomainDataEnum.CallbackData.toString())) {
NameValue nv = new NameValue(name, map.get(name));
dd.add(nv);
- }
- else
- {
- callbackData= map.get(name);
+ } else {
+ callbackData = map.get(name);
}
}
}
Response response = null;
Observation.report(LogMessages.DELETE_SCHEDULE_REQUEST, "Received", request.getRemoteAddr(), scheduleId, "");
try {
- Schedule schedule = scheduleDao.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId);
+ Schedule schedule = scheduleDao.findByDomainScheduleId(DomainsEnum.ChangeManagement.toString(), scheduleId);
if (schedule == null) {
throw new CMSNotFoundException(DomainsEnum.ChangeManagement.toString(), scheduleId);
}
Observation.report(LogMessages.GET_SCHEDULE_REQUEST_INFO, "Received", request.getRemoteAddr(), scheduleId, "");
Schedule schedule = null;
try {
- schedule = scheduleDao.findByDomainScheduleID(DomainsEnum.ChangeManagement.toString(), scheduleId);
+ schedule = scheduleDao.findByDomainScheduleId(DomainsEnum.ChangeManagement.toString(), scheduleId);
if (schedule == null) {
throw new CMSException(Status.NOT_FOUND, LogMessages.SCHEDULE_NOT_FOUND,
DomainsEnum.ChangeManagement.toString(), scheduleId);
approval.toString());
try {
String domain = DomainsEnum.ChangeManagement.toString();
- Schedule sch = scheduleDao.findByDomainScheduleID(domain, scheduleId);
+ Schedule sch = scheduleDao.findByDomainScheduleId(domain, scheduleId);
if (sch == null) {
throw new CMSNotFoundException(domain, scheduleId);
}
-/*
- * Copyright © 2017-2019 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.
+/*oaoo
+ * Copyright © 2017-2019 AT&T Intellectaoual 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
Environment env;
@Autowired
- ChangeManagementScheduleDAO cmScheduleDAO;
+ ChangeManagementScheduleDAO cmScheduleDao;
@Autowired
- ChangeManagementGroupDAO cmGroupDAO;
+ ChangeManagementGroupDAO cmGroupDao;
@Autowired
- ChangeManagementChangeWindowDAO cmChangeWindowDAO;
+ ChangeManagementChangeWindowDAO cmChangeWindowDao;
@Autowired
- ChangeManagementDetailDAO cmDetailsDAO;
+ ChangeManagementDetailDAO cmDetailsDao;
@Autowired
- ScheduleQueryDAO scheduleQueryDAO;
+ ScheduleQueryDAO scheduleQueryDao;
@Autowired
- ScheduleDAO scheduleDAO;
+ ScheduleDAO scheduleDao;
@Autowired
- ElementDataDAO elementDataDAO;
+ ElementDataDAO elementDataDao;
@Autowired
TmClient tmClient;
cmg.setNormalDurationInSecs(schedulingInfo.getNormalDurationInSeconds());
cmg.setAdditionalDurationInSecs(schedulingInfo.getAdditionalDurationInSeconds());
cmg.setConcurrencyLimit(schedulingInfo.getConcurrencyLimit());
- cmGroupDAO.save(cmg);
+ cmGroupDao.save(cmg);
for (ChangeWindow cw : schedulingInfo.getChangeWindows()) {
ChangeManagementChangeWindow cmcw = new ChangeManagementChangeWindow();
cmcw.setUuid(UUID.randomUUID());
cmcw.setChangeManagementGroupUuid(cmg.getUuid());
cmcw.setStartTimeMillis(cw.getStartTime().getTime());
cmcw.setFinishTimeMillis(cw.getEndTime().getTime());
- cmChangeWindowDAO.save(cmcw);
+ cmChangeWindowDao.save(cmcw);
}
for (ElementInfo element : groups.get(groupId)) {
cms.setVnfName(element.getElementId());
cms.setStatus(CMSStatusEnum.PendingSchedule.toString());
cms.setRequest(element.getRequest().toString());
- cmScheduleDAO.save(cms);
+ cmScheduleDao.save(cms);
// Save elementData
saveElementData(cms, element);
}
ed.setName(nv.getName());
// TODO Save as JSON
ed.setValue(nv.getValue().toString());
- elementDataDAO.save(ed);
+ elementDataDao.save(ed);
}
}
cmg.setFinishTimeMillis(System.currentTimeMillis() + ((duration * 1000) + (backout * 1000)));
cmg.setNormalDurationInSecs(duration);
cmg.setAdditionalDurationInSecs(backout);
- cmGroupDAO.save(cmg);
+ cmGroupDao.save(cmg);
for (ElementInfo element : groups.get(groupId)) {
ChangeManagementSchedule cms = new ChangeManagementSchedule();
cms.setUuid(UUID.randomUUID());
cms.setVnfName(element.getElementId());
cms.setRequest(element.getRequest().toString());
cms.setStatus(CMSStatusEnum.PendingApproval.toString());
- cmScheduleDAO.save(cms);
+ cmScheduleDao.save(cms);
}
schedule.setStatus(CMSStatusEnum.PendingApproval.toString());
- scheduleDAO.save(schedule);
+ scheduleDao.save(schedule);
}
}
protected void deleteChangeManagement(Schedule schedule) throws CMSException {
- List<ChangeManagementGroup> cmgs = cmGroupDAO.findBySchedulesID(schedule.getUuid());
+ List<ChangeManagementGroup> cmgs = cmGroupDao.findBySchedulesId(schedule.getUuid());
for (ChangeManagementGroup cmg : cmgs) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(cmg.getUuid());
+ List<ChangeManagementSchedule> schedules = cmScheduleDao.findByChangeManagementGroupId(cmg.getUuid());
for (ChangeManagementSchedule s : schedules) {
CMSStatusEnum currentState = CMSStatusEnum.Completed.fromString(s.getStatus());
switch (currentState) {
default:
s.setStatus(CMSStatusEnum.Deleted.toString());
}
- cmScheduleDAO.save(s);
+ cmScheduleDao.save(s);
}
}
protected void processApproveScheduleRequest(Schedule sch, ApprovalMessage approval, List<DomainData> domainData)
throws CMSException {
- sch = scheduleDAO.lockOne(sch.getUuid());
+ sch = scheduleDao.lockOne(sch.getUuid());
String domain = DomainsEnum.ChangeManagement.toString();
processApproval(sch, domain, approval);
if (sch.getStatus().equals(CMSStatusEnum.Accepted.toString())) {
Integer maxvnfsperticket = env.getProperty("tm.vnfs.per.ticket", Integer.class, 1);
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(sch.getUuid());
+ List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesId(sch.getUuid());
for (ChangeManagementGroup group : groups) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
+ List<ChangeManagementSchedule> schedules = cmScheduleDao.findByChangeManagementGroupId(group.getUuid());
List<List<ChangeManagementSchedule>> ticketList = new ArrayList<List<ChangeManagementSchedule>>();
List<ChangeManagementSchedule> current = null;
for (ChangeManagementSchedule cms : schedules) {
else {
cms.setStatus(CMSStatusEnum.Scheduled.toString());
}
- cmScheduleDAO.save(cms);
+ cmScheduleDao.save(cms);
}
schedule.setStatus(CMSStatusEnum.Scheduled.toString());
- scheduleDAO.save(schedule);
+ scheduleDao.save(schedule);
}
private void updateChangeManagementSchedules(Schedule sch, CMSStatusEnum approvalrejected) {
debug.debug("Entered updateChangeManagementSchedules");
- List<ChangeManagementGroup> groups = cmGroupDAO.findBySchedulesID(sch.getUuid());
+ List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesId(sch.getUuid());
for (ChangeManagementGroup group : groups) {
- List<ChangeManagementSchedule> schedules = cmScheduleDAO.findByChangeManagementGroupId(group.getUuid());
+ List<ChangeManagementSchedule> schedules = cmScheduleDao.findByChangeManagementGroupId(group.getUuid());
for (ChangeManagementSchedule schedule : schedules) {
schedule.setStatus(approvalrejected.toString());
- cmScheduleDAO.save(schedule);
+ cmScheduleDao.save(schedule);
}
}
debug.debug("Exited updateChangeManagementSchedules");
CmsoOptimizerClient optimizerClient;\r
\r
@Autowired\r
- ApprovalTypeDAO approvalTypeDAO;\r
+ ApprovalTypeDAO approvalTypeDao;\r
\r
@Autowired\r
Environment env;\r
String url = env.getProperty("spring.datasource.url");\r
hcc.setUrl(url);\r
try {\r
- approvalTypeDAO.findByDomain("HealthCheck");\r
+ approvalTypeDao.findByDomain("HealthCheck");\r
hcc.setHealthy(true);\r
hcc.setStatus("OK");\r
} catch (Exception e) {\r
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
*\r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property.\r
- * Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property.\r
+ * Modifications Copyright © 2018 IBM.\r
* \r
* Licensed under the Apache License, Version 2.0 (the "License");\r
* you may not use this file except in compliance with the License.\r
/*\r
- * Copyright � 2017-2018 AT&T Intellectual Property. Modifications Copyright � 2018 IBM.\r
+ * Copyright © 2017-2018 AT&T Intellectual Property. Modifications Copyright © 2018 IBM.\r
* \r
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except\r
* in compliance with the License. You may obtain a copy of the License at\r
}\r
Map<GroupAuditStatus, List<ChangeManagementGroup>> groupStatus =\r
new HashMap<GroupAuditStatus, List<ChangeManagementGroup>>();\r
- List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesID(uuid);\r
+ List<ChangeManagementGroup> groups = cmGroupDao.findBySchedulesId(uuid);\r
\r
// Close tickets for completed VNFs\r
for (ChangeManagementGroup group : groups) {\r