You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jetspeed-dev@portals.apache.org by rw...@apache.org on 2009/02/08 22:28:38 UTC
svn commit: r742172 [4/7] - in
/portals/jetspeed-2/portal/branches/JPA_BRANCH: ./
components/jetspeed-page-manager/
components/jetspeed-page-manager/src/main/java/org/apache/jetspeed/page/jpa/
components/jetspeed-profiler/ components/jetspeed-profiler/...
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java?rev=742172&r1=742171&r2=742172&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialManagerImpl.java Sun Feb 8 21:28:35 2009
@@ -16,10 +16,6 @@
*/
package org.apache.jetspeed.security.spi.impl;
-import org.apache.jetspeed.security.JetspeedPrincipalType;
-import org.apache.jetspeed.security.PasswordCredential;
-import org.apache.jetspeed.security.SecurityException;
-import org.apache.jetspeed.security.User;
import org.apache.jetspeed.security.spi.UserPasswordCredentialAccessManager;
import org.apache.jetspeed.security.spi.UserPasswordCredentialManager;
import org.apache.jetspeed.security.spi.UserPasswordCredentialPolicyManager;
@@ -28,102 +24,17 @@
/**
* @version $Id$
*/
-public class UserPasswordCredentialManagerImpl implements UserPasswordCredentialManager
+public class UserPasswordCredentialManagerImpl extends AbstractUserPasswordCredentialManagerImpl implements UserPasswordCredentialManager
{
- private UserPasswordCredentialStorageManager upcsm;
- private UserPasswordCredentialAccessManager upcam;
- private UserPasswordCredentialPolicyManager upcpm;
-
+ private static final long serialVersionUID = -428538555483903694L;
+
public UserPasswordCredentialManagerImpl(UserPasswordCredentialStorageManager upcsm, UserPasswordCredentialAccessManager upcam)
{
- this.upcsm = upcsm;
- this.upcam = upcam;
+ super(upcsm, upcam);
}
public UserPasswordCredentialManagerImpl(UserPasswordCredentialStorageManager upcsm, UserPasswordCredentialAccessManager upcam, UserPasswordCredentialPolicyManager upcpm)
{
- this(upcsm, upcam);
- this.upcpm = upcpm;
- }
-
- public PasswordCredential getPasswordCredential(User user) throws SecurityException
- {
- PasswordCredential credential = upcsm.getPasswordCredential(user);
- if (!credential.isNew() && upcpm != null)
- {
- upcpm.onLoad(credential, user.getName());
- }
- return credential;
- }
-
- public void storePasswordCredential(PasswordCredential credential) throws SecurityException
- {
- if (upcpm != null)
- {
- upcpm.onStore(credential);
- }
- upcsm.storePasswordCredential(credential);
- }
-
- public PasswordCredential getAuthenticatedPasswordCredential(String userName, String password) throws SecurityException
- {
- PasswordCredential credential = upcam.getPasswordCredential(userName);
- if (credential == null)
- {
- throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.USER, userName));
- }
-
- if (upcpm != null)
- {
- if (upcpm.onLoad(credential, userName))
- {
- upcsm.storePasswordCredential(credential);
- }
- if (credential.isEnabled() && !credential.isExpired())
- {
- if (upcpm.authenticate(credential, userName, password))
- {
- upcsm.storePasswordCredential(credential);
- }
- if (!credential.isEnabled() || credential.isExpired())
- {
- throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.USER, userName));
- }
- else if (credential.getAuthenticationFailures() != 0)
- {
- throw new SecurityException(SecurityException.INVALID_PASSWORD);
- }
- }
- }
- else
- {
- if (password == null)
- {
- throw new SecurityException(SecurityException.PASSWORD_REQUIRED);
- }
- else if (credential.getPassword() == null || !password.equals(new String(credential.getPassword())))
- {
- throw new SecurityException(SecurityException.INVALID_PASSWORD);
- }
- if (!credential.isEnabled() || credential.isExpired())
- {
- throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.USER, userName));
- }
- }
-
- try
- {
- upcam.loadPasswordCredentialUser(credential);
- }
- catch (Exception e)
- {
- throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.USER, userName), e);
- }
-
- if (credential.getUser() == null || !credential.getUser().isEnabled())
- {
- throw new SecurityException(SecurityException.PRINCIPAL_DOES_NOT_EXIST.createScoped(JetspeedPrincipalType.USER, userName));
- }
- return credential;
+ super(upcsm, upcam, upcpm);
}
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java?rev=742172&r1=742171&r2=742172&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserPasswordCredentialPolicyManagerImpl.java Sun Feb 8 21:28:35 2009
@@ -17,202 +17,27 @@
package org.apache.jetspeed.security.spi.impl;
-import java.sql.Timestamp;
-import java.util.Date;
import java.util.List;
import org.apache.jetspeed.security.CredentialPasswordEncoder;
import org.apache.jetspeed.security.CredentialPasswordValidator;
-import org.apache.jetspeed.security.InvalidPasswordException;
-import org.apache.jetspeed.security.PasswordCredential;
-import org.apache.jetspeed.security.SecurityException;
-import org.apache.jetspeed.security.spi.AlgorithmUpgradeCredentialPasswordEncoder;
-import org.apache.jetspeed.security.spi.PasswordCredentialInterceptor;
import org.apache.jetspeed.security.spi.UserPasswordCredentialPolicyManager;
/**
* @version $Id$
*
*/
-public class UserPasswordCredentialPolicyManagerImpl implements UserPasswordCredentialPolicyManager
+public class UserPasswordCredentialPolicyManagerImpl extends AbstractUserPasswordCredentialPolicyManagerImpl implements UserPasswordCredentialPolicyManager
{
- private CredentialPasswordEncoder encoder;
- private CredentialPasswordValidator validator;
- private PasswordCredentialInterceptor[] interceptors;
-
+ private static final long serialVersionUID = -1131501613870453331L;
+
public UserPasswordCredentialPolicyManagerImpl()
{
- this.interceptors = new PasswordCredentialInterceptor[0];
+ super();
}
public UserPasswordCredentialPolicyManagerImpl(CredentialPasswordEncoder encoder, CredentialPasswordValidator validator, List<?> interceptors)
{
- this.encoder = encoder;
- this.validator = validator;
- if(interceptors !=null)
- {
- this.interceptors = (PasswordCredentialInterceptor[]) interceptors.toArray(new PasswordCredentialInterceptor[interceptors.size()]);
- }
- else
- {
- this.interceptors = new PasswordCredentialInterceptor[0];
- }
- }
-
- public CredentialPasswordEncoder getCredentialPasswordEncoder()
- {
- return encoder;
- }
-
- public CredentialPasswordValidator getCredentialPasswordValidator()
- {
- return validator;
- }
-
- public boolean onLoad(PasswordCredential credential, String userName) throws SecurityException
- {
- boolean update = false;
- for (PasswordCredentialInterceptor pci : interceptors)
- {
- if (pci.afterLoad(userName, credential, encoder, validator))
- {
- update = true;
- }
- }
- return update;
- }
-
- public boolean authenticate(PasswordCredential credential, String userName, String password) throws SecurityException
- {
- String encodedPassword = password;
- boolean authenticated = false;
- if (encoder != null && credential.isEncoded())
- {
- if (encoder instanceof AlgorithmUpgradeCredentialPasswordEncoder)
- {
- encodedPassword = ((AlgorithmUpgradeCredentialPasswordEncoder)encoder).encode(credential, password);
- }
- else
- {
- encodedPassword = encoder.encode(userName, password);
- }
- authenticated = credential.getPassword().equals(encodedPassword);
- }
- boolean update = false;
-
- for (PasswordCredentialInterceptor pci : interceptors)
- {
- if (pci.afterAuthenticated(credential, authenticated))
- {
- update = true;
- }
- }
- if (update && (!credential.isEnabled() || credential.isExpired()))
- {
- authenticated = false;
- }
-
- if (authenticated)
- {
- credential.setAuthenticationFailures(0);
- if (encoder != null && encoder instanceof AlgorithmUpgradeCredentialPasswordEncoder)
- {
- ((AlgorithmUpgradeCredentialPasswordEncoder)encoder).recodeIfNeeded(credential, password);
- credential.clearNewPasswordSet();
- }
- credential.setPreviousAuthenticationDate(credential.getLastAuthenticationDate());
- credential.setLastAuthenticationDate(new Timestamp(new Date().getTime()));
- update = true;
- }else{
- credential.setAuthenticationFailures(credential.getAuthenticationFailures()+1);
- }
-
- return update;
- }
-
- public void onStore(PasswordCredential credential) throws SecurityException
- {
- if (credential.isNewPasswordSet())
- {
- String newPassword = null;
- boolean authenticated = false;
- if (credential.getNewPassword() != null)
- {
- if (credential.getOldPassword() != null)
- {
- authenticated = true;
- String validatingOldPassword = credential.getOldPassword();
- if (credential.isEncoded() && encoder != null)
- {
- if (encoder instanceof AlgorithmUpgradeCredentialPasswordEncoder)
- {
- validatingOldPassword = ((AlgorithmUpgradeCredentialPasswordEncoder)encoder).encode(credential, validatingOldPassword);
- }
- else
- {
- validatingOldPassword = encoder.encode(credential.getUserName(), validatingOldPassword);
- }
- }
- if (credential.getPassword() == null || !credential.getPassword().equals(validatingOldPassword))
- {
- throw new InvalidPasswordException();
- }
- }
- if (validator != null)
- {
- validator.validate(credential.getNewPassword());
- }
- newPassword = credential.getNewPassword();
- if (encoder != null)
- {
- newPassword = encoder.encode(credential.getUserName(), newPassword);
- }
-
- }
- else
- {
- newPassword = credential.getPassword();
- if (encoder != null && !credential.isEncoded())
- {
- newPassword = encoder.encode(credential.getUserName(), newPassword);
- }
- }
-
- if (!credential.isNew())
- {
- credential.revertNewPasswordSet();
- for (PasswordCredentialInterceptor pci : interceptors)
- {
- pci.beforeSetPassword(credential, newPassword, authenticated);
- }
- credential.setUpdateRequired(false);
- }
- credential.setPassword(newPassword, encoder != null);
- credential.clearNewPasswordSet();
- if (!authenticated)
- {
- if (encoder != null && encoder instanceof AlgorithmUpgradeCredentialPasswordEncoder)
- {
- // set current time in previous auth date, and clear last authentication date
- // !!! While this might be a bit strange logic, it is *required* for the AlgorithmUpgradePBEPasswordEncodingService
- // to be able to distinguise password changes from other changes
- credential.setPreviousAuthenticationDate(new Timestamp(new Date().getTime()));
- credential.setLastAuthenticationDate(null);
- }
- }
- else
- {
- // authenticated password change (by user itself)
- credential.setPreviousAuthenticationDate(credential.getLastAuthenticationDate());
- credential.setLastAuthenticationDate(new Timestamp(new Date().getTime()));
- }
- }
- if (credential.isNew())
- {
- for (PasswordCredentialInterceptor pci : interceptors)
- {
- pci.beforeCreate(credential);
- }
- }
+ super(encoder, validator, interceptors);
}
}
Modified: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserSubjectPrincipalsResolverImpl.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserSubjectPrincipalsResolverImpl.java?rev=742172&r1=742171&r2=742172&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserSubjectPrincipalsResolverImpl.java (original)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/impl/UserSubjectPrincipalsResolverImpl.java Sun Feb 8 21:28:35 2009
@@ -145,15 +145,16 @@
protected void processFound(List<JetspeedPrincipal> found, User user, Set<Long> resolvedIds, Set<Principal> principals, Map<String, UserSubjectPrincipalsResolver> resolvers)
{
- for (int i = found.size() -1; i > -1; i--)
+ ArrayList<JetspeedPrincipal> mutableFoundList = new ArrayList<JetspeedPrincipal>(found);
+ for (int i = mutableFoundList.size() -1; i > -1; i--)
{
- JetspeedPrincipal p = found.get(i);
+ JetspeedPrincipal p = mutableFoundList.get(i);
if (!p.isEnabled() || !resolvers.containsKey(p.getType().getName()) || !resolvedIds.add(p.getId()))
{
- found.remove(i);
+ mutableFoundList.remove(i);
}
}
- for (JetspeedPrincipal p : found)
+ for (JetspeedPrincipal p : mutableFoundList)
{
resolvers.get(p.getType().getName()).processPrincipal(p, user, resolvedIds, principals, resolvers);
}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalAssociation.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalAssociation.java?rev=742172&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalAssociation.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalAssociation.java Sun Feb 8 21:28:35 2009
@@ -0,0 +1,110 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.jetspeed.security.spi.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.NamedQuery;
+import javax.persistence.NamedQueries;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import org.apache.jetspeed.security.JetspeedPrincipal;
+
+/**
+ * @version $Id$
+ */
+@Entity (name="PrincipalAssociation")
+@IdClass (value=JetspeedPrincipalAssociation.JetspeedPrincipalAssociationId.class)
+@Table (name="SECURITY_PRINCIPAL_ASSOC")
+@NamedQueries ({@NamedQuery(name="PRINCIPAL_ASSOCIATION", query="select pa from PrincipalAssociation pa where pa.fromPrincipalId = :fromPrincipalId and pa.toPrincipalId = :toPrincipalId and pa.associationName = :associationName")})
+public class JetspeedPrincipalAssociation implements Serializable
+{
+ private static final long serialVersionUID = 1L;
+
+ // Members
+
+ @Id
+ @Column (name="FROM_PRINCIPAL_ID")
+ @SuppressWarnings("unused")
+ private Long fromPrincipalId;
+ @Id
+ @Column (name="TO_PRINCIPAL_ID")
+ @SuppressWarnings("unused")
+ private Long toPrincipalId;
+ @Id
+ @Column (name="ASSOC_NAME")
+ @SuppressWarnings("unused")
+ private String associationName;
+ @Version
+ @Column (name="JPA_VERSION")
+ @SuppressWarnings("unused")
+ private int jpaVersion;
+
+ public static class JetspeedPrincipalAssociationId
+ {
+ public Long fromPrincipalId;
+ public Long toPrincipalId;
+ public String associationName;
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (!(o instanceof JetspeedPrincipalAssociationId))
+ {
+ return false;
+ }
+ JetspeedPrincipalAssociationId other = (JetspeedPrincipalAssociationId)o;
+ return (((fromPrincipalId == other.fromPrincipalId) || ((fromPrincipalId != null) && fromPrincipalId.equals(other.fromPrincipalId))) &&
+ ((toPrincipalId == other.toPrincipalId) || ((toPrincipalId != null) && toPrincipalId.equals(other.toPrincipalId))) &&
+ ((associationName == other.associationName) || ((associationName != null) && associationName.equals(other.associationName))));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return (((fromPrincipalId != null) ? fromPrincipalId.hashCode() : 0)^
+ ((toPrincipalId != null) ? toPrincipalId.hashCode() : 0)^
+ ((associationName != null) ? associationName.hashCode() : 0));
+ }
+ }
+
+ // Implementation
+
+ public JetspeedPrincipalAssociation()
+ {
+ }
+
+ public JetspeedPrincipalAssociation(JetspeedPrincipal from, JetspeedPrincipal to, String associationName)
+ {
+ this.fromPrincipalId = from.getId();
+ this.toPrincipalId = to.getId();
+ this.associationName = associationName;
+ }
+}
Added: portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalPermission.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalPermission.java?rev=742172&view=auto
==============================================================================
--- portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalPermission.java (added)
+++ portals/jetspeed-2/portal/branches/JPA_BRANCH/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/spi/jpa/JetspeedPrincipalPermission.java Sun Feb 8 21:28:35 2009
@@ -0,0 +1,109 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 org.apache.jetspeed.security.spi.jpa;
+
+import java.io.Serializable;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+import javax.persistence.Id;
+import javax.persistence.IdClass;
+import javax.persistence.NamedQuery;
+import javax.persistence.NamedQueries;
+import javax.persistence.Table;
+import javax.persistence.Version;
+
+import org.apache.jetspeed.security.JetspeedPrincipal;
+import org.apache.jetspeed.security.spi.PersistentJetspeedPermission;
+
+/**
+ * @version $Id: JetspeedPrincipalPermission.java 700986 2008-10-02 02:00:17Z ate $
+ *
+ */
+@Entity (name="PrincipalPermission")
+@IdClass (value=JetspeedPrincipalPermission.JetspeedPrincipalPermissionId.class)
+@Table (name="PRINCIPAL_PERMISSION")
+@NamedQueries ({@NamedQuery(name="PRINCIPAL_PERMISSION", query="select pp from PrincipalPermission pp where pp.principalId = :principalId and pp.permissionId = :permissionId"),
+ @NamedQuery(name="DELETE_PRINCIPAL_PERMISSION", query="delete from PrincipalPermission pp where pp.principalId = :principalId and pp.permissionId = :permissionId"),
+ @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSION", query="delete from PrincipalPermission pp, Principal p where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId and pp.permissionId = :permissionId"),
+ @NamedQuery(name="DELETE_PRINCIPAL_PERMISSION_TYPE_NAME", query="delete from PrincipalPermission pp, Permission pm where pp.principalId = :principalId and pp.permissionId = pm.id and pm.type = :permissionType and pm.name = :permissionName"),
+ @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSION_TYPE_NAME", query="delete from PrincipalPermission pp, Principal p, Permission pm where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId and pp.permissionId = pm.id and pm.type = :permissionType and pm.name = :permissionName"),
+ @NamedQuery(name="DELETE_PRINCIPAL_PERMISSIONS", query="delete from PrincipalPermission pp where pp.principalId = :principalId"),
+ @NamedQuery(name="DELETE_PRINCIPAL_TYPE_NAME_PERMISSIONS", query="delete from PrincipalPermission pp, Principal p where pp.principalId = p.id and p.type = :principalType and p.name = :principalName and p.domainId = :principalDomainId")})
+public class JetspeedPrincipalPermission implements Serializable
+{
+ private static final long serialVersionUID = 1842368505096279355L;
+
+ @Id
+ @Column (name="PRINCIPAL_ID")
+ @SuppressWarnings("unused")
+ private Long principalId;
+ @Id
+ @Column (name="PERMISSION_ID")
+ @SuppressWarnings("unused")
+ private Long permissionId;
+ @Version
+ @Column (name="JPA_VERSION")
+ @SuppressWarnings("unused")
+ private int jpaVersion;
+
+ public static class JetspeedPrincipalPermissionId
+ {
+ public Long principalId;
+ public Long permissionId;
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#equals(java.lang.Object)
+ */
+ public boolean equals(Object o)
+ {
+ if (o == this)
+ {
+ return true;
+ }
+ if (!(o instanceof JetspeedPrincipalPermissionId))
+ {
+ return false;
+ }
+ JetspeedPrincipalPermissionId other = (JetspeedPrincipalPermissionId)o;
+ return (((principalId == other.principalId) || ((principalId != null) && principalId.equals(other.principalId))) &&
+ ((permissionId == other.permissionId) || ((permissionId != null) && permissionId.equals(other.permissionId))));
+ }
+
+ /* (non-Javadoc)
+ * @see java.lang.Object#hashCode()
+ */
+ public int hashCode()
+ {
+ return (((principalId != null) ? principalId.hashCode() : 0)^
+ ((permissionId != null) ? permissionId.hashCode() : 0));
+ }
+ }
+
+ // Implementation
+
+ public JetspeedPrincipalPermission()
+ {
+ }
+
+ public JetspeedPrincipalPermission(JetspeedPrincipal principal, PersistentJetspeedPermission permission)
+ {
+ this.principalId = principal.getId();
+ this.permissionId = permission.getId();
+ }
+}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org