KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > enhydra > shark > ParticipantMapImpl


1 package org.enhydra.shark;
2
3 import org.enhydra.shark.api.client.wfservice.ParticipantMap;
4
5 /**
6  * Implementation of ParticipantMap interface.
7  * @author Zoran Milakovic
8  */

9 public class ParticipantMapImpl
10     implements ParticipantMap {
11
12    private String JavaDoc participantId;
13    private String JavaDoc packageId;
14    private String JavaDoc processDefinitionId;
15    private String JavaDoc username;
16    private boolean isGroupUser;
17
18    protected ParticipantMapImpl() {
19    }
20
21    public void setParticipantId( String JavaDoc id ) {
22       this.participantId = id;
23    }
24
25    public String JavaDoc getParticipantId() {
26       return this.participantId;
27    }
28
29    public void setPackageId( String JavaDoc id ) {
30          this.packageId = id;
31    }
32
33    public String JavaDoc getPackageId() {
34       return this.packageId;
35    }
36
37    public void setProcessDefinitionId( String JavaDoc id ) {
38       this.processDefinitionId = id;
39    }
40
41    public String JavaDoc getProcessDefinitionId() {
42       return this.processDefinitionId;
43    }
44
45    public void setUsername( String JavaDoc username ) {
46       this.username = username;
47    }
48
49    public String JavaDoc getUsername() {
50       return this.username;
51    }
52
53    public boolean getIsGroupUser() {
54       return this.isGroupUser;
55    }
56
57    public void setIsGroupUser(boolean isGroupUser) {
58       this.isGroupUser = isGroupUser;
59    }
60
61    public boolean equals(Object JavaDoc obj) {
62       ParticipantMap pm;
63       if( obj instanceof ParticipantMap ) {
64          pm = ( ParticipantMap ) obj;
65       if(
66              compareValues(this.packageId, pm.getPackageId()) &&
67              compareValues(this.participantId, pm.getParticipantId()) &&
68              compareValues(this.processDefinitionId, pm.getProcessDefinitionId()) &&
69              compareValues(this.username, pm.getUsername()) &&
70              this.isGroupUser == pm.getIsGroupUser() )
71          return true;
72       }
73       return false;
74    }
75
76    /**
77    * Compare two values.
78    * @param valA first value
79    * @param valB second value
80    * @return true if values are equal, false otherwise
81    */

82    private boolean compareValues(Object JavaDoc valA, Object JavaDoc valB) {
83     boolean retVal = false;
84
85     if( valA == null && valB == null )
86       retVal = true;
87     else if( valA == null && valB != null )
88       retVal = false;
89     else if( valA != null && valB == null )
90       retVal = false;
91     else if( valA.equals(valB) )
92       retVal = true;
93
94     return retVal;
95   }
96
97 }
98
Popular Tags