]> gerrit.simantics Code Review - simantics/platform.git/blob - bundles/org.simantics.db.procore/src/fi/vtt/simantics/procore/ProCoreSessionReference.java
Fail safe import fixes made by Antti
[simantics/platform.git] / bundles / org.simantics.db.procore / src / fi / vtt / simantics / procore / ProCoreSessionReference.java
1 /*******************************************************************************
2  * Copyright (c) 2007, 2010 Association for Decentralized Information Management
3  * in Industry THTH ry.
4  * All rights reserved. This program and the accompanying materials
5  * are made available under the terms of the Eclipse Public License v1.0
6  * which accompanies this distribution, and is available at
7  * http://www.eclipse.org/legal/epl-v10.html
8  *
9  * Contributors:
10  *     VTT Technical Research Centre of Finland - initial API and implementation
11  *******************************************************************************/
12 package fi.vtt.simantics.procore;
13
14 import org.simantics.db.ServerReference;
15 import org.simantics.db.SessionReference;
16
17
18 /**
19  * @author Toni Kalajainen
20  */
21 public class ProCoreSessionReference implements SessionReference {
22
23     public final ProCoreServerReference serverReference;
24
25     public final long sessionId;
26
27     public ProCoreSessionReference(ProCoreServerReference serverReference, long sessionId) {
28         assert(serverReference!=null);
29         this.serverReference = serverReference;
30         this.sessionId = sessionId;
31     }
32
33     @Override
34     public String toString() {
35         return serverReference+"/"+sessionId;
36     }
37
38     @Override
39     public int hashCode() {
40         return super.hashCode();
41     }
42
43     @Override
44     public boolean equals(Object other) {
45         if (this == other) return true;
46         if (other == null || !(getClass().equals(other.getClass()))) return false;
47         ProCoreSessionReference r = (ProCoreSessionReference) other;
48         return r.sessionId==sessionId && r.serverReference.equals(serverReference);
49     }
50
51     @Override
52     public ServerReference getServerReference() {
53         return serverReference;
54     }
55
56     public long getSessionId() {
57         return sessionId;
58     }
59
60 }