本文整理汇总了Java中org.alfresco.service.cmr.invitation.Invitation.ResourceType方法的典型用法代码示例。如果您正苦于以下问题:Java Invitation.ResourceType方法的具体用法?Java Invitation.ResourceType怎么用?Java Invitation.ResourceType使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.alfresco.service.cmr.invitation.Invitation
的用法示例。
在下文中一共展示了Invitation.ResourceType方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
示例2: testWorkflowTaskContainsProps
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
public void testWorkflowTaskContainsProps()
{
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String serverPath = "wibble";
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
NominatedInvitation nomInvite = invitationService.inviteNominated(USER_ONE,
resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
WorkflowTask task = getTaskForInvitation(nomInvite);
Map<QName, Serializable> props = task.getProperties();
assertEquals(inviteeRole, props.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_ROLE));
assertEquals(nomInvite.getResourceDescription(), props.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_DESCRIPTION));
assertEquals(nomInvite.getResourceTitle(), props.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_TITLE));
// Accept the invitation
invitationService.accept(nomInvite.getInviteId(), nomInvite.getTicket());
task = workflowService.getTaskById(task.getId());
props = task.getProperties();
assertEquals(inviteeRole, props.get(WorkflowModelNominatedInvitation.WF_PROP_INVITEE_ROLE));
assertEquals(nomInvite.getResourceDescription(), props.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_DESCRIPTION));
assertEquals(nomInvite.getResourceTitle(), props.get(WorkflowModelNominatedInvitation.WF_PROP_RESOURCE_TITLE));
}
示例3: inviteModerated
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* Start the invitation process for a ModeratedInvitation
*
* @param inviteeComments why does the invitee want access to the resource ?
* @param inviteeUserName who is to be invited
* @param resourceType Invitation .ResourceType what resource type ?
* @param resourceName which resource
* @param inviteeRole which role ?
*/
public ModeratedInvitation inviteModerated(String inviteeComments, String inviteeUserName,
Invitation.ResourceType resourceType, String resourceName, String inviteeRole)
{
if (resourceType == Invitation.ResourceType.WEB_SITE)
{
return startModeratedInvite(inviteeComments, inviteeUserName, resourceType, resourceName, inviteeRole);
}
throw new InvitationException("unknown resource type");
}
示例4: listPendingInvitationsForInvitee
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
public List<Invitation> listPendingInvitationsForInvitee(String invitee, Invitation.ResourceType resourceType)
{
InvitationSearchCriteriaImpl crit = new InvitationSearchCriteriaImpl();
crit.setInvitationType(InvitationSearchCriteria.InvitationType.ALL);
crit.setInvitee(invitee);
crit.setResourceType(resourceType);
return searchInvitation(crit);
}
示例5: getPendingInvitationCriteriaForResource
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* Returns search criteria to find pending invitations
* @param resourceType Invitation.ResourceType
* @param resourceName String
* @return search criteria
*/
private InvitationSearchCriteriaImpl getPendingInvitationCriteriaForResource(
Invitation.ResourceType resourceType, String resourceName)
{
InvitationSearchCriteriaImpl criteria = new InvitationSearchCriteriaImpl();
criteria.setInvitationType(InvitationSearchCriteria.InvitationType.ALL);
criteria.setResourceType(resourceType);
criteria.setResourceName(resourceName);
return criteria;
}
示例6: startModeratedInvite
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* Moderated invitation implementation
*
* @return the new moderated invitation
*/
private ModeratedInvitation startModeratedInvite(String inviteeComments, String inviteeUserName,
Invitation.ResourceType resourceType, String resourceName, String inviteeRole)
{
SiteInfo siteInfo = siteService.getSite(resourceName);
if (siteService.isMember(resourceName, inviteeUserName))
{
if (logger.isDebugEnabled())
logger.debug("Failed - invitee user is already a member of the site.");
Object objs[] = { inviteeUserName, "", resourceName };
throw new InvitationExceptionUserError("invitation.invite.already_member", objs);
}
String roleGroup = siteService.getSiteRoleGroup(resourceName, SiteModel.SITE_MANAGER);
// get the workflow description
String workflowDescription = generateWorkflowDescription(siteInfo, "invitation.moderated.workflow.description");
Map<QName, Serializable> workflowProps = new HashMap<QName, Serializable>(16);
workflowProps.put(WorkflowModel.PROP_WORKFLOW_DESCRIPTION, workflowDescription);
workflowProps.put(WorkflowModelModeratedInvitation.ASSOC_GROUP_ASSIGNEE, roleGroup);
workflowProps.put(WorkflowModelModeratedInvitation.WF_PROP_INVITEE_COMMENTS, inviteeComments);
workflowProps.put(WorkflowModelModeratedInvitation.WF_PROP_INVITEE_ROLE, inviteeRole);
workflowProps.put(WorkflowModelModeratedInvitation.WF_PROP_INVITEE_USER_NAME, inviteeUserName);
workflowProps.put(WorkflowModelModeratedInvitation.WF_PROP_RESOURCE_NAME, resourceName);
workflowProps.put(WorkflowModelModeratedInvitation.WF_PROP_RESOURCE_TYPE, resourceType.toString());
// get the moderated workflow
WorkflowDefinition wfDefinition = getWorkflowDefinition(InvitationWorkflowType.MODERATED);
return (ModeratedInvitation) startWorkflow(wfDefinition, workflowProps);
}
示例7: checkManagerRole
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* Check that the specified user has manager role over the resource.
*
* @param userId user id
* @throws InvitationException
*/
private void checkManagerRole(String userId, Invitation.ResourceType resourceType, String siteShortName)
{
// if inviter is not the site manager then throw web script exception
String inviterRole = this.siteService.getMembersRole(siteShortName, userId);
if ((inviterRole == null) || (inviterRole.equals(SiteModel.SITE_MANAGER) == false))
{
Object objs[] = { userId, siteShortName };
throw new InvitationExceptionForbidden("invitation.invite.not_site_manager", objs);
}
}
示例8: testWorkflowTaskContainsProps
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* Nominated invites workflows finish without waiting for user accept
*/
public void testWorkflowTaskContainsProps()
{
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String serverPath = "wibble";
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
NominatedInvitation nomInvite = invitationService.inviteNominated(USER_ONE,
resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
List<WorkflowPath> paths = workflowService.getWorkflowPaths(nomInvite.getInviteId());
assertEquals(0, paths.size());
}
示例9: testInternalUserNotDeletedAfterInviteCancelled
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* MNT-9101 An internal user account (disabled) should not be deleted if an
* associated nominated invitation is cancelled.
*
* @throws Exception
*/
public void testInternalUserNotDeletedAfterInviteCancelled() throws Exception
{
// Disable our existing User
boolean enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
assertTrue("User One authentication disabled", enabled);
authenticationService.setAuthenticationEnabled(USER_ONE, false);
enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
assertTrue("User One authentication enabled", !enabled);
String inviteeUserName = USER_ONE;
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
this.authenticationComponent.setCurrentUser(USER_MANAGER);
// Invite our existing user
try
{
invitationService.inviteNominated(inviteeUserName, resourceType, resourceName, inviteeRole, acceptUrl, rejectUrl);
fail("An exception of type " + InvitationExceptionUserError.class.getName() + " should be thrown");
}
catch (Exception ex)
{
assertTrue("Incorrect exception was thrown", ex instanceof InvitationExceptionUserError);
}
// Our User and associated Authentication still exists
assertNotNull("User Exists", personService.getPersonOrNull(USER_ONE));
assertTrue("Authentication Exists", authenticationService.authenticationExists(USER_ONE));
}
示例10: testExternalUserDeletedAfterInviteCancelled
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* Ensure that an External user account is deleted when an invite is
* cancelled
*
* @throws Exception
*/
public void testExternalUserDeletedAfterInviteCancelled() throws Exception
{
String inviteeFirstName = PERSON_FIRSTNAME;
String inviteeLastName = PERSON_LASTNAME;
String inviteeEmail = "[email protected]";
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String serverPath = "wibble";
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
this.authenticationComponent.setCurrentUser(USER_MANAGER);
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(
inviteeFirstName, inviteeLastName, inviteeEmail, resourceType, resourceName,
inviteeRole, serverPath, acceptUrl, rejectUrl);
String inviteeUsername = nominatedInvitation.getInviteeUserName();
invitationService.cancel(nominatedInvitation.getInviteId());
// Our User and Authentication has been removed
assertNull("Person deleted", personService.getPersonOrNull(inviteeUsername));
assertFalse("Authentication deleted",
authenticationService.authenticationExists(inviteeUsername));
}
示例11: test_MNT15614
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* MNT-15614 Site with name "IT" cannot be managed properly
*
* @throws Exception
*/
public void test_MNT15614() throws Exception
{
String[] siteNames = {"it", "site", "GROUP"};
String inviteeUserName = USER_ONE;
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
this.authenticationComponent.setCurrentUser(AuthenticationUtil.getAdminUserName());
for (String siteName : siteNames)
{
SiteInfo siteInfoRed = siteService.getSite(siteName);
if (siteInfoRed == null)
{
siteService.createSite("InviteSitePreset", siteName, "InviteSiteTitle",
"InviteSiteDescription", SiteVisibility.MODERATED);
}
assertEquals( SiteModel.SITE_MANAGER, siteService.getMembersRole(siteName, AuthenticationUtil.getAdminUserName()));
// Invite user
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(
inviteeUserName, resourceType, siteName, inviteeRole, acceptUrl, rejectUrl);
assertNotNull("nominated invitation is null", nominatedInvitation);
}
}
示例12: testSearchInvitationWithLimit
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* test that the search limiter works
*/
public void testSearchInvitationWithLimit() throws Exception
{
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String serverPath = "wibble";
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
authenticationComponent.setCurrentUser(USER_MANAGER);
// Create 10 invites
for (int i = 0; i < 10; i++)
{
invitationService
.inviteNominated(USER_ONE, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
}
// Invite USER_TWO
NominatedInvitation inviteForUserTwo = invitationService.inviteNominated(USER_TWO, resourceType, resourceName,
inviteeRole, serverPath, acceptUrl, rejectUrl);
InvitationSearchCriteriaImpl query = new InvitationSearchCriteriaImpl();
query.setInvitee(USER_TWO);
// search all of them
List<Invitation> results = invitationService.searchInvitation(query, 0);
assertEquals(1, results.size());
assertEquals(inviteForUserTwo.getInviteId(), results.get(0).getInviteId());
query = new InvitationSearchCriteriaImpl();
query.setInvitee(USER_ONE);
final int MAX_SEARCH = 3;
// only search for the first MAX_SEARCH
results = invitationService.searchInvitation(query, MAX_SEARCH);
assertEquals(MAX_SEARCH, results.size());
}
示例13: disabled_test100Invites
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
public void disabled_test100Invites() throws Exception
{
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String serverPath = "wibble";
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
authenticationComponent.setCurrentUser(USER_MANAGER);
// Create 1000 invites
for (int i = 0; i < 1000; i++)
{
invitationService.inviteNominated(USER_ONE, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
}
// Invite USER_TWO
NominatedInvitation invite = invitationService.inviteNominated(USER_TWO, resourceType, resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
InvitationSearchCriteriaImpl query = new InvitationSearchCriteriaImpl();
query.setInvitee(USER_TWO);
long start = System.currentTimeMillis();
List<Invitation> results = invitationService.searchInvitation(query);
long end= System.currentTimeMillis();
System.out.println("Invitation Search took " + (end - start) + "ms.");
assertEquals(1, results.size());
assertEquals(invite.getInviteId(), results.get(0).getInviteId());
this.setComplete();
this.endTransaction();
}
示例14: onSetUpInTransaction
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
@Override
protected void onSetUpInTransaction() throws Exception
{
super.onSetUpInTransaction();
// Add a few Jbpm invitations to check they dont' interfere with Activiti invitations.
workflowAdminService.setEnabledEngines(Arrays.asList(ActivitiConstants.ENGINE_ID));
String invitee = USER_ONE;
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String serverPath = "wibble";
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
authenticationComponent.setCurrentUser(USER_MANAGER);
// Start Nominated Invitation
invitationService.inviteNominated(invitee, resourceType,
resourceName, inviteeRole, serverPath, acceptUrl, rejectUrl);
// Start Moderated Invitation
invitationService.inviteModerated("", invitee,
resourceType, resourceName, inviteeRole);
// Disable Jbpm and enable Activiti
workflowAdminService.setEnabledEngines(Arrays.asList(JBPMEngine.ENGINE_ID));
}
示例15: testInternalUserNotDeletedAfterInviteCancelled
import org.alfresco.service.cmr.invitation.Invitation; //导入方法依赖的package包/类
/**
* MNT-9101 An internal user account (disabled) should not be deleted if an
* associated nominated invitation is cancelled.
*
* @throws Exception
*/
public void testInternalUserNotDeletedAfterInviteCancelled() throws Exception
{
// Disable our existing User
boolean enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
assertTrue("User One authentication disabled", enabled);
authenticationService.setAuthenticationEnabled(USER_ONE, false);
enabled = authenticationService.getAuthenticationEnabled(USER_ONE);
assertTrue("User One authentication enabled", !enabled);
String inviteeUserName = USER_ONE;
Invitation.ResourceType resourceType = Invitation.ResourceType.WEB_SITE;
String resourceName = SITE_SHORT_NAME_INVITE;
String inviteeRole = SiteModel.SITE_COLLABORATOR;
String acceptUrl = "froob";
String rejectUrl = "marshmallow";
this.authenticationComponent.setCurrentUser(USER_MANAGER);
// Invite our existing user
NominatedInvitation nominatedInvitation = invitationService.inviteNominated(
inviteeUserName, resourceType, resourceName, inviteeRole, acceptUrl, rejectUrl);
// Cancel the invite
invitationService.cancel(nominatedInvitation.getInviteId());
// Our User and associated Authentication still exists
assertNotNull("User Exists", personService.getPersonOrNull(USER_ONE));
assertTrue("Authentication Exists", authenticationService.authenticationExists(USER_ONE));
}