Reformat catalog-model
[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      * @param emptyString The empty string provided by jackson.
43      */
44     public Operation() {
45         super();
46     }
47
48     public Operation(OperationDataDefinition p) {
49         super(p);
50     }
51
52     public Operation(ArtifactDataDefinition implementation, String description, ListDataDefinition<OperationInputDefinition> inputs,
53                      ListDataDefinition<OperationOutputDefinition> outputs) {
54         super(description);
55         setImplementation(implementation);
56         setInputs(inputs);
57         setOutputs(outputs);
58     }
59
60     @Override
61     public boolean isDefinition() {
62         return false;
63     }
64
65     public void setDefinition(boolean definition) {
66         this.definition = definition;
67     }
68
69     @Override
70     public String toString() {
71         return "Operation [definition=" + definition + "]";
72     }
73
74     public ArtifactDefinition getImplementationArtifact() {
75         if (getImplementation() != null) {
76             return new ArtifactDefinition(getImplementation());
77         }
78         return null;
79     }
80 }