adminentitypk.java

来自「一个免费的CA,基于EJB平台的,老师叫我们测试,现把之共享出来让大家参考」· Java 代码 · 共 85 行

JAVA
85
字号
/************************************************************************* *                                                                       * *  EJBCA: The OpenSource Certificate Authority                          * *                                                                       * *  This software is free software; you can redistribute it and/or       * *  modify it under the terms of the GNU Lesser General Public           * *  License as published by the Free Software Foundation; either         * *  version 2.1 of the License, or any later version.                    * *                                                                       * *  See terms of license at gnu.org.                                     * *                                                                       * *************************************************************************/ package org.ejbca.core.ejb.authorization;/** * The current pk in AdminEntityData and AccessRulesData is a mix of integer pk and  * constraints and actually works fine.  * It's used like a primitive int primary key in the db, but embeds logic for  * enforcing constraints, which would otherwise have to be programatically added to the beans. * If needed it can easily be replaced with an int pk and programatic logic to handle  * constraints. From the database view the pk is just an int. *  * @version $Id: AdminEntityPK.java,v 1.1 2006/01/17 20:30:04 anatom Exp $ */public final class AdminEntityPK implements java.io.Serializable {    public int primKey;    public AdminEntityPK(String admingroupname, int caid, int matchwith, int matchtype, String matchvalue) {        this.primKey =        ((admingroupname==null?0:admingroupname.hashCode())        ^        (caid)        ^        (matchwith)        ^        (matchvalue==null?0:matchvalue.hashCode())        ^        (matchtype));    }    public AdminEntityPK() {    }    public int getPrimKey()	{    	return primKey;    }    public void setPrimKey(int primKey)	{    	this.primKey = primKey;    }    /**     * @see java.lang.Object#equals(java.lang.Object)     */    public boolean equals(java.lang.Object otherOb) {        if (!(otherOb instanceof org.ejbca.core.ejb.authorization.AdminEntityPK)) {            return false;        }        org.ejbca.core.ejb.authorization.AdminEntityPK other = (org.ejbca.core.ejb.authorization.AdminEntityPK) otherOb;        return (this.primKey == other.primKey);    }    /**     * @see java.lang.Object#hashCode()     */    public int hashCode() {        return this.primKey;    }    /** @return String representation of this pk in the form of [.field1.field2.field3]. */    public String toString()	{    	StringBuffer toStringValue = new StringBuffer("[.");    	toStringValue.append(this.primKey).append('.');    	toStringValue.append(']');    	return toStringValue.toString();    }    }

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?