KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sync4j > framework > engine > dm > ManagementOperationResult


1 /**
2  * Copyright (C) 2003-2005 Funambol
3  *
4  * This program is free software; you can redistribute it and/or modify
5  * it under the terms of the GNU General Public License as published by
6  * the Free Software Foundation; either version 2 of the License, or
7  * (at your option) any later version.
8  *
9  * This program is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12  * GNU General Public License for more details.
13  *
14  * You should have received a copy of the GNU General Public License
15  * along with this program; if not, write to the Free Software
16  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17  */

18
19 package sync4j.framework.engine.dm;
20
21 import java.util.Map JavaDoc;
22 import java.util.HashMap JavaDoc;
23
24 /**
25  * This class represents the result of a single management operation.<br>
26  * Note that differently by the Results comand, which can hold multiple results,
27  * this object brings only one result.
28  *
29  * @author Stefano Fornari @ Funambol
30  *
31  * @version $Id: ManagementOperationResult.java,v 1.1 2005/05/16 17:32:55 nichele Exp $
32  */

33 public class ManagementOperationResult {
34     // -------------------------------------------------------------- Properties
35

36     /**
37      * The status code of the requested operation
38      */

39     private int statusCode;
40     
41     /**
42      * Sets statusCode
43      *
44      * @param statusCode the new statusCode
45      */

46     public void setStatusCode(int statusCode) {
47         this.statusCode = statusCode;
48     }
49     
50     /**
51      * Gets statusCode
52      *
53      * @return the current statusCode value
54      */

55     public int getStatusCode() {
56         return statusCode;
57     }
58     
59     /**
60      * The the requested command. One of "Add", "Copy", "Delete", "Exec",
61      * "Get", "Replace", "Sequence", "Atomic"
62      */

63     private String JavaDoc command;
64     
65     /**
66      * Sets command
67      *
68      * @param command the new command
69      */

70     public void setCommand(String JavaDoc command) {
71         this.command = command;
72     }
73     
74     /**
75      * Gets command
76      *
77      * @return the current command value
78      */

79     public String JavaDoc getCommand() {
80         return command;
81     }
82     
83     /**
84      * The nodes property. Note that it may contain results if the
85      * ManagementOperationStatus regards a Get or a set of nodes if it relates
86      * to a status of any command who specified items in it.
87      */

88     private Map JavaDoc nodes;
89     
90     /**
91      * Returns the nodes property
92      *
93      * @return the nodes property
94      */

95     public Map JavaDoc getNodes() {
96         return nodes;
97     }
98     
99     /**
100      * Set the nodes property
101      *
102      * @param newNodes the new values
103      */

104     public void setNodes(Map JavaDoc newNodes) {
105         this.nodes = new HashMap JavaDoc();
106         if (newNodes == null) {
107             return;
108         }
109         
110         nodes.putAll(newNodes);
111     }
112     
113     /**
114      * Addes the given nodes to the existing nodes. If no nodes were present,
115      * a new hash map is created to store them.
116      *
117      * @param newNodes the new values
118      */

119     public void addNodes(Map JavaDoc newNodes) {
120         if (nodes == null) {
121             nodes = new HashMap JavaDoc();
122         }
123         
124         nodes.putAll(newNodes);
125     }
126     
127     // ------------------------------------------------------------ Constructors
128

129     /** Creates a new instance of ManagementOperationResult */
130     public ManagementOperationResult() {
131         statusCode = -1;
132         command = null;
133         nodes = new HashMap JavaDoc();
134     }
135     
136     // ---------------------------------------------------------- Public methods
137

138 }
Popular Tags