当前位置: 首页>>代码示例>>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;未经允许,请勿转载。