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 at...@apache.org on 2008/09/01 16:52:22 UTC
svn commit: r690984 -
/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
Author: ate
Date: Mon Sep 1 07:52:22 2008
New Revision: 690984
URL: http://svn.apache.org/viewvc?rev=690984&view=rev
Log:
Adding (SPI usage only) setters and OJB callback interface handling to BaseJetspeedPrincipal
Modified:
portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
Modified: portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java
URL: http://svn.apache.org/viewvc/portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java?rev=690984&r1=690983&r2=690984&view=diff
==============================================================================
--- portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java (original)
+++ portals/jetspeed-2/portal/branches/security-refactoring/components/jetspeed-security/src/main/java/org/apache/jetspeed/security/impl/BaseJetspeedPrincipal.java Mon Sep 1 07:52:22 2008
@@ -19,6 +19,7 @@
import java.io.Serializable;
import java.sql.Timestamp;
+import java.util.ArrayList;
import java.util.Collection;
import org.apache.jetspeed.security.JetspeedPrincipal;
@@ -26,12 +27,15 @@
import org.apache.jetspeed.security.JetspeedPrincipalType;
import org.apache.jetspeed.security.PrincipalReadOnlyException;
import org.apache.jetspeed.security.SecurityAttributes;
+import org.apache.ojb.broker.PersistenceBroker;
+import org.apache.ojb.broker.PersistenceBrokerAware;
+import org.apache.ojb.broker.PersistenceBrokerException;
/**
* @version $Id$
*
*/
-public class BaseJetspeedPrincipal implements JetspeedPrincipal, Serializable
+public abstract class BaseJetspeedPrincipal implements JetspeedPrincipal, PersistenceBrokerAware, Serializable
{
private static final long serialVersionUID = 5484179899807809619L;
@@ -41,13 +45,13 @@
private String name;
private Timestamp creationDate;
private Timestamp modifiedDate;
- private boolean enabled;
+ private boolean enabled = true;
private boolean mapped;
private boolean readOnly;
- private boolean removable;
- private boolean extendable;
+ private boolean removable = true;
+ private boolean extendable = true;
@SuppressWarnings("unchecked")
- private Collection avColl;
+ private Collection attributeValues;
private transient JetspeedPrincipalType jpt;
private transient SecurityAttributes attributes;
@@ -57,6 +61,10 @@
BaseJetspeedPrincipal.jpmp = jpmp;
}
+ public BaseJetspeedPrincipal()
+ {
+ }
+
public Long getId()
{
return id;
@@ -66,6 +74,11 @@
{
return name;
}
+
+ public void setName(String name)
+ {
+ this.name = name;
+ }
public synchronized JetspeedPrincipalType getType()
{
@@ -80,12 +93,12 @@
{
return creationDate;
}
-
+
public Timestamp getModifiedDate()
{
return modifiedDate;
}
-
+
public boolean isEnabled()
{
return enabled;
@@ -104,28 +117,92 @@
{
return mapped;
}
+
+ public void setMapped(boolean mapped)
+ {
+ this.mapped = mapped;
+ }
public boolean isReadOnly()
{
return readOnly;
}
+
+ public void setReadOnly(boolean readOnly)
+ {
+ this.readOnly = readOnly;
+ }
public boolean isRemovable()
{
return removable;
}
+
+ public void setRemovable(boolean removable)
+ {
+ this.removable = removable;
+ }
public boolean isExtendable()
{
return extendable;
}
+ public void setExtendable(boolean extendable)
+ {
+ this.extendable = extendable;
+ }
+
+ public synchronized void setAttributeValues(Collection<SecurityAttributeValue> attributeValues)
+ {
+ this.attributeValues = attributeValues;
+ this.attributes = null;
+ }
+
public synchronized SecurityAttributes getSecurityAttributes()
{
if (attributes == null)
{
- attributes = new SecurityAttributesImpl(this, avColl, isReadOnly(), isExtendable());
+ if (attributeValues == null)
+ {
+ attributeValues = new ArrayList<SecurityAttributeValue>();
+ }
+ attributes = new SecurityAttributesImpl(this, attributeValues, isReadOnly(), isExtendable());
}
return attributes;
}
+
+ /// OJB PersistenceBrokerAware interface implementation
+
+ public void afterDelete(PersistenceBroker pb) throws PersistenceBrokerException
+ {
+ }
+
+ public synchronized void afterInsert(PersistenceBroker pb) throws PersistenceBrokerException
+ {
+ this.attributes = null;
+ }
+
+ public void afterLookup(PersistenceBroker pb) throws PersistenceBrokerException
+ {
+ }
+
+ public void afterUpdate(PersistenceBroker pb) throws PersistenceBrokerException
+ {
+ }
+
+ public void beforeDelete(PersistenceBroker pb) throws PersistenceBrokerException
+ {
+ }
+
+ public void beforeInsert(PersistenceBroker pb) throws PersistenceBrokerException
+ {
+ this.creationDate = new Timestamp(System.currentTimeMillis());
+ this.modifiedDate = this.creationDate;
+ }
+
+ public void beforeUpdate(PersistenceBroker pb) throws PersistenceBrokerException
+ {
+ this.modifiedDate = new Timestamp(System.currentTimeMillis());
+ }
}
---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org