Britt Park 8a95b09b98 Added new AVM node type DeletedNode (aka, ghost, tombstone), a marker node for a
node that has been deleted in a version. This makes tree comparisons easier by
resolving the cases in which one wants to know whether a deletions is more or less 
recent than another version of a node.  Along the way got rid of DeletedChild and 
friends including a table in the schema, since DeletedNode takes on all the work
that it performed.
Deleted two illegally named files in Virgin content.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/WCM-DEV2/root@3748 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
2006-09-10 17:20:35 +00:00

168 lines
5.4 KiB
Java

/*
* Copyright (C) 2006 Alfresco, Inc.
*
* Licensed under the Mozilla Public License version 1.1
* with a permitted attribution clause. You may obtain a
* copy of the License at
*
* http://www.alfresco.org/legal/license.txt
*
* 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.alfresco.repo.avm;
import org.alfresco.service.cmr.avm.AVMNodeDescriptor;
/**
* Place holder for a deleted node.
* @author britt
*/
public class DeletedNodeImpl extends AVMNodeImpl implements DeletedNode
{
private static final long serialVersionUID = 7283526790174482993L;
/**
* For Hibernate's use.
*/
protected DeletedNodeImpl()
{
}
/**
* Create a new one from scratch.
* @param id The node id.
* @param store The store it's being created in.
*/
public DeletedNodeImpl(long id,
AVMStore store)
{
super(id, store);
}
/**
* This should never be called.
*/
public AVMNode copy(Lookup lPath)
{
assert false;
return null;
}
/**
* Get a descriptor.
* @param lPath The Lookup to this node's parent.
* @param name The name of this node.
* @return An AVMNodeDescriptor
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath, String name)
{
BasicAttributes attrs = getBasicAttributes();
String path = lPath.getRepresentedPath();
if (path.endsWith("/"))
{
path = path + name;
}
else
{
path = path + "/" + name;
}
return new AVMNodeDescriptor(path,
name,
AVMNodeType.DELETED_NODE,
attrs.getCreator(),
attrs.getOwner(),
attrs.getLastModifier(),
attrs.getCreateDate(),
attrs.getModDate(),
attrs.getAccessDate(),
getId(),
getVersionID(),
null,
false,
-1,
false,
-1);
}
/**
* Get a descriptor.
* @param lPath The full Lookup to this.
* @return An AVMNodeDescriptor.
*/
public AVMNodeDescriptor getDescriptor(Lookup lPath)
{
BasicAttributes attrs = getBasicAttributes();
String path = lPath.getRepresentedPath();
return new AVMNodeDescriptor(path,
path.substring(path.lastIndexOf("/") + 1),
AVMNodeType.DELETED_NODE,
attrs.getCreator(),
attrs.getOwner(),
attrs.getLastModifier(),
attrs.getCreateDate(),
attrs.getModDate(),
attrs.getAccessDate(),
getId(),
getVersionID(),
null,
false,
-1,
false,
-1);
}
/**
* Get a descriptor.
* @param parentPath
* @param name
* @param parentIndirection Ignored.
* @return An AVMNodeDescriptor.
*/
public AVMNodeDescriptor getDescriptor(String parentPath, String name, String parentIndirection)
{
BasicAttributes attrs = getBasicAttributes();
String path = parentPath.endsWith("/") ? parentPath + name : parentPath + "/" + name;
return new AVMNodeDescriptor(path,
name,
AVMNodeType.DELETED_NODE,
attrs.getCreator(),
attrs.getOwner(),
attrs.getLastModifier(),
attrs.getCreateDate(),
attrs.getModDate(),
attrs.getAccessDate(),
getId(),
getVersionID(),
null,
false,
-1,
false,
-1);
}
/**
* Get the type of this node.
* @return The AVMNodeType of this.
*/
public int getType()
{
return AVMNodeType.DELETED_NODE;
}
/**
* Get a descriptive string representation.
* @param lPath The lookup we've been found through.
* @return A String representation.
*/
public String toString(Lookup lPath)
{
return "[DN:" + getId() + "]";
}
}