use of org.alfresco.service.cmr.invitation.InvitationExceptionNotFound in project alfresco-remote-api by Alfresco.
the class SiteMembershipRequestsImpl method updateSiteMembershipRequest.
@Override
public SiteMembershipRequest updateSiteMembershipRequest(String inviteeId, final SiteMembershipRequest siteInvite) {
SiteMembershipRequest updatedSiteInvite = null;
inviteeId = people.validatePerson(inviteeId, true);
String siteId = siteInvite.getId();
SiteInfo siteInfo = sites.validateSite(siteId);
if (siteInfo == null) {
// site does not exist
throw new RelationshipResourceNotFoundException(inviteeId, siteId);
}
// set the site id to the short name (to deal with case sensitivity issues with using the siteId from the url)
siteId = siteInfo.getShortName();
String message = siteInvite.getMessage();
if (message == null) {
// the invitation service ignores null messages so convert to an empty message.
message = "";
}
try {
ModeratedInvitation updatedInvitation = invitationService.updateModeratedInvitation(inviteeId, siteId, message);
if (updatedInvitation == null) {
throw new RelationshipResourceNotFoundException(inviteeId, siteId);
}
updatedSiteInvite = getSiteMembershipRequest(updatedInvitation);
} catch (InvitationExceptionNotFound e) {
throw new RelationshipResourceNotFoundException(inviteeId, siteId);
}
if (updatedSiteInvite == null) {
throw new RelationshipResourceNotFoundException(inviteeId, siteId);
}
return updatedSiteInvite;
}
use of org.alfresco.service.cmr.invitation.InvitationExceptionNotFound in project alfresco-remote-api by Alfresco.
the class InviteByTicket method execute.
private Map<String, Object> execute(WebScriptRequest req, Status status) {
// initialise model to pass on for template to render
Map<String, Object> model = new HashMap<String, Object>();
// get inviteId and inviteTicket
String inviteId = req.getServiceMatch().getTemplateVars().get("inviteId");
String inviteTicket = req.getServiceMatch().getTemplateVars().get("inviteTicket");
try {
Invitation invitation = invitationService.getInvitation(inviteId);
if (invitation instanceof NominatedInvitation) {
NominatedInvitation theInvitation = (NominatedInvitation) invitation;
String ticket = theInvitation.getTicket();
if (ticket == null || (!ticket.equals(inviteTicket))) {
throw new WebScriptException(Status.STATUS_NOT_FOUND, "Ticket mismatch");
}
// return the invite info
model.put("invite", toInviteInfo(theInvitation));
return model;
} else {
// Not a nominated invitation
throw new WebScriptException(Status.STATUS_FORBIDDEN, "Not a nominated invitation");
}
} catch (InvitationExceptionNotFound nfe) {
throw new WebScriptException(Status.STATUS_NOT_FOUND, "No invite found for given id");
}
}
Aggregations