當前位置: 首頁>>代碼示例>>Java>>正文


Java Invitation類代碼示例

本文整理匯總了Java中org.alfresco.service.cmr.invitation.Invitation的典型用法代碼示例。如果您正苦於以下問題:Java Invitation類的具體用法?Java Invitation怎麽用?Java Invitation使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Invitation類屬於org.alfresco.service.cmr.invitation包,在下文中一共展示了Invitation類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: inviteModerated

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
/**
 * Create new moderated invitation to this web site
 * @return the new invitation
 */
public ScriptInvitation<?> inviteModerated(String inviteeComments, String inviteeUserName, String inviteeRole)
{
     InvitationSearchCriteriaImpl crit = new InvitationSearchCriteriaImpl();   
     crit.setResourceName(getShortName());
     crit.setResourceType(Invitation.ResourceType.WEB_SITE);
     crit.setInvitee(inviteeUserName);
 
     List<Invitation> invitations = invitationService.searchInvitation(crit);
     if(invitations.isEmpty()) 
     {
        Invitation invitation = invitationService.inviteModerated(inviteeComments, inviteeUserName, Invitation.ResourceType.WEB_SITE, getShortName(), inviteeRole);
        return scriptInvitationFactory.toScriptInvitation(invitation);
     }
     else
     {
         throw new InvitationException("A request to join this site is in pending"); 
     }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:23,代碼來源:Site.java

示例2: listInvitations

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
/**
   * 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;
  }
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:34,代碼來源:Site.java

示例3: toScriptInvitation

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
public ScriptInvitation<?> toScriptInvitation(Invitation invitation)
{
    if(invitation instanceof NominatedInvitation)
    {
        return new ScriptNominatedInvitation((NominatedInvitation) invitation, invitationService);
    }

    if(invitation instanceof ModeratedInvitation)
    {
        String userName = invitation.getInviteeUserName();
        NodeRef person = personService.getPerson(userName);
        Map<QName, Serializable> properties = nodeService.getProperties(person);
        String firstName = (String) properties.get(ContentModel.PROP_FIRSTNAME);
        String lastName = (String) properties.get(ContentModel.PROP_LASTNAME);
        String email = (String) properties.get(ContentModel.PROP_EMAIL);
        return new ScriptModeratedInvitation(
                    (ModeratedInvitation) invitation,
                    invitationService,
                    email,
                    firstName,
                    lastName);
    }
    throw new AlfrescoRuntimeException("Unknown invitation type.");
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:25,代碼來源:ScriptInvitationFactory.java

示例4: inviteNominated

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
/**
 * Start the invitation process for a NominatedInvitation
 * 
 * @param inviteeUserName Alfresco user name of the invitee
 * @param resourceType resourceType
 * @param resourceName String
 * @param inviteeRole String
 * @param acceptUrl String
 * @param rejectUrl String
 * @return the nominated invitation which will contain the invitationId and
 *         ticket which will uniqely identify this invitation for the rest
 *         of the workflow.
 * @throws InvitationException
 * @throws InvitationExceptionUserError
 * @throws InvitationExceptionForbidden
 */
public NominatedInvitation inviteNominated(String inviteeUserName, Invitation.ResourceType resourceType,
            String resourceName, String inviteeRole, String acceptUrl, String rejectUrl)
{
    // inviteeUserName was specified
    NodeRef person = this.personService.getPerson(inviteeUserName);

    Serializable firstNameVal = this.getNodeService().getProperty(person, ContentModel.PROP_FIRSTNAME);
    Serializable lastNameVal = this.getNodeService().getProperty(person, ContentModel.PROP_LASTNAME);
    Serializable emailVal = this.getNodeService().getProperty(person, ContentModel.PROP_EMAIL);
    String firstName = DefaultTypeConverter.INSTANCE.convert(String.class, firstNameVal);
    String lastName = DefaultTypeConverter.INSTANCE.convert(String.class, lastNameVal);
    String email = DefaultTypeConverter.INSTANCE.convert(String.class, emailVal);
    String serverPath = UrlUtil.getShareUrl(sysAdminParams);

    return inviteNominated(firstName, lastName, email, inviteeUserName, resourceType, resourceName, inviteeRole,
                serverPath, acceptUrl, rejectUrl);
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:34,代碼來源:InvitationServiceImpl.java

示例5: approve

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
/**
 * Moderator approves this invitation
 * 
 * @param invitationId the request id
 * @param reason comments about the acceptance
 */
public Invitation approve(String invitationId, String reason)
{
    WorkflowTask startTask = getStartTask(invitationId);
    ModeratedInvitation invitation = getModeratedInvitation(invitationId);
    if(invitation == null)
    {
        String msg = "State error, can only call approve on a Moderated invitation.";
        throw new InvitationException(msg);
    }

    // Check approver is a site manager
    String currentUser = this.authenticationService.getCurrentUserName();
    checkManagerRole(currentUser, invitation.getResourceType(), invitation.getResourceName());
    Map<QName, Serializable> wfReviewProps = new HashMap<QName, Serializable>();
    wfReviewProps.put(ContentModel.PROP_OWNER, currentUser);
    wfReviewProps.put(WorkflowModelModeratedInvitation.WF_PROP_REVIEW_COMMENTS, reason);
    endInvitation(startTask,
            WorkflowModelModeratedInvitation.WF_TRANSITION_APPROVE,
            wfReviewProps,
            WorkflowModelModeratedInvitation.WF_ACTIVITI_REVIEW_TASK);
    return invitation;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:29,代碼來源:InvitationServiceImpl.java

示例6: rejectModeratedInvitation

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
private Invitation rejectModeratedInvitation(WorkflowTask startTask, String reason)
{
    ModeratedInvitation invitation = getModeratedInvitation(startTask.getPath().getId());
    // Check rejecter is a site manager and throw and exception if not
    String rejecterUserName = this.authenticationService.getCurrentUserName();
    checkManagerRole(rejecterUserName, invitation.getResourceType(), invitation.getResourceName());

    Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(ContentModel.PROP_OWNER, rejecterUserName);
    properties.put(WorkflowModelModeratedInvitation.WF_PROP_REVIEW_COMMENTS, reason);

    endInvitation(startTask,
            WorkflowModelModeratedInvitation.WF_TRANSITION_REJECT,
            properties,
            WorkflowModelModeratedInvitation.WF_ACTIVITI_REVIEW_TASK);
    return invitation;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:InvitationServiceImpl.java

示例7: cancel

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
/**
* {@inheritDoc}
 */
public Invitation cancel(String invitationId)
{
    try
    {
        WorkflowTask startTask = getStartTask(invitationId);
        if (taskTypeMatches(startTask, WorkflowModelModeratedInvitation.WF_START_TASK))
        {
            return cancelModeratedInvitation(startTask);
        }
        else
        {
            return cancelNominatedInvitation(startTask);
        }
    }
    catch (InvitationExceptionNotFound e)
    {
        // Invitation already deleted or deleted in background
        return null;
    }
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:24,代碼來源:InvitationServiceImpl.java

示例8: cancelModeratedInvitation

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
private Invitation cancelModeratedInvitation(WorkflowTask startTask)
{
    ModeratedInvitation invitation = getModeratedInvitation(startTask.getPath().getId());
    String currentUserName = this.authenticationService.getCurrentUserName();
    if (!AuthenticationUtil.isRunAsUserTheSystemUser())
    {
        if (false == currentUserName.equals(invitation.getInviteeUserName()))
        {
            checkManagerRole(currentUserName, invitation.getResourceType(), invitation.getResourceName());
        }
    }
    // Only proceed with the cancel if the site still exists (the site may have been deleted and invitations may be
    // getting cancelled in the background)
    if (this.siteService.getSite(invitation.getResourceName()) != null)
    {
        workflowService.cancelWorkflow(invitation.getInviteId());
    }
    return invitation;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:20,代碼來源:InvitationServiceImpl.java

示例9: cancelNominatedInvitation

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
private Invitation cancelNominatedInvitation(WorkflowTask startTask)
{
    NominatedInvitation invitation = getNominatedInvitation(startTask);
    String currentUserName = this.authenticationService.getCurrentUserName();
    if (!AuthenticationUtil.isRunAsUserTheSystemUser())
    {
        if (false == currentUserName.equals(invitation.getInviterUserName()))
        {
            checkManagerRole(currentUserName, invitation.getResourceType(), invitation.getResourceName());
        }
    }
    // Only proceed with the cancel if the site still exists (the site may have been deleted and invitations may be
    // getting cancelled in the background)
    if (this.siteService.getSite(invitation.getResourceName()) != null)
    {
        endInvitation(startTask, WorkflowModelNominatedInvitation.WF_TRANSITION_CANCEL, null,
                WorkflowModelNominatedInvitation.WF_TASK_ACTIVIT_INVITE_PENDING);
    }
    return invitation;
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:21,代碼來源:InvitationServiceImpl.java

示例10: searchInvitation

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
private List<Invitation> searchInvitation(final InvitationSearchCriteria criteria, List<String> invitationIds)
{
    final Map<String, WorkflowTask> taskCache = getInvitationTasks(invitationIds);
    return CollectionUtils.transform(invitationIds, new Function<String, Invitation>()
    {
        public Invitation apply(String invitationId)
        {
            WorkflowTask startTask = taskCache.get(invitationId);
            if (startTask == null)
            {
                return null;
            }
            Invitation invitation = getInvitation(startTask);
            return invitationMatches(invitation, criteria) ? invitation : null;
        }
    });
}
 
開發者ID:Alfresco,項目名稱:alfresco-repository,代碼行數:18,代碼來源:InvitationServiceImpl.java

示例11: checkAndCancelTheInvitation

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
protected void checkAndCancelTheInvitation(final String invId, String siteShortName)
{
    Invitation invitation = null;
    try
    {
        invitation = invitationService.getInvitation(invId);
    }
    catch (org.alfresco.service.cmr.invitation.InvitationExceptionNotFound ienf)
    {
        throwInvitationNotFoundException(invId, siteShortName);
    }
    if (invitation == null)
    {
        throwInvitationNotFoundException(invId, siteShortName);
    }

    // check that this invitation really belongs to the specified siteShortName
    if (invitation != null && invitation.getResourceName() != null && !siteShortName.equals(invitation.getResourceName()))
    {
        throw new WebScriptException(Status.STATUS_FORBIDDEN, "Unable to cancel workflow");
    }

    invitationService.cancel(invId);
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:25,代碼來源:InvitationDelete.java

示例12: getSiteInvitation

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
private Invitation getSiteInvitation(String inviteeId, String siteId)
  {
// Is there an outstanding site invite request for the invitee?
InvitationSearchCriteriaImpl criteria = new InvitationSearchCriteriaImpl();
criteria.setInvitationType(InvitationType.MODERATED);
criteria.setInvitee(inviteeId);
criteria.setResourceName(siteId);
criteria.setResourceType(ResourceType.WEB_SITE);
List<Invitation> invitations = invitationService.searchInvitation(criteria);
if(invitations.size() > 1)
{
	// TODO exception
	throw new AlfrescoRuntimeException("There should be only one outstanding site invitation");
}
return (invitations.size() == 0 ? null : invitations.get(0));
  }
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:17,代碼來源:SiteMembershipRequestsImpl.java

示例13: cancelSiteMembershipRequest

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
@Override
public void cancelSiteMembershipRequest(String inviteeId, String siteId)
{
	inviteeId = people.validatePerson(inviteeId);
	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();

	Invitation invitation = getSiteInvitation(inviteeId, siteId);
	if(invitation == null)
	{
		// no such invitation
   		throw new RelationshipResourceNotFoundException(inviteeId, siteId);
	}
	invitationService.cancel(invitation.getInviteId());
}
 
開發者ID:Alfresco,項目名稱:alfresco-remote-api,代碼行數:22,代碼來源:SiteMembershipRequestsImpl.java

示例14: approve

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
/**
 * Moderator approves this invitation
 * 
 * @param invitationId the request id
 * @param reason comments about the acceptance
 */
public Invitation approve(String invitationId, String reason)
{
    WorkflowTask startTask = getStartTask(invitationId);
    ModeratedInvitation invitation = getModeratedInvitation(invitationId);
    if(invitation == null)
    {
        String msg = "State error, can only call approve on a Moderated invitation.";
        throw new InvitationException(msg);
    }

    // Check approver is a site manager
    String currentUser = this.authenticationService.getCurrentUserName();
    checkManagerRole(currentUser, invitation.getResourceType(), invitation.getResourceName());
    Map<QName, Serializable> wfReviewProps = new HashMap<QName, Serializable>();
    wfReviewProps.put(ContentModel.PROP_OWNER, currentUser);
    wfReviewProps.put(WorkflowModelModeratedInvitation.WF_PROP_REVIEW_COMMENTS, reason);
    endInvitation(startTask,
            WorkflowModelModeratedInvitation.WF_TRANSITION_APPROVE,
            wfReviewProps,
            WorkflowModelModeratedInvitation.WF_ACTIVITI_REVIEW_TASK, WorkflowModelModeratedInvitation.WF_REVIEW_TASK);
    return invitation;
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:29,代碼來源:InvitationServiceImpl.java

示例15: rejectModeratedInvitation

import org.alfresco.service.cmr.invitation.Invitation; //導入依賴的package包/類
private Invitation rejectModeratedInvitation(WorkflowTask startTask, String reason)
{
    ModeratedInvitation invitation = getModeratedInvitation(startTask.getPath().getId());
    // Check rejecter is a site manager and throw and exception if not
    String rejecterUserName = this.authenticationService.getCurrentUserName();
    checkManagerRole(rejecterUserName, invitation.getResourceType(), invitation.getResourceName());

    Map<QName, Serializable> properties = new HashMap<QName, Serializable>();
    properties.put(ContentModel.PROP_OWNER, rejecterUserName);
    properties.put(WorkflowModelModeratedInvitation.WF_PROP_REVIEW_COMMENTS, reason);

    endInvitation(startTask,
            WorkflowModelModeratedInvitation.WF_TRANSITION_REJECT,
            properties,
            WorkflowModelModeratedInvitation.WF_ACTIVITI_REVIEW_TASK, WorkflowModelModeratedInvitation.WF_REVIEW_TASK);
    return invitation;
}
 
開發者ID:Alfresco,項目名稱:community-edition-old,代碼行數:18,代碼來源:InvitationServiceImpl.java


注:本文中的org.alfresco.service.cmr.invitation.Invitation類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。