本文整理汇总了Java中org.alfresco.service.cmr.invitation.Invitation.ResourceType类的典型用法代码示例。如果您正苦于以下问题:Java ResourceType类的具体用法?Java ResourceType怎么用?Java ResourceType使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ResourceType类属于org.alfresco.service.cmr.invitation.Invitation包,在下文中一共展示了ResourceType类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: inviteNominated
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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: getModeratedInvitationReviewTask
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的package包/类
private WorkflowTask getModeratedInvitationReviewTask(String inviteeId, String siteShortName)
{
WorkflowTask reviewTask = null;
// Is there an outstanding site invite request for the invitee?
InvitationSearchCriteriaImpl criteria = new InvitationSearchCriteriaImpl();
criteria.setInvitationType(InvitationType.MODERATED);
criteria.setInvitee(inviteeId);
criteria.setResourceName(siteShortName);
criteria.setResourceType(ResourceType.WEB_SITE);
// should be at most 1 invite
List<String> invitationIds = searchInvitationsForIds(criteria, 1);
if(invitationIds.size() == 1)
{
reviewTask = getModeratedInvitationReviewTask(invitationIds.get(0));
}
return reviewTask;
// List<Invitation> invitations = searchInvitation(criteria);
// if(invitations.size() > 1)
// {
// throw new AlfrescoRuntimeException("There should be only one outstanding site invitation");
// }
// return (invitations.size() == 0 ? null : (ModeratedInvitation)invitations.get(0));
}
示例3: getSiteInvitation
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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));
}
示例4: inviteModerated
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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");
}
示例5: listPendingInvitationsForInvitee
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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);
}
示例6: getPendingInvitationCriteriaForResource
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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;
}
示例7: startModeratedInvite
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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);
}
示例8: checkManagerRole
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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);
}
}
示例9: InvitationImpl
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的package包/类
public InvitationImpl(Map<String, Serializable> props)
{
this.inviteId = (String)props.get(ID_KEY);
this.inviteeUserName = (String)props.get(INVITEE_KEY);
this.resourceName = (String)props.get(RESOURCE_NAME_KEY);
this.roleName = (String)props.get(ROLE_KEY);
String type = (String)props.get(RESOURCE_TYPE_KEY);
this.resourceType = type==null ? ResourceType.WEB_SITE : ResourceType.valueOf(type);
this.createdAt = (Date)props.get(CREATED_AT);
this.modifiedAt = (Date)props.get(MODIFIED_AT);
}
示例10: testInternalUserNotDeletedAfterInviteCancelled
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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));
}
示例11: testExternalUserDeletedAfterInviteCancelled
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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));
}
示例12: test_MNT15614
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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);
}
}
示例13: testSearchInvitationWithLimit
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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());
}
示例14: disabled_test100Invites
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的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();
}
示例15: getSiteInvitations
import org.alfresco.service.cmr.invitation.Invitation.ResourceType; //导入依赖的package包/类
private List<Invitation> getSiteInvitations(String inviteeId)
{
InvitationSearchCriteriaImpl criteria = new InvitationSearchCriteriaImpl();
criteria.setInvitationType(InvitationType.MODERATED);
criteria.setInvitee(inviteeId);
criteria.setResourceType(ResourceType.WEB_SITE);
List<Invitation> invitations = invitationService.searchInvitation(criteria);
return invitations;
}