92c7c5972d69abec4670469fbbc25c4007fc90a4
[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 package org.openecomp.sdc.be.model;
21
22 import org.openecomp.sdc.be.datatypes.elements.ArtifactDataDefinition;
23 import org.openecomp.sdc.be.datatypes.elements.ListDataDefinition;
24 import org.openecomp.sdc.be.datatypes.elements.OperationDataDefinition;
25 import org.openecomp.sdc.be.datatypes.elements.OperationInputDefinition;
26 import org.openecomp.sdc.be.datatypes.elements.OperationOutputDefinition;
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     private boolean definition;
36
37     /**
38      * <p>
39      * Jackson DeSerialization workaround constructor to create an operation with no arguments.
40      * </p>
41      */
42     public Operation() {
43         super();
44     }
45
46     public Operation(OperationDataDefinition p) {
47         super(p);
48     }
49
50     public Operation(ArtifactDataDefinition implementation, String description, ListDataDefinition<OperationInputDefinition> inputs,
51                      ListDataDefinition<OperationOutputDefinition> outputs) {
52         super(description);
53         setImplementation(implementation);
54         setInputs(inputs);
55         setOutputs(outputs);
56     }
57
58     @Override
59     public boolean isDefinition() {
60         return false;
61     }
62
63     public void setDefinition(boolean definition) {
64         this.definition = definition;
65     }
66
67     @Override
68     public String toString() {
69         return "Operation [definition=" + definition + "]";
70     }
71
72     public ArtifactDefinition getImplementationArtifact() {
73         if (getImplementation() != null) {
74             return new ArtifactDefinition(getImplementation());
75         }
76         return null;
77     }
78 }