View Javadoc
1   /*
2    * Copyright (C) 2003-2007 eXo Platform SAS.
3    *
4    * This program is free software; you can redistribute it and/or
5    * modify it under the terms of the GNU Affero General Public License
6    * as published by the Free Software Foundation; either version 3
7    * of the License, or (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, see<http://www.gnu.org/licenses/>.
16   */
17  package org.exoplatform.services.cms.clipboard.jcr.model;
18  
19  public class ClipboardCommand {
20  
21    public static final String COPY      = "copy";
22  
23    public static final String CUT       = "cut";
24  
25    public static final String ADDSYMLINK = "AddSymLink";
26  
27    private String             type;
28  
29    private String             srcPath;
30  
31    private String             wsName    = null;
32  
33    public ClipboardCommand() {}
34    
35    public ClipboardCommand(String type, String path, String ws) {
36      this.type = type;
37      this.srcPath = path;
38      this.wsName = ws;
39    }
40  
41    public String getSrcPath() {
42      return srcPath;
43    }
44  
45    public void setSrcPath(String srcPath) {
46      this.srcPath = srcPath;
47    }
48  
49    public String getType() {
50      return type;
51    }
52  
53    public void setType(String type) {
54      this.type = type;
55    }
56  
57    public void setWorkspace(String ws) {
58      wsName = ws;
59    }
60  
61    public String getWorkspace() {
62      return wsName;
63    }
64    
65    public int hashCode() {
66      int ret = 0;
67      if (type != null) ret += type.hashCode();
68      if (wsName != null) ret += wsName.hashCode();
69      if (srcPath != null) ret += srcPath.hashCode();
70      return ret;
71    }
72    
73    public boolean equals(Object o) {
74      if (o != null && o instanceof ClipboardCommand) {
75        ClipboardCommand cObject = ClipboardCommand.class.cast(o);
76        if (wsName == null && cObject.wsName != null || wsName != null && cObject.wsName == null) return false;
77        if (srcPath == null && cObject.srcPath != null || srcPath != null && cObject.srcPath == null) return false;
78        return ((wsName == null && cObject.wsName == null) || (wsName.equals(cObject.wsName))) &&
79               ((srcPath == null && cObject.srcPath == null) || (srcPath.equals(cObject.srcPath)));
80      } else {
81        return false;
82      }
83    }
84  }