c2698c026a935f9b82b86179e987f7e0d6272c7f
[ccsdk/cds.git] /
1 /*
2  *  Copyright © 2017-2018 AT&T Intellectual Property.
3  *  Modifications Copyright © 2018 IBM.
4  *
5  *  Licensed under the Apache License, Version 2.0 (the "License");
6  *  you may not use this file except in compliance with the License.
7  *  You may obtain a copy of the License at
8  *
9  *      http://www.apache.org/licenses/LICENSE-2.0
10  *
11  *  Unless required by applicable law or agreed to in writing, software
12  *  distributed under the License is distributed on an "AS IS" BASIS,
13  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  *  See the License for the specific language governing permissions and
15  *  limitations under the License.
16  */
17
18 package org.onap.ccsdk.cds.blueprintsprocessor.core.api.data
19
20 import com.fasterxml.jackson.annotation.JsonFormat
21 import com.fasterxml.jackson.databind.JsonNode
22 import com.fasterxml.jackson.databind.node.ObjectNode
23 import io.swagger.annotations.ApiModelProperty
24 import java.util.*
25
26 /**
27  * BlueprintProcessorData
28  * @author Brinda Santh
29  * DATE : 8/15/2018
30  */
31
32 open class ExecutionServiceInput {
33     @get:ApiModelProperty(required = true)
34     lateinit var commonHeader: CommonHeader
35     @get:ApiModelProperty(required = true)
36     lateinit var actionIdentifiers: ActionIdentifiers
37     @get:ApiModelProperty(required = true)
38     lateinit var payload: ObjectNode
39     var stepData: StepData? = null
40 }
41
42 open class ExecutionServiceOutput {
43     @get:ApiModelProperty(required = true)
44     lateinit var commonHeader: CommonHeader
45     @get:ApiModelProperty(required = true)
46     lateinit var actionIdentifiers: ActionIdentifiers
47     @get:ApiModelProperty(required = true)
48     lateinit var status: Status
49     @get:ApiModelProperty(required = true)
50     lateinit var payload: ObjectNode
51     var stepData: StepData? = null
52 }
53
54 const val ACTION_MODE_ASYNC = "async"
55 const val ACTION_MODE_SYNC = "sync"
56
57 open class ActionIdentifiers {
58     @get:ApiModelProperty(required = false)
59     lateinit var blueprintName: String
60     @get:ApiModelProperty(required = false)
61     lateinit var blueprintVersion: String
62     @get:ApiModelProperty(required = true)
63     lateinit var actionName: String
64     @get:ApiModelProperty(required = true, allowableValues = "sync, async")
65     lateinit var mode: String
66 }
67
68 open class CommonHeader {
69     @get:ApiModelProperty(required = true, example = "2012-04-23T18:25:43.511Z")
70     @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
71     var timestamp: Date = Date()
72     @get:ApiModelProperty(required = true)
73     lateinit var originatorId: String
74     @get:ApiModelProperty(required = true)
75     lateinit var requestId: String
76     @get:ApiModelProperty(required = true)
77     lateinit var subRequestId: String
78     @get:ApiModelProperty(required = false)
79     var flags: Flags? = null
80 }
81
82 open class Flags {
83     var isForce: Boolean = false
84     @get:ApiModelProperty(value = "3600")
85     var ttl: Int = 3600
86 }
87
88 open class Status {
89     @get:ApiModelProperty(required = true)
90     var code: Int = 200
91     @get:ApiModelProperty(required = true)
92     var eventType: String = ""
93     @get:ApiModelProperty(required = true, example = "2012-04-23T18:25:43.511Z")
94     @get:JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'")
95     var timestamp: Date = Date()
96     @get:ApiModelProperty(required = false)
97     var errorMessage: String? = null
98     @get:ApiModelProperty(required = true)
99     var message: String = "success"
100 }
101
102 open class StepData {
103     lateinit var name: String
104     var properties: MutableMap<String, JsonNode> = mutableMapOf()
105 }
106
107