066cd67fec8fd6789ac8b8d6aa4be336a92186e1
[sdc.git] / catalog-model / src / main / java / org / openecomp / sdc / be / model / Operation.java
1 /*-
2  * ============LICENSE_START=======================================================
3  * SDC
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.sdc.be.model;
22
23 import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
24 import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
25 import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
26 import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
27
28 /**
29  * Defines an operation available to manage particular aspects of the Node Type.
30  *
31  * @author esofer
32  */
33 public class Operation extends OperationDataDefinition implements IOperationParameter {
34
35
36
37         private boolean definition;
38
39         /**
40          * <p>
41          * Jackson DeSerialization workaround constructor to create an operation
42          * with no arguments.
43          * </p>
44          *
45          * @param emptyString
46          *            The empty string provided by jackson.
47          */
48         public Operation() {
49                 super();
50         }
51
52         public Operation(OperationDataDefinition p) {
53                 super(p);
54         }
55
56         public Operation(ArtifactDataDefinition implementation, String description,
57                 ListDataDefinition<OperationInputDefinition> inputs) {
58                 super(description);
59                 setImplementation(implementation);
60                 setInputs(inputs);
61         }
62
63         @Override
64         public boolean isDefinition() {
65                 return false;
66         }
67
68         public void setDefinition(boolean definition) {
69                 this.definition = definition;
70         }
71
72         @Override
73         public String toString() {
74                 return "Operation [definition=" + definition + "]";
75         }
76
77         public ArtifactDefinition getImplementationArtifact(){
78                 if ( getImplementation() != null ){
79                         return new ArtifactDefinition(getImplementation());
80                 }
81                 return null;
82         }
83 }