Merged WEBAPP-API (5.2.1) to 5.2.N (5.2.1)

133145 jkaabimofrad: APPSREPO-54: Added support to the quick-share V1 API to allow setting an optional expiry date when creating a shared link.
              - Also, fixed the overloaded shareContent method which was missed during code clean-up.


git-svn-id: https://svn.alfresco.com/repos/alfresco-enterprise/alfresco/BRANCHES/DEV/5.2.N/root@133219 c4b6b30b-aa2e-2d43-bbcb-ca4b014f7261
This commit is contained in:
Jamal Kaabi-Mofrad
2016-11-28 16:54:07 +00:00
parent cbb241f466
commit 50f50eeecf
3 changed files with 159 additions and 6 deletions

View File

@@ -29,6 +29,7 @@ import org.alfresco.model.ContentModel;
import org.alfresco.model.QuickShareModel;
import org.alfresco.query.PagingRequest;
import org.alfresco.repo.quickshare.QuickShareClientNotFoundException;
import org.alfresco.repo.quickshare.QuickShareLinkExpiryActionException;
import org.alfresco.repo.quickshare.QuickShareServiceImpl.QuickShareEmailRequest;
import org.alfresco.repo.search.QueryParameterDefImpl;
import org.alfresco.repo.security.authentication.AuthenticationUtil;
@@ -329,13 +330,17 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
// Note: since we already check node exists above, we can assume that InvalidNodeRefException (=> 404) here means not content (see type check)
try
{
QuickShareDTO qsDto = quickShareService.shareContent(nodeRef);
QuickShareDTO qsDto = quickShareService.shareContent(nodeRef, qs.getExpiresAt());
result.add(getQuickShareInfo(qsDto.getId(), false, includeParam));
}
catch (InvalidNodeRefException inre)
{
throw new InvalidArgumentException("Unable to create shared link to non-file content: " + nodeId);
}
catch (QuickShareLinkExpiryActionException ex)
{
throw new InvalidArgumentException(ex.getMessage());
}
}
catch (AccessDeniedException ade)
{
@@ -576,6 +581,7 @@ public class QuickShareLinksImpl implements QuickShareLinks, RecognizedParamsExt
qs.setModifiedAt((Date) map.get("modified"));
qs.setModifiedByUser(modifiedByUser);
qs.setSharedByUser(sharedByUser);
qs.setExpiresAt((Date) map.get("expiryDate"));
// note: if noAuth mode then do not return allowable operations (eg. but can be optionally returned when finding shared links)
if ((! noAuth) && includeParam.contains(PARAM_INCLUDE_ALLOWABLEOPERATIONS))

View File

@@ -48,6 +48,8 @@ public class QuickShareLink
// unique short id (ie. shorter than a guid, 22 vs 36 chars)
private String sharedId;
private Date expiresAt;
private String nodeId;
private String name;
@@ -79,7 +81,17 @@ public class QuickShareLink
this.sharedId = sharedId;
}
public String getNodeId() {
public Date getExpiresAt()
{
return expiresAt;
}
public void setExpiresAt(Date expiresAt)
{
this.expiresAt = expiresAt;
}
public String getNodeId() {
return nodeId;
}
@@ -160,6 +172,7 @@ public class QuickShareLink
sb.append(", sharedByUser=").append(getSharedByUser());
sb.append(", content=").append(getContent());
sb.append(", allowableOperations=").append(getAllowableOperations());
sb.append(", expiresAt=").append(getExpiresAt());
sb.append("]");
return sb.toString();
}