mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged HEAD (5.2) to 5.2.N (5.2.1)
126350 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2) 118728 jvonka: RA-613 / RA-655 - fix for TestFavourites failure (+ related backwards compat' for Favorites API response format) git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126695 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -53,6 +53,7 @@ import org.alfresco.service.cmr.dictionary.DictionaryService;
|
|||||||
import org.alfresco.service.cmr.model.FileFolderService;
|
import org.alfresco.service.cmr.model.FileFolderService;
|
||||||
import org.alfresco.service.cmr.model.FileInfo;
|
import org.alfresco.service.cmr.model.FileInfo;
|
||||||
import org.alfresco.service.cmr.model.FileNotFoundException;
|
import org.alfresco.service.cmr.model.FileNotFoundException;
|
||||||
|
import org.alfresco.service.cmr.repository.ContentData;
|
||||||
import org.alfresco.service.cmr.repository.ContentWriter;
|
import org.alfresco.service.cmr.repository.ContentWriter;
|
||||||
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
import org.alfresco.service.cmr.repository.InvalidNodeRefException;
|
||||||
import org.alfresco.service.cmr.repository.NodeRef;
|
import org.alfresco.service.cmr.repository.NodeRef;
|
||||||
@@ -66,6 +67,7 @@ import org.alfresco.util.Pair;
|
|||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.math.BigInteger;
|
||||||
import java.util.AbstractList;
|
import java.util.AbstractList;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
@@ -278,9 +280,7 @@ public class NodesImpl implements Nodes
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the public api representation of a document.
|
* @deprecated note: currently required for backwards compat' (Favourites API)
|
||||||
*
|
|
||||||
* @deprecated review usage (backward compat')
|
|
||||||
*/
|
*/
|
||||||
public Document getDocument(NodeRef nodeRef)
|
public Document getDocument(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
@@ -290,6 +290,16 @@ public class NodesImpl implements Nodes
|
|||||||
Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
|
Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
|
||||||
|
|
||||||
Document doc = new Document(nodeRef, getParentNodeRef(nodeRef), properties, sr);
|
Document doc = new Document(nodeRef, getParentNodeRef(nodeRef), properties, sr);
|
||||||
|
|
||||||
|
doc.setVersionLabel((String)properties.get(ContentModel.PROP_VERSION_LABEL));
|
||||||
|
ContentData cd = (ContentData) properties.get(ContentModel.PROP_CONTENT);
|
||||||
|
if (cd != null)
|
||||||
|
{
|
||||||
|
doc.setSizeInBytes(BigInteger.valueOf(cd.getSize()));
|
||||||
|
doc.setMimeType((cd.getMimetype()));
|
||||||
|
}
|
||||||
|
|
||||||
|
setCommonProps(doc, nodeRef, properties);
|
||||||
return doc;
|
return doc;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -298,10 +308,17 @@ public class NodesImpl implements Nodes
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setCommonProps(Node node, NodeRef nodeRef, Map<QName,Serializable> properties)
|
||||||
|
{
|
||||||
|
node.setGuid(nodeRef);
|
||||||
|
node.setTitle((String)properties.get(ContentModel.PROP_TITLE));
|
||||||
|
node.setDescription((String)properties.get(ContentModel.PROP_TITLE));
|
||||||
|
node.setModifiedBy((String)properties.get(ContentModel.PROP_MODIFIER));
|
||||||
|
node.setCreatedBy((String)properties.get(ContentModel.PROP_CREATOR));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the public api representation of a folder.
|
* @deprecated note: currently required for backwards compat' (Favourites API)
|
||||||
*
|
|
||||||
* @deprecated review usage (backward compat')
|
|
||||||
*/
|
*/
|
||||||
public Folder getFolder(NodeRef nodeRef)
|
public Folder getFolder(NodeRef nodeRef)
|
||||||
{
|
{
|
||||||
@@ -311,6 +328,7 @@ public class NodesImpl implements Nodes
|
|||||||
Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
|
Map<QName, Serializable> properties = nodeService.getProperties(nodeRef);
|
||||||
|
|
||||||
Folder folder = new Folder(nodeRef, getParentNodeRef(nodeRef), properties, sr);
|
Folder folder = new Folder(nodeRef, getParentNodeRef(nodeRef), properties, sr);
|
||||||
|
setCommonProps(folder, nodeRef, properties);
|
||||||
return folder;
|
return folder;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@@ -44,11 +44,6 @@ import org.alfresco.service.namespace.QName;
|
|||||||
*/
|
*/
|
||||||
public class Document extends Node
|
public class Document extends Node
|
||||||
{
|
{
|
||||||
// TODO backward compat' - favourites etc
|
|
||||||
private String mimeType;
|
|
||||||
private BigInteger sizeInBytes;
|
|
||||||
private String versionLabel;
|
|
||||||
|
|
||||||
private ContentInfo contentInfo;
|
private ContentInfo contentInfo;
|
||||||
|
|
||||||
public Document() {
|
public Document() {
|
||||||
@@ -67,23 +62,6 @@ public class Document extends Node
|
|||||||
String mimeTypeName = sr.getMimetypeService().getDisplaysByMimetype().get(mimeType);
|
String mimeTypeName = sr.getMimetypeService().getDisplaysByMimetype().get(mimeType);
|
||||||
this.contentInfo = new ContentInfo(mimeType, mimeTypeName, cd.getSize(), cd.getEncoding());
|
this.contentInfo = new ContentInfo(mimeType, mimeTypeName, cd.getSize(), cd.getEncoding());
|
||||||
}
|
}
|
||||||
|
|
||||||
//this.versionLabel = (String)nodeProps.get(ContentModel.PROP_VERSION_LABEL);
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMimeType()
|
|
||||||
{
|
|
||||||
return mimeType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigInteger getSizeInBytes()
|
|
||||||
{
|
|
||||||
return sizeInBytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getVersionLabel()
|
|
||||||
{
|
|
||||||
return versionLabel;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public Boolean getIsFolder()
|
public Boolean getIsFolder()
|
||||||
@@ -104,4 +82,58 @@ public class Document extends Node
|
|||||||
+ ", modifiedAt=" + modifiedAt + ", createdBy=" + createdBy
|
+ ", modifiedAt=" + modifiedAt + ", createdBy=" + createdBy
|
||||||
+ ", modifiedBy=" + modifiedBy + "]";
|
+ ", modifiedBy=" + modifiedBy + "]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO for backwards compat' - set explicitly when needed (ie. favourites)
|
||||||
|
private String mimeType;
|
||||||
|
private BigInteger sizeInBytes;
|
||||||
|
private String versionLabel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public String getMimeType()
|
||||||
|
{
|
||||||
|
return mimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public BigInteger getSizeInBytes()
|
||||||
|
{
|
||||||
|
return sizeInBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public String getVersionLabel()
|
||||||
|
{
|
||||||
|
return versionLabel;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public void setMimeType(String mimeType)
|
||||||
|
{
|
||||||
|
this.mimeType = mimeType;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public void setSizeInBytes(BigInteger sizeInBytes)
|
||||||
|
{
|
||||||
|
this.sizeInBytes = sizeInBytes;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public void setVersionLabel(String versionLabel)
|
||||||
|
{
|
||||||
|
this.versionLabel = versionLabel;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -52,13 +52,6 @@ public class Node implements Comparable<Node>
|
|||||||
protected NodeRef nodeRef;
|
protected NodeRef nodeRef;
|
||||||
protected String name;
|
protected String name;
|
||||||
|
|
||||||
// TODO needed for favourties - backwards compat' - we could also choose to split of NodeInfo / Node impl's etc
|
|
||||||
protected String title;
|
|
||||||
protected NodeRef guid;
|
|
||||||
protected String description;
|
|
||||||
protected String createdBy;
|
|
||||||
protected String modifiedBy;
|
|
||||||
|
|
||||||
protected Date createdAt;
|
protected Date createdAt;
|
||||||
protected Date modifiedAt;
|
protected Date modifiedAt;
|
||||||
protected UserInfo createdByUser;
|
protected UserInfo createdByUser;
|
||||||
@@ -84,7 +77,7 @@ public class Node implements Comparable<Node>
|
|||||||
this.nodeRef = nodeRef;
|
this.nodeRef = nodeRef;
|
||||||
this.parentNodeRef = parentNodeRef;
|
this.parentNodeRef = parentNodeRef;
|
||||||
|
|
||||||
mapBasicInfo(nodeProps, sr);
|
mapMinimalInfo(nodeProps, sr);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Object getValue(Map<String, PropertyData<?>> props, String name)
|
protected Object getValue(Map<String, PropertyData<?>> props, String name)
|
||||||
@@ -98,7 +91,7 @@ public class Node implements Comparable<Node>
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void mapBasicInfo(Map<QName, Serializable> nodeProps, ServiceRegistry sr)
|
protected void mapMinimalInfo(Map<QName, Serializable> nodeProps, ServiceRegistry sr)
|
||||||
{
|
{
|
||||||
PersonService personService = sr.getPersonService();
|
PersonService personService = sr.getPersonService();
|
||||||
|
|
||||||
@@ -133,20 +126,6 @@ public class Node implements Comparable<Node>
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setGuid(NodeRef guid)
|
|
||||||
{
|
|
||||||
this.guid = guid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public NodeRef getGuid() {
|
|
||||||
return guid;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getTitle()
|
|
||||||
{
|
|
||||||
return title;
|
|
||||||
}
|
|
||||||
|
|
||||||
@UniqueId
|
@UniqueId
|
||||||
public NodeRef getNodeRef()
|
public NodeRef getNodeRef()
|
||||||
{
|
{
|
||||||
@@ -173,11 +152,6 @@ public class Node implements Comparable<Node>
|
|||||||
return modifiedAt;
|
return modifiedAt;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getModifiedBy()
|
|
||||||
{
|
|
||||||
return modifiedBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UserInfo getModifiedByUser() {
|
public UserInfo getModifiedByUser() {
|
||||||
return modifiedByUser;
|
return modifiedByUser;
|
||||||
}
|
}
|
||||||
@@ -186,11 +160,6 @@ public class Node implements Comparable<Node>
|
|||||||
return createdByUser;
|
return createdByUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getDescription()
|
|
||||||
{
|
|
||||||
return description;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getName()
|
public String getName()
|
||||||
{
|
{
|
||||||
return this.name;
|
return this.name;
|
||||||
@@ -201,16 +170,6 @@ public class Node implements Comparable<Node>
|
|||||||
this.name = name;
|
this.name = name;
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getCreatedBy()
|
|
||||||
{
|
|
||||||
return this.createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedBy(String createdBy)
|
|
||||||
{
|
|
||||||
this.createdBy = createdBy;
|
|
||||||
}
|
|
||||||
|
|
||||||
public PathInfo getPath()
|
public PathInfo getPath()
|
||||||
{
|
{
|
||||||
return pathInfo;
|
return pathInfo;
|
||||||
@@ -282,4 +241,91 @@ public class Node implements Comparable<Node>
|
|||||||
+ createdAt + ", modifiedAt=" + modifiedAt + ", createdByUser=" + createdByUser + ", modifiedBy="
|
+ createdAt + ", modifiedAt=" + modifiedAt + ", createdByUser=" + createdByUser + ", modifiedBy="
|
||||||
+ modifiedByUser + ", pathInfo =" + pathInfo +"]";
|
+ modifiedByUser + ", pathInfo =" + pathInfo +"]";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO for backwards compat' - set explicitly when needed (ie. favourites) (note: we could choose to have separate old Node/NodeImpl etc)
|
||||||
|
|
||||||
|
protected String title;
|
||||||
|
protected NodeRef guid;
|
||||||
|
protected String description;
|
||||||
|
protected String createdBy;
|
||||||
|
protected String modifiedBy;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public NodeRef getGuid() {
|
||||||
|
return guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public void setGuid(NodeRef guid)
|
||||||
|
{
|
||||||
|
this.guid = guid;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public String getTitle()
|
||||||
|
{
|
||||||
|
return title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public void setTitle(String title)
|
||||||
|
{
|
||||||
|
this.title = title;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public String getDescription()
|
||||||
|
{
|
||||||
|
return description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public void setDescription(String description)
|
||||||
|
{
|
||||||
|
this.description = description;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public String getCreatedBy()
|
||||||
|
{
|
||||||
|
return this.createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public void setCreatedBy(String createdBy)
|
||||||
|
{
|
||||||
|
this.createdBy = createdBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public String getModifiedBy()
|
||||||
|
{
|
||||||
|
return modifiedBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @deprecated
|
||||||
|
*/
|
||||||
|
public void setModifiedBy(String modifiedBy)
|
||||||
|
{
|
||||||
|
this.modifiedBy = modifiedBy;
|
||||||
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user