Merged HEAD (5.2) to 5.2.N (5.2.1)

126399 jkaabimofrad: Merged FILE-FOLDER-API (5.2.0) to HEAD (5.2)
      121139 jvonka: FileFolder API - create/delete Public/Quick share link
      - TODO ability to access content + limited metadata (also add sanity tests)
      - ... for now can 'demo' access to link via existing APIs &/or Share ;-)
      RA-708


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@126744 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Ancuta Morarasu
2016-05-11 11:01:55 +00:00
parent b1c54a804f
commit ee9dd6465f
2 changed files with 26 additions and 1 deletions

View File

@@ -41,6 +41,7 @@ import java.util.Set;
import org.alfresco.model.ApplicationModel;
import org.alfresco.model.ContentModel;
import org.alfresco.model.QuickShareModel;
import org.alfresco.query.PagingRequest;
import org.alfresco.query.PagingResults;
import org.alfresco.repo.content.ContentLimitViolationException;
@@ -83,6 +84,7 @@ import org.alfresco.service.cmr.dictionary.PropertyDefinition;
import org.alfresco.service.cmr.model.FileFolderService;
import org.alfresco.service.cmr.model.FileInfo;
import org.alfresco.service.cmr.model.FileNotFoundException;
import org.alfresco.service.cmr.quickshare.QuickShareService;
import org.alfresco.service.cmr.repository.ChildAssociationRef;
import org.alfresco.service.cmr.repository.ContentData;
import org.alfresco.service.cmr.repository.ContentService;
@@ -147,6 +149,7 @@ public class NodesImpl implements Nodes
private ContentService contentService;
private ActionService actionService;
private VersionService versionService;
private QuickShareService quickShareService;
private Repository repositoryHelper;
private ServiceRegistry sr;
private Set<String> defaultIgnoreTypes;
@@ -191,6 +194,11 @@ public class NodesImpl implements Nodes
this.repositoryHelper = repositoryHelper;
}
public void setQuickShareService(QuickShareService quickShareService)
{
this.quickShareService = quickShareService;
}
public void setIgnoreTypes(Set<String> ignoreTypes)
{
this.defaultIgnoreTypes = ignoreTypes;
@@ -1121,11 +1129,27 @@ public class NodesImpl implements Nodes
// TODO: optional PATCH mechanism to add one new new aspect (with some related aspect properties) without affecting existing aspects/properties
for (QName aQName : aspectsToRemove)
{
// in future, this could/should be part of QuickShareService aspect "behaviour"
if (aQName.equals(QuickShareModel.ASPECT_QSHARE))
{
String qShareId = (String)nodeService.getProperty(nodeRef, QuickShareModel.PROP_QSHARE_SHAREDID);
if (qShareId != null)
{
quickShareService.unshareContent(qShareId);
}
}
nodeService.removeAspect(nodeRef, aQName);
}
for (QName aQName : aspectsToAdd)
{
// in future, this could/should be part of QuickShareService aspect "behaviour"
if (aQName.equals(QuickShareModel.ASPECT_QSHARE))
{
quickShareService.shareContent(nodeRef);
}
nodeService.addAspect(nodeRef, aQName, null);
}
}