align logic to new so api
[vid.git] / vid-app-common / src / main / java / org / onap / vid / model / SOWorkflows.kt
1 /*-
2  * ============LICENSE_START=======================================================
3  * VID
4  * ================================================================================
5  * Copyright (C) 2019 Nokia 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.onap.vid.model
22
23 import com.google.common.collect.Lists
24
25 enum class WorkflowSource(val source: String) {
26     SDC("sdc"), NATIVE("native")
27 }
28
29 data class SOWorkflow constructor(
30         val id: String,
31         val name: String,
32         val source: WorkflowSource,
33         val workflowInputParameters: List<WorkflowInputParameter>
34 ) {
35     fun clone(): SOWorkflow {
36         return copy()
37     }
38 }
39
40 data class SOWorkflows @JvmOverloads constructor(
41         val workflows: List<SOWorkflow> = emptyList()) {
42     fun clone(): SOWorkflows {
43         return copy(workflows.toMutableList())
44     }
45 }
46
47 enum class SOWorkflowType(
48         val type: String) {
49     STRING("STRING")
50 }
51
52 enum class LocalWorkflowType(
53         val type: String) {
54     STRING("STRING"),
55     FILE("FILE")
56 }
57
58 data class SOWorkflowParameterDefinition constructor(
59         val id: Long,
60         val name: String,
61         val pattern: String,
62         val type: SOWorkflowType,
63         val required: Boolean)
64
65 data class SOWorkflowParameterDefinitions constructor(
66         val parameterDefinitions: List<SOWorkflowParameterDefinition> = emptyList()) {
67     fun clone(): SOWorkflowParameterDefinitions {
68         return copy(parameterDefinitions.toMutableList())
69     }
70 }
71
72 data class LocalWorkflowParameterDefinition @JvmOverloads constructor(
73         val id: Long,
74         val name: String,
75         val required: Boolean,
76         val type: LocalWorkflowType,
77         val pattern: String? = null,
78         val msgOnPatternError: String? = null,
79         val msgOnContentError: String? = null,
80         val acceptableFileType: String? = null
81 )
82
83 data class LocalWorkflowParameterDefinitions constructor(
84         val parameterDefinitions: List<LocalWorkflowParameterDefinition> = emptyList()
85 ) {
86     fun clone(): LocalWorkflowParameterDefinitions {
87         return copy(parameterDefinitions.toMutableList())
88     }
89 }
90
91
92 data class ArtifactInfo constructor(
93         val artifactType: String,
94         val artifactUuid: String,
95         val artifactName: String,
96         val artifactVersion: String,
97         val artifactDescription: String? = null,
98         val workflowName: String,
99         val operationName: String? = null,
100         val workflowSource: String,
101         val workflowResourceTarget: String
102 )
103
104 data class ActivitySequenceItem constructor(
105         val name: String,
106         val description: String
107 )
108
109 data class WorkflowInputParameter constructor(
110         val label: String,
111         val inputType: String,
112         val required: Boolean,
113         val validation: List<InputParameterValidation>? = Lists.newArrayList(),
114         val soFieldName: String,
115         val soPayloadLocation: String?,
116         val description: String?
117
118 )
119
120 data class InputParameterValidation constructor(
121         val maxLength: String?,
122         val allowableChars: String?
123 )
124
125 data class WorkflowSpecification constructor(
126         val artifactInfo: ArtifactInfo,
127         val activitySequence: List<ActivitySequenceItem>? = Lists.newArrayList(),
128         val workflowInputParameters: List<WorkflowInputParameter>
129 )
130
131 data class WorkflowSpecificationWrapper constructor(
132         val workflowSpecification: WorkflowSpecification
133 )
134
135 data class SOWorkflowList constructor(
136         val workflowSpecificationList: List<WorkflowSpecificationWrapper>? = Lists.newArrayList()
137 )