OperationData.java
001 /*
002  *
003  * Licensed to the Apache Software Foundation (ASF) under one
004  * or more contributor license agreements.  See the NOTICE file
005  * distributed with this work for additional information
006  * regarding copyright ownership.  The ASF licenses this file
007  * to you under the Apache License, Version 2.0 (the
008  * "License"); you may not use this file except in compliance
009  * with the License.  You may obtain a copy of the License at
010  
011  *   http://www.apache.org/licenses/LICENSE-2.0
012  
013  * Unless required by applicable law or agreed to in writing,
014  * software distributed under the License is distributed on an
015  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
016  * KIND, either express or implied.  See the License for the
017  * specific language governing permissions and limitations
018  * under the License.
019  *
020  */
021 package org.apache.qpid.management.ui.model;
022 
023 import java.util.List;
024 
025 public class OperationData
026 {
027     private String _name;
028     private String _description;
029     private String _returnType;
030     private int    _impact;
031     private List<ParameterData> _parameters;
032  
033     public OperationData(String value)
034     {
035         this._name = value;
036     }
037     
038     public String getName()
039     {
040         return _name;
041     }
042     
043     public String getDescription()
044     {
045         return _description;
046     }
047     
048     public void setDescription(String description)
049     {
050         this._description = description;
051     }
052 
053     public List<ParameterData> getParameters()
054     {
055         return _parameters;
056     }
057 
058     public void setParameters(List<ParameterData> parameters)
059     {
060         this._parameters = parameters;
061     }
062 
063     public int getImpact()
064     {
065         return _impact;
066     }
067 
068     public void setImpact(int impact)
069     {
070         this._impact = impact;
071     }
072 
073     public String getReturnType()
074     {
075         return _returnType;
076     }
077 
078     public void setReturnType(String returnType)
079     {
080         this._returnType = returnType;
081     }
082     
083     public boolean isReturnTypeBoolean()
084     {
085         return (_returnType.equals("boolean"|| _returnType.equals("java.lang.Boolean"));
086     }
087     
088     public boolean isReturnTypeVoid()
089     {
090         return (_returnType.equals("void"|| _returnType.equals("java.lang.Void"));
091     }
092     
093     public Object getParameterValue(String paramName)
094     {
095         if (_parameters == null)
096         {
097             return null;
098         }
099         
100         for (int i = 0; i < _parameters.size(); i++)
101         {
102             if (paramName.equalsIgnoreCase(_parameters.get(i).getName()))
103             {
104                 return _parameters.get(i).getValue();
105             }
106         }
107         
108         return null;
109     }
110 }