AT&T 1712 and 1802 release code
[so.git] / adapters / mso-adapter-utils / src / main / java / org / openecomp / mso / cloudify / exceptions / MsoCloudifyTimeout.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * ONAP - SO
4  * ================================================================================
5  * Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6  * ================================================================================
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  *      http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  * ============LICENSE_END=========================================================
19  */
20
21 package org.openecomp.mso.cloudify.exceptions;
22
23 import org.openecomp.mso.cloudify.v3.model.Execution;
24 import org.openecomp.mso.openstack.exceptions.MsoException;
25 import org.openecomp.mso.openstack.exceptions.MsoExceptionCategory;
26
27 /**
28  * MSO Exception when a Cloudify workflow execution times out waiting for completion.
29  * Exception includes the last known state of the workflow execution.
30  */
31 public class MsoCloudifyTimeout extends MsoException
32 {
33         
34         /**
35      * Serialization id.
36      */
37     private static final long serialVersionUID = 3313636124141766495L;
38     
39         private Execution execution;
40
41         /**
42          * Constructor to create a new MsoOpenstackException instance
43          * @param code the error code
44          * @param message the error message
45          * @param detail error details
46          */
47         public MsoCloudifyTimeout (Execution execution) {
48                 // Set the detailed error as the Exception 'message'
49                 super("Cloudify Workflow Timeout for workflow " + execution.getWorkflowId() + " on deployment " + execution.getDeploymentId());
50                 super.category = MsoExceptionCategory.OPENSTACK;
51                 
52                 this.execution = execution;
53         }
54                 
55         public Execution getExecution() {
56                 return this.execution;
57         }
58         
59         @Override
60         public String toString () {
61                 String error = "Workflow timeout: workflow=" + execution.getWorkflowId() + ",deployment=" + execution.getDeploymentId();
62                 return error;
63         }
64 }