mirror of
https://github.com/Alfresco/alfresco-community-repo.git
synced 2025-08-14 17:58:59 +00:00
Merged 5.2.N (5.2.1) to HEAD (5.2)
125783 rmunteanu: Merged 5.1.N (5.1.2) to 5.2.N (5.2.1) 125605 rmunteanu: Merged 5.1.1 (5.1.1) to 5.1.N (5.1.2) 125498 slanglois: MNT-16155 Update source headers - remove svn:eol-style property on Java and JSP source files git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/HEAD/root@127809 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
@@ -1,82 +1,82 @@
|
||||
package org.alfresco.rest.api.nodes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.api.NodeRatings;
|
||||
import org.alfresco.rest.api.model.NodeRating;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.WebApiParam;
|
||||
import org.alfresco.rest.framework.WebApiParameters;
|
||||
import org.alfresco.rest.framework.core.ResourceParameter;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@RelationshipResource(name = "ratings", entityResource = NodesEntityResource.class, title = "Document or folder ratings")
|
||||
public class NodeRatingsRelation implements RelationshipResourceAction.Read<NodeRating>, RelationshipResourceAction.ReadById<NodeRating>, RelationshipResourceAction.Delete,
|
||||
RelationshipResourceAction.Create<NodeRating>, InitializingBean
|
||||
{
|
||||
private NodeRatings nodeRatings;
|
||||
|
||||
public void setNodeRatings(NodeRatings nodeRatings)
|
||||
{
|
||||
this.nodeRatings = nodeRatings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
ParameterCheck.mandatory("nodeRatings", this.nodeRatings);
|
||||
}
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="A paged list of ratings for node 'nodeId'.")
|
||||
@WebApiParam(name="nodeId", title="The unique id of the Node being addressed", description="A single node id")
|
||||
public CollectionWithPagingInfo<NodeRating> readAll(String nodeId, Parameters parameters)
|
||||
{
|
||||
return nodeRatings.getNodeRatings(nodeId, parameters.getPaging());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a rating for the node with id 'nodeId'.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@WebApiDescription(title="Rate a node for 'nodeId'.")
|
||||
@WebApiParam(name="ratingEntity", title="A single rating", description="A single node rating, multiple ratings are not supported.",
|
||||
kind=ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false)
|
||||
public List<NodeRating> create(String nodeId, List<NodeRating> ratingEntity, Parameters parameters)
|
||||
{
|
||||
//There will always be 1 value because allowMultiple=false
|
||||
NodeRating rating = ratingEntity.get(0);
|
||||
String ratingSchemeId = rating.getScheme();
|
||||
nodeRatings.addRating(nodeId, ratingSchemeId, rating.getMyRating());
|
||||
return Collections.singletonList(nodeRatings.getNodeRating(nodeId, ratingSchemeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rating with id 'schemeName' for node with id 'nodeId'.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@WebApiDescription(title="Get the rating with id 'ratingSchemeId' for node 'nodeId'.")
|
||||
@WebApiParameters({
|
||||
@WebApiParam(name="nodeId", title="The unique id of the Node being addressed", description="A single node id"),
|
||||
@WebApiParam(name="ratingSchemeId", title="The rating scheme type", description="Possible values are likesRatingScheme.")})
|
||||
public NodeRating readById(String nodeId, String ratingSchemeId, Parameters parameters)
|
||||
{
|
||||
return nodeRatings.getNodeRating(nodeId, ratingSchemeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="Deletes a node rating")
|
||||
public void delete(String nodeId, String ratingSchemeId, Parameters parameters)
|
||||
{
|
||||
nodeRatings.removeRating(nodeId, ratingSchemeId);
|
||||
}
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.api.NodeRatings;
|
||||
import org.alfresco.rest.api.model.NodeRating;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.WebApiParam;
|
||||
import org.alfresco.rest.framework.WebApiParameters;
|
||||
import org.alfresco.rest.framework.core.ResourceParameter;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@RelationshipResource(name = "ratings", entityResource = NodesEntityResource.class, title = "Document or folder ratings")
|
||||
public class NodeRatingsRelation implements RelationshipResourceAction.Read<NodeRating>, RelationshipResourceAction.ReadById<NodeRating>, RelationshipResourceAction.Delete,
|
||||
RelationshipResourceAction.Create<NodeRating>, InitializingBean
|
||||
{
|
||||
private NodeRatings nodeRatings;
|
||||
|
||||
public void setNodeRatings(NodeRatings nodeRatings)
|
||||
{
|
||||
this.nodeRatings = nodeRatings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
ParameterCheck.mandatory("nodeRatings", this.nodeRatings);
|
||||
}
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="A paged list of ratings for node 'nodeId'.")
|
||||
@WebApiParam(name="nodeId", title="The unique id of the Node being addressed", description="A single node id")
|
||||
public CollectionWithPagingInfo<NodeRating> readAll(String nodeId, Parameters parameters)
|
||||
{
|
||||
return nodeRatings.getNodeRatings(nodeId, parameters.getPaging());
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a rating for the node with id 'nodeId'.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@WebApiDescription(title="Rate a node for 'nodeId'.")
|
||||
@WebApiParam(name="ratingEntity", title="A single rating", description="A single node rating, multiple ratings are not supported.",
|
||||
kind=ResourceParameter.KIND.HTTP_BODY_OBJECT, allowMultiple=false)
|
||||
public List<NodeRating> create(String nodeId, List<NodeRating> ratingEntity, Parameters parameters)
|
||||
{
|
||||
//There will always be 1 value because allowMultiple=false
|
||||
NodeRating rating = ratingEntity.get(0);
|
||||
String ratingSchemeId = rating.getScheme();
|
||||
nodeRatings.addRating(nodeId, ratingSchemeId, rating.getMyRating());
|
||||
return Collections.singletonList(nodeRatings.getNodeRating(nodeId, ratingSchemeId));
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns the rating with id 'schemeName' for node with id 'nodeId'.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@WebApiDescription(title="Get the rating with id 'ratingSchemeId' for node 'nodeId'.")
|
||||
@WebApiParameters({
|
||||
@WebApiParam(name="nodeId", title="The unique id of the Node being addressed", description="A single node id"),
|
||||
@WebApiParam(name="ratingSchemeId", title="The rating scheme type", description="Possible values are likesRatingScheme.")})
|
||||
public NodeRating readById(String nodeId, String ratingSchemeId, Parameters parameters)
|
||||
{
|
||||
return nodeRatings.getNodeRating(nodeId, ratingSchemeId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="Deletes a node rating")
|
||||
public void delete(String nodeId, String ratingSchemeId, Parameters parameters)
|
||||
{
|
||||
nodeRatings.removeRating(nodeId, ratingSchemeId);
|
||||
}
|
||||
|
||||
}
|
@@ -1,56 +1,56 @@
|
||||
package org.alfresco.rest.api.nodes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.api.Tags;
|
||||
import org.alfresco.rest.api.model.Tag;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@RelationshipResource(name = "tags", entityResource = NodesEntityResource.class, title = "Document or folder tags")
|
||||
public class NodeTagsRelation implements RelationshipResourceAction.Create<Tag>, RelationshipResourceAction.Delete, RelationshipResourceAction.Read<Tag>, InitializingBean
|
||||
{
|
||||
private Tags tags;
|
||||
|
||||
public void setTags(Tags tags)
|
||||
{
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
ParameterCheck.mandatory("tags", this.tags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the tag to the node with id 'nodeId'.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@WebApiDescription(title="Adds one or more tags to the node with id 'nodeId'.")
|
||||
public List<Tag> create(String nodeId, List<Tag> tagsToCreate, Parameters parameters)
|
||||
{
|
||||
return tags.addTags(nodeId, tagsToCreate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="Remove the tag from the node with id 'nodeId'.")
|
||||
public void delete(String nodeId, String tagId, Parameters parameters)
|
||||
{
|
||||
tags.deleteTag(nodeId, tagId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="A paged list of tags on the node 'nodeId'.")
|
||||
public CollectionWithPagingInfo<Tag> readAll(String nodeId, Parameters params)
|
||||
{
|
||||
return tags.getTags(nodeId, params);
|
||||
}
|
||||
|
||||
package org.alfresco.rest.api.nodes;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.alfresco.rest.api.Tags;
|
||||
import org.alfresco.rest.api.model.Tag;
|
||||
import org.alfresco.rest.framework.WebApiDescription;
|
||||
import org.alfresco.rest.framework.resource.RelationshipResource;
|
||||
import org.alfresco.rest.framework.resource.actions.interfaces.RelationshipResourceAction;
|
||||
import org.alfresco.rest.framework.resource.parameters.CollectionWithPagingInfo;
|
||||
import org.alfresco.rest.framework.resource.parameters.Parameters;
|
||||
import org.alfresco.util.ParameterCheck;
|
||||
import org.springframework.beans.factory.InitializingBean;
|
||||
|
||||
@RelationshipResource(name = "tags", entityResource = NodesEntityResource.class, title = "Document or folder tags")
|
||||
public class NodeTagsRelation implements RelationshipResourceAction.Create<Tag>, RelationshipResourceAction.Delete, RelationshipResourceAction.Read<Tag>, InitializingBean
|
||||
{
|
||||
private Tags tags;
|
||||
|
||||
public void setTags(Tags tags)
|
||||
{
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterPropertiesSet()
|
||||
{
|
||||
ParameterCheck.mandatory("tags", this.tags);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add the tag to the node with id 'nodeId'.
|
||||
*
|
||||
*/
|
||||
@Override
|
||||
@WebApiDescription(title="Adds one or more tags to the node with id 'nodeId'.")
|
||||
public List<Tag> create(String nodeId, List<Tag> tagsToCreate, Parameters parameters)
|
||||
{
|
||||
return tags.addTags(nodeId, tagsToCreate);
|
||||
}
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="Remove the tag from the node with id 'nodeId'.")
|
||||
public void delete(String nodeId, String tagId, Parameters parameters)
|
||||
{
|
||||
tags.deleteTag(nodeId, tagId);
|
||||
}
|
||||
|
||||
@Override
|
||||
@WebApiDescription(title="A paged list of tags on the node 'nodeId'.")
|
||||
public CollectionWithPagingInfo<Tag> readAll(String nodeId, Parameters params)
|
||||
{
|
||||
return tags.getTags(nodeId, params);
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user