/* * Copyright 2011 Research In Motion Limited. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package eclserver.db.objects; /** * * @author rbalsewich */ public class GroupObject { /** * Creates a new instance of ServerObject */ public GroupObject() { } public GroupObject(String groupName) { this(groupName, -1); } public GroupObject(String groupName, int id) { this.groupName = groupName; this.id = id; } public void setGroupName(String groupName) { this.groupName = groupName; } public String getGroupName() { return groupName; } public void setId(int id) { this.id = id; } public int getId() { return id; } public String getName() { return groupName; } public int hashCode() { int value = 1; value = value*PRIMENO + (groupName == null ? 0 : groupName.hashCode()); // don't use the id since this is generated by db return value; } public boolean equals(Object other) { boolean bEqual = false; if (this == other) { bEqual = true; } else if (other instanceof GroupObject) { GroupObject thatGroupObject = (GroupObject) other; if ((groupName == null ? thatGroupObject.groupName == null : groupName.equalsIgnoreCase(thatGroupObject.groupName))) { // don't use id in determining equality bEqual = true; } } return bEqual; } private String groupName; private int id; private static final int PRIMENO = 37; }