Пример #1
0
 /**
  * Get an invitation to this web site
  *
  * @return the invitation or null if it does not exist
  */
 public ScriptInvitation<?> getInvitation(String invitationId) {
   try {
     Invitation invitation = invitationService.getInvitation(invitationId);
     return scriptInvitationFactory.toScriptInvitation(invitation);
   } catch (InvitationException e) {
     return null;
   }
 }
Пример #2
0
 /**
  * list the outstanding invitations for this site
  *
  * <p>Map of name / invitation
  */
 public ScriptInvitation<?>[] listInvitations() {
   List<Invitation> invitations =
       invitationService.listPendingInvitationsForResource(
           Invitation.ResourceType.WEB_SITE, getShortName());
   ScriptInvitation<?>[] ret = new ScriptInvitation[invitations.size()];
   int i = 0;
   for (Invitation item : invitations) {
     ret[i++] = scriptInvitationFactory.toScriptInvitation(item);
   }
   return ret;
 }
Пример #3
0
 /**
  * Create new moderated invitation to this web site
  *
  * @return the new invitation
  */
 public ScriptInvitation<?> inviteModerated(
     String inviteeComments, String inviteeUserName, String inviteeRole) {
   Invitation invitation =
       invitationService.inviteModerated(
           inviteeComments,
           inviteeUserName,
           Invitation.ResourceType.WEB_SITE,
           getShortName(),
           inviteeRole);
   return scriptInvitationFactory.toScriptInvitation(invitation);
 }
Пример #4
0
 /**
  * Create new nominated invitation to this web site
  *
  * @return the new invitation
  */
 public ScriptInvitation<?> inviteNominated(
     String inviteeUserName, String inviteeRole, String acceptUrl, String rejectUrl) {
   Invitation invitation =
       invitationService.inviteNominated(
           inviteeUserName,
           Invitation.ResourceType.WEB_SITE,
           getShortName(),
           inviteeRole,
           acceptUrl,
           rejectUrl);
   return scriptInvitationFactory.toScriptInvitation(invitation);
 }
Пример #5
0
  /**
   * List the open invitations for this web site. props specifies optional properties to be
   * searched.
   *
   * @param props inviteeUserName
   * @return the invitations
   */
  public ScriptInvitation<?>[] listInvitations(Scriptable props) {
    InvitationSearchCriteriaImpl crit = new InvitationSearchCriteriaImpl();
    crit.setResourceName(getShortName());
    crit.setResourceType(Invitation.ResourceType.WEB_SITE);

    if (props.has("inviteeUserName", props)) {
      crit.setInvitee((String) props.get("inviteeUserName", props));
    }
    if (props.has("invitationType", props)) {
      String invitationType = (String) props.get("invitationType", props);
      crit.setInvitationType(InvitationType.valueOf(invitationType));
    }

    List<Invitation> invitations = invitationService.searchInvitation(crit);
    ScriptInvitation<?>[] ret = new ScriptInvitation[invitations.size()];
    int i = 0;
    for (Invitation item : invitations) {
      ret[i++] = scriptInvitationFactory.toScriptInvitation(item);
    }
    return ret;
  }