Big honkin' merge from head. Sheesh!

git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3617 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Britt Park
2006-08-27 01:01:30 +00:00
parent 465ae145be
commit b0d02fa6be
241 changed files with 12379 additions and 1061 deletions

View File

@@ -36,8 +36,6 @@ import org.alfresco.service.cmr.security.PermissionService;
import org.alfresco.service.namespace.QName;
import org.alfresco.service.namespace.RegexQNamePattern;
import org.alfresco.web.app.Application;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Lighweight client side representation of a node held in the repository.
@@ -48,28 +46,25 @@ public class Node implements Serializable
{
private static final long serialVersionUID = 3544390322739034169L;
protected static final Log logger = LogFactory.getLog(Node.class);
protected NodeRef nodeRef;
private String name;
private QName type;
private String path;
private String id;
private Set<QName> aspects = null;
private Map<String, Boolean> permissions;
private Boolean locked = null;
private Boolean workingCopyOwner = null;
protected String name;
protected QName type;
protected String path;
protected String id;
protected Set<QName> aspects = null;
protected Map<String, Boolean> permissions;
protected Boolean locked = null;
protected Boolean workingCopyOwner = null;
protected QNameNodeMap<String, Object> properties;
protected boolean propsRetrieved = false;
protected ServiceRegistry services = null;
protected boolean childAssocsRetrieved = false;
protected QNameNodeMap childAssociations;
protected boolean assocsRetrieved = false;
protected QNameNodeMap associations;
private boolean childAssocsRetrieved = false;
private QNameNodeMap childAssociations;
private Map<String, Map<String, ChildAssociationRef>> childAssociationsAdded;
private Map<String, Map<String, ChildAssociationRef>> childAssociationsRemoved;
private boolean assocsRetrieved = false;
private QNameNodeMap associations;
private Map<String, Map<String, AssociationRef>> associationsAdded;
private Map<String, Map<String, AssociationRef>> associationsRemoved;
@@ -94,7 +89,7 @@ public class Node implements Serializable
/**
* @return All the properties known about this node.
*/
public Map<String, Object> getProperties()
public final Map<String, Object> getProperties()
{
if (this.propsRetrieved == false)
{
@@ -120,7 +115,7 @@ public class Node implements Serializable
{
if (this.assocsRetrieved == false)
{
associations = new QNameNodeMap(getServiceRegistry().getNamespaceService(), this);
this.associations = new QNameNodeMap(getServiceRegistry().getNamespaceService(), this);
List<AssociationRef> assocs = getServiceRegistry().getNodeService().getTargetAssocs(this.nodeRef, RegexQNamePattern.MATCH_ALL);
@@ -341,7 +336,7 @@ public class Node implements Serializable
*
* @return true if the permission is applied to the node for this user, false otherwise
*/
public final boolean hasPermission(String permission)
public boolean hasPermission(String permission)
{
Boolean valid = null;
if (permissions != null)

View File

@@ -16,15 +16,11 @@
*/
package org.alfresco.web.bean.repository;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
import org.alfresco.service.namespace.NamespacePrefixResolver;
import org.alfresco.service.namespace.QNameMap;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* A extension of the repo QNameMap to provide custom property resolving support for Node wrappers.
@@ -86,6 +82,7 @@ public final class QNameNodeMap<K,V> extends QNameMap implements Map, Cloneable
/**
* @see java.util.Map#get(java.lang.Object)
*/
@SuppressWarnings("unchecked")
public Object get(Object key)
{
String qnameKey = Repository.resolveToQNameString(key.toString());
@@ -120,6 +117,7 @@ public final class QNameNodeMap<K,V> extends QNameMap implements Map, Cloneable
/**
* Shallow copy the map by copying keys and values into a new QNameNodeMap
*/
@SuppressWarnings("unchecked")
public Object clone()
{
QNameNodeMap map = new QNameNodeMap(this.resolver, this.parent);

View File

@@ -0,0 +1,149 @@
package org.alfresco.web.bean.repository;
import java.io.Serializable;
import java.util.Collection;
import java.util.Map;
import java.util.Set;
import org.alfresco.service.namespace.QName;
/**
* Represents a transient node i.e. it is not and will not be present in the repository.
* <p>
* This type of node is typically used to drive rich lists where the Map implementation
* is required for sorting columns.
* </p>
*
* @author gavinc
*/
public class TransientMapNode extends TransientNode implements Map<String, Object>
{
private static final long serialVersionUID = 1120307465342597322L;
/**
* Constructor.
* <p>
* NOTE: The name is NOT automatically added to the map of properties,
* if you need the name of this node to be in the map then add it to
* the map passed in to this constructor.
* </p>
*
* @param type The type this node will represent
* @param name The name of the node
* @param data The properties and associations this node will have
*/
public TransientMapNode(QName type, String name, Map<QName, Serializable> data)
{
super(type, name, data);
}
@Override
public String toString()
{
return "Transient map node of type: " + getType() +
"\nProperties: " + this.getProperties().toString();
}
// ------------------------------------------------------------------------------
// Map implementation - allows the Node bean to be accessed using JSF expression syntax
/**
* @see java.util.Map#clear()
*/
public void clear()
{
getProperties().clear();
}
/**
* @see java.util.Map#containsKey(java.lang.Object)
*/
public boolean containsKey(Object key)
{
return getProperties().containsKey(key);
}
/**
* @see java.util.Map#containsValue(java.lang.Object)
*/
public boolean containsValue(Object value)
{
return getProperties().containsKey(value);
}
/**
* @see java.util.Map#entrySet()
*/
@SuppressWarnings("unchecked")
public Set entrySet()
{
return getProperties().entrySet();
}
/**
* @see java.util.Map#get(java.lang.Object)
*/
public Object get(Object key)
{
return getProperties().get(key);
}
/**
* @see java.util.Map#isEmpty()
*/
public boolean isEmpty()
{
return getProperties().isEmpty();
}
/**
* @see java.util.Map#keySet()
*/
@SuppressWarnings("unchecked")
public Set keySet()
{
return getProperties().keySet();
}
/**
* @see java.util.Map#put(K, V)
*/
public Object put(String key, Object value)
{
return getProperties().put(key, value);
}
/**
* @see java.util.Map#putAll(java.util.Map)
*/
@SuppressWarnings("unchecked")
public void putAll(Map t)
{
getProperties().putAll(t);
}
/**
* @see java.util.Map#remove(java.lang.Object)
*/
public Object remove(Object key)
{
return getProperties().remove(key);
}
/**
* @see java.util.Map#size()
*/
public int size()
{
return getProperties().size();
}
/**
* @see java.util.Map#values()
*/
@SuppressWarnings("unchecked")
public Collection values()
{
return getProperties().values();
}
}

View File

@@ -0,0 +1,150 @@
package org.alfresco.web.bean.repository;
import java.io.Serializable;
import java.util.HashSet;
import java.util.Map;
import org.alfresco.error.AlfrescoRuntimeException;
import org.alfresco.service.cmr.dictionary.AspectDefinition;
import org.alfresco.service.cmr.dictionary.AssociationDefinition;
import org.alfresco.service.cmr.dictionary.DictionaryService;
import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.dictionary.TypeDefinition;
import org.alfresco.service.cmr.repository.NodeRef;
import org.alfresco.service.namespace.QName;
import org.alfresco.util.GUID;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
/**
* Represents a transient node i.e. it is not and will not be present in the repository.
* <p>
* This type of node is typically used to drive the property sheet when data collection
* is required for a type but the node does not need to be stored in the repository. An
* example use is the workflow, transient nodes are used to collect workitem metadata.
* </p>
*
* @author gavinc
*/
public class TransientNode extends Node
{
private static final long serialVersionUID = 2140554155948154106L;
private static final Log logger = LogFactory.getLog(TransientNode.class);
/**
* Constructor.
* <p>
* NOTE: The name is NOT automatically added to the map of properties,
* if you need the name of this node to be in the map then add it to
* the map passed in to this constructor.
* </p>
*
* @param type The type this node will represent
* @param name The name of the node
* @param data The properties and associations this node will have
*/
public TransientNode(QName type, String name, Map<QName, Serializable> data)
{
// create a dummy NodeRef to pass to the constructor
super(new NodeRef(Repository.getStoreRef(), GUID.generate()));
this.type = type;
this.name = name;
// initialise the node
initNode(data);
if (logger.isDebugEnabled())
logger.debug("Constructed transient node: " + this);
}
/**
* Initialises the node.
*
* @param data The properties and associations to initialise the node with
*/
protected void initNode(Map<QName, Serializable> data)
{
// setup the transient node so that the super class methods work
// and do not need to go back to the repository
DictionaryService ddService = this.getServiceRegistry().getDictionaryService();
// marshall the given properties and associations into the internal maps
this.associations = new QNameNodeMap(getServiceRegistry().getNamespaceService(), this);
this.childAssociations = new QNameNodeMap(getServiceRegistry().getNamespaceService(), this);
if (data != null)
{
// go through all data items and allocate to the correct internal list
for (QName item : data.keySet())
{
PropertyDefinition propDef = ddService.getProperty(item);
if (propDef != null)
{
this.properties.put(item, data.get(item));
}
else
{
// see if the item is either type of association
AssociationDefinition assocDef = ddService.getAssociation(item);
if (assocDef != null)
{
if (assocDef.isChild())
{
this.childAssociations.put(item, data.get(item));
}
else
{
this.associations.put(item, data.get(item));
}
}
}
}
}
// show that the maps have been initialised
this.propsRetrieved = true;
this.assocsRetrieved = true;
this.childAssocsRetrieved = true;
// setup the list of aspects the node would have
TypeDefinition typeDef = ddService.getType(this.type);
if (typeDef == null)
{
throw new AlfrescoRuntimeException("Failed to find type definition for start task: " + this.type);
}
this.aspects = new HashSet<QName>();
for (AspectDefinition aspectDef : typeDef.getDefaultAspects())
{
this.aspects.add(aspectDef.getName());
}
// setup remaining variables
this.path = "";
this.locked = Boolean.FALSE;
this.workingCopyOwner = Boolean.FALSE;
}
@Override
public boolean hasPermission(String permission)
{
return true;
}
@Override
public void reset()
{
// don't reset anything otherwise we'll lose our data
// with no way of getting it back!!
}
@Override
public String toString()
{
return "Transient node of type: " + getType() +
"\nProperties: " + this.getProperties().toString();
}
}

View File

@@ -64,6 +64,16 @@ public final class User
this.person = person;
}
/**
* Forces a clear of any cached or calcluated values
*/
public void reset()
{
this.fullName = null;
this.administrator = null;
this.preferences = null;
}
/**
* @return The user name
*/
@@ -114,7 +124,6 @@ public final class User
{
return this.ticket;
}
/**
* @return Returns the person NodeRef