View Javadoc

1   package net.obsearch;
2   
3   /*
4    OBSearch: a distributed similarity search engine
5    This project is to similarity search what 'bit-torrent' is to downloads.
6    Copyright (C) 2007 Kyushu Institute of Technology
7   
8    This program is free software: you can redistribute it and/or modify
9    it under the terms of the GNU General Public License as published by
10   the Free Software Foundation, either version 3 of the License, or
11   (at your option) any later version.
12  
13   This program is distributed in the hope that it will be useful,
14   but WITHOUT ANY WARRANTY; without even the implied warranty of
15   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16   GNU General Public License for more details.
17  
18   You should have received a copy of the GNU General Public License
19   along with this program.  If not, see <http://www.gnu.org/licenses/>.
20   */
21  
22  /**
23   * This class is used to return the result of operations performed by OBSearch.
24   * The result also includes an id field that, depending on the operation returns
25   * the last inserted or deleted object.
26   * @author Arnoldo Jose Muller Molina
27   * @since 0
28   */
29  
30  public class OperationStatus {
31  
32      /**
33       * Status of the Operation
34       */
35      private Status status;
36  
37      /**
38       * Object id for relevant
39       */
40      private long id;
41      
42      /**
43       * Number of times this 
44       */
45      private long frequency;
46      
47      /**
48       * String message
49       */
50      private String msg = null;
51  
52      public String getMsg() {
53  		return msg;
54  	}
55  
56  	public void setMsg(String msg) {
57  		this.msg = msg;
58  	}
59  
60  	/**
61       * Creates a default status with status Status.Error
62       * and an id of -1.
63       */
64      public OperationStatus() {
65          this(Status.ERROR, -1);
66      }
67  
68      /**
69       * Initializes the object with the given
70       * status and an id of -1
71       * @param status The status that will be used.
72       */
73      public OperationStatus(Status status){
74          this(status, -1);
75      }
76      /**
77       * Creates a new status object.
78       * @param status The status the object will hold
79       * @param id The id of the affected object.
80       */
81      public OperationStatus(Status status, int id) {
82          this.status = status;
83          this.id = id;
84      }
85  
86      public Status getStatus() {
87          return status;
88      }
89  
90      public void setStatus(Status status) {
91          this.status = status;
92      }
93  
94      /**
95       * Sets the id returned in the enumeration.
96       * @param id
97       *                The new id.
98       */
99      public void setId(long id) {
100         this.id = id;
101     }
102 
103     /**
104      * Returns the id of the affected item of the operation -1 if the id does
105      * not apply.
106      * @return The id.
107      */
108     public long getId() {
109         return id;
110     }
111 }