当前位置: 首页>>代码示例>>Java>>正文


Java IdUnusedException类代码示例

本文整理汇总了Java中org.sakaiproject.exception.IdUnusedException的典型用法代码示例。如果您正苦于以下问题:Java IdUnusedException类的具体用法?Java IdUnusedException怎么用?Java IdUnusedException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


IdUnusedException类属于org.sakaiproject.exception包,在下文中一共展示了IdUnusedException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getGroupsForSite

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * added by Sam Ottenhoff Feb 2010
 * Returns all groups for site
 * @param siteId
 * @return
 */
private Map getGroupsForSite(String siteId){
	Map sortedGroups = new TreeMap();
	Site site;
	try {
		site = siteService.getSite(siteId);
		Collection groups = site.getGroups();
		if (groups != null && groups.size() > 0) {
			Iterator groupIter = groups.iterator();
			while (groupIter.hasNext()) {
				Group group = (Group) groupIter.next();
				sortedGroups.put(group.getId(), group.getTitle());
			}
		}
	}
	catch (IdUnusedException ex) {
		// No site available
	}
	return sortedGroups;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:PublishedAssessmentFacadeQueries.java

示例2: buildUnjoinconfirmContext

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * Build context for confirmation screen
 * 
 * @param portlet
 * @param context
 * @param runData
 * @param state
 * @return
 */
public String buildUnjoinconfirmContext(VelocityPortlet portlet, Context context, RunData runData, SessionState state)
{
	context.put("tlang", RB);
	if (state.getAttribute(UNJOIN_SITE) != null)
	{
		String[] items=(String[])state.getAttribute(UNJOIN_SITE);
		List unjoinSite=new ArrayList();

		for( String item : items ){
			try
			{
				unjoinSite.add(SITE_SERV.getSite(item).getTitle());
			}catch (IdUnusedException e)
			{
				log.warn(e.getMessage());
			}
		}
		context.put("unjoinSite", unjoinSite);
		
	}

	String template = (String) getContext(runData).get("template");
	return template + "_confirm";
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:34,代码来源:MembershipAction.java

示例3: doJoinForMembership

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * Perform the steps needed to join a site. This includes determining if the global switch for
 * join limited by account type is enabled, as well as if it's enabled for the current site along
 * with the allowed account types set for the current site. The joiner group is also checked, and
 * joined if necessary.
 * 
 * Update: (Dec 2013 - [email protected]) these checks are now in kernel's join method, so just call join
 * 
 * @param siteID
 * 				the ID of the site in question
 * @return status (true/false)
 * @throws IdUnusedException
 * 				the ID (of the site) is un-used
 * @throws PermissionException
 * 				not enough permissions to join the site
 * @throws InUseException
 * 				the site is in an edit state somewhere else
 */
public static boolean doJoinForMembership( String siteID ) throws IdUnusedException, PermissionException, InUseException
{
	// Get the current user
	User currentUser = userDirectoryService.getCurrentUser();
	
	if( siteID == null || siteID.isEmpty() || currentUser == null )
	{
		return false;
	}
	
	// If the user is allowed to join, join.
	if( siteService.isAllowedToJoin( siteID ) )
	{
		// Join the site (without catching, so the try/catch in MembershipAction will catch the appropriate exception
		// and create the corresponding user facing error message)
		siteService.join( siteID );
		log.info( "Successfully added user '" + currentUser.getEid() + "' to site '" + siteID + "'" );
		
		return true;
	}
	
	return false;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:42,代码来源:JoinableSiteSettings.java

示例4: createEnrollments

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
private void createEnrollments() {
	for (String siteId : sites.keySet()) {
		Site site = sites.get(siteId);
		Set<String> enrollments = getRandomUsers(students.keySet());
		for (String enrollment : enrollments) {
			User user = students.get(enrollment);
			site.addMember(user.getId(), "Student", true, false);
		}
		for (User instructor : instructors.values()) {
			site.addMember(instructor.getId(), "Instructor", true, false);
           }
		try {
			siteService.save(site);
		} catch (IdUnusedException iue) {
			log.error("site doesn't exist:", iue);
		} catch (PermissionException pe) {
			log.error("site save permission:", pe);
		}
	}
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:SeedSitesAndUsersJob.java

示例5: testNormalizeResourceUrlsReplacesTwoResourceReferences

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
@Test
public void testNormalizeResourceUrlsReplacesTwoResourceReferences()
        throws NoSuchAlgorithmException, IOException, ServerOverloadException, IdUnusedException, TypeException, PermissionException {
    final String[] contentResourceDef1 = CONTENT_RESOURCES[0];
    final String[] contentResourceDef2 = CONTENT_RESOURCES[1];

    final String originalResourceReferencingDoc = resourceDocTemplate2(
            fullUrlForContentResource(contentResourceDef1),
            fullUrlForContentResource(contentResourceDef2));
    ArrayList<String[]> contentResourceDefs1 = new ArrayList<>();
    contentResourceDefs1.add(contentResourceDef1);
    ArrayList<String[]> contentResourceDefs2 = new ArrayList<>();
    contentResourceDefs2.add(contentResourceDef2);
    final String expectedResourceReferencingDoc = "Label:" + resourceDocTemplate1(
            expectedContentResourceHash(contentResourceDefs1)) + resourceDocTemplate1b(
            expectedContentResourceHash(contentResourceDefs2)) + "::";

    expectServerUrlLookup();
    expectResourceLookup(contentResourceDef1);
    expectResourceLookup(contentResourceDef2);
    final String actualParsedDoc = itemHashUtil.normalizeResourceUrls("Label",originalResourceReferencingDoc);
    assertThat(actualParsedDoc, equalTo(expectedResourceReferencingDoc));
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:24,代码来源:ItemHashUtilTest.java

示例6: getOpenDate

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
public Calendar getOpenDate(String siteId) {
	//Reference ref = entityManager.newReference(courseUuid);
	//String siteId = ref.getId();
	Site site;
	try {
		site = siteService().getSite(siteId);
	} catch (IdUnusedException e) {
		throw new RuntimeException("Can not find site " + siteId, e);
	}
	ResourceProperties props = site.getProperties();
	String open=props.getProperty(CourseImpl.STUDENT_OPEN_DATE);
	Calendar c=null;
	if (open!=null && open.length()>0){
		c = Calendar.getInstance();
		c.setTimeInMillis(Long.parseLong(open));
	}
	return c;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:19,代码来源:SectionManagerImpl.java

示例7: getSections

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * @inheritDoc
 */
public List getSections(final String siteContext) {
   	if(log.isDebugEnabled()) log.debug("Getting sections for context " + siteContext);
   	List<CourseSectionImpl> sectionList = new ArrayList<CourseSectionImpl>();
   	Collection<Group> sections;
   	try {
   		sections = siteService.getSite(siteContext).getGroups();
   	} catch (IdUnusedException e) {
   		log.error("No site with id = " + siteContext);
   		return sectionList;
   	}
   	for(Iterator<Group> iter = sections.iterator(); iter.hasNext();) {
   		Group group = (Group)iter.next();
   		sectionList.add(new CourseSectionImpl(group));
   	}
   	Collections.sort(sectionList);
   	return sectionList;
   }
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:21,代码来源:SectionAwarenessImpl.java

示例8: getTeachingAssistants

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * Get a list of teaching assistants in the current site
 *
 * @return
 */
public List<GbUser> getTeachingAssistants() {

	final String siteId = getCurrentSiteId();
	final List<GbUser> rval = new ArrayList<>();

	try {
		final Set<String> userUuids = this.siteService.getSite(siteId).getUsersIsAllowed(GbRole.TA.getValue());
		for (final String userUuid : userUuids) {
			rval.add(getUser(userUuid));
		}
	} catch (final IdUnusedException e) {
		log.warn("IdUnusedException trying to getTeachingAssistants", e);
	}

	return rval;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:22,代码来源:GradebookNgBusinessService.java

示例9: getSections

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * Filters out framework groups that do not have a category.  A section's
 * category is determined by 
 * 
 */
public List<CourseSection> getSections(String siteContext) {
	if(log.isDebugEnabled()) log.debug("Getting sections for context " + siteContext);
	List<CourseSection> sectionList = new ArrayList<CourseSection>();
	Collection sections;
	try {
		sections = getSiteGroups(getSite(siteContext));
	} catch (IdUnusedException e) {
		log.error("No site with id = " + siteContext);
		return new ArrayList<CourseSection>();
	}
	for(Iterator iter = sections.iterator(); iter.hasNext();) {
		Group group = (Group)iter.next();
		// Only use groups with a category defined.  If there is no category,
		// it is not a section.
		if(StringUtils.trimToNull(
				group.getProperties().getProperty(CourseSectionImpl.CATEGORY)) != null) {
			sectionList.add(new CourseSectionImpl(group));
		}
	}
	return sectionList;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:SectionManagerImpl.java

示例10: getPasswordResetUrl

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * Gets the password reset URL. If looks for a configured URL, otherwise it looks
 * for the password reset tool in the gateway site and builds a link to that.
 * @return The password reset URL or <code>null</code> if there isn't one or we
 * can't find the password reset tool.
 */
public String getPasswordResetUrl()
{
	// Has a password reset url been specified in sakai.properties? If so, it rules.
	String passwordResetUrl = serverConfigurationService.getString("login.password.reset.url", null);

	if(passwordResetUrl == null) {
		// No explicit password reset url. Try and locate the tool on the gateway page.
		// If it has been  installed we'll use it.
		String gatewaySiteId = serverConfigurationService.getGatewaySiteId();
		Site gatewaySite = null;
		try {
			gatewaySite = siteService.getSite(gatewaySiteId);
			ToolConfiguration resetTC = gatewaySite.getToolForCommonId("sakai.resetpass");
			if(resetTC != null) {
				passwordResetUrl = resetTC.getContainingPage().getUrl();
			}
		} catch (IdUnusedException e) {
			log.warn("No " + gatewaySiteId + " site found whilst building password reset url, set password.reset.url" +
					" or create " + gatewaySiteId + " and add password reset tool.");
		}
	}
	return passwordResetUrl;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:30,代码来源:BaseValidationProducer.java

示例11: unjoinCurrentUserToSitePreservesDotsInSiteIdPathParams_Format2

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
@Test
public void unjoinCurrentUserToSitePreservesDotsInSiteIdPathParams_Format2() throws PermissionException, IdUnusedException {
    EntityView entityView = new EntityView("/membership/unjoin/site.with.dots.json");
    entityView.setMethod(EntityView.Method.POST);
    entityView.setViewKey(EntityView.VIEW_NEW);

    EntityUser entityUser = mock(EntityUser.class);
    when(entityUser.getEid()).thenReturn("user-foo");
    when(userEntityProvider.getCurrentUser(entityView)).thenReturn(entityUser);

    Site site = mock(Site.class);
    when(site.getJoinerRole()).thenReturn("role-foo");
    when(siteService.getSite("site.with.dots")).thenReturn(site);

    assertTrue(provider.unjoinCurrentUserFromSite(entityView, new HashMap<String, Object>()));
    verify(siteService).unjoin("site.with.dots");
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:18,代码来源:MembershipEntityProviderTest.java

示例12: getEmailSections

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * {@inheritDoc}
 * 
 * @see org.sakaiproject.mailsender.logic.impl.ComposeLogic#getEmailSections()
 */
public List<EmailRole> getEmailSections() throws IdUnusedException
{
	ArrayList<EmailRole> roles = new ArrayList<EmailRole>();
	Site currentSite = currentSite();

	Collection<Group> groups = currentSite.getGroups();
	for (Group group : groups)
	{
		if (group.getProperties().getProperty("sections_category") != null)
		{
			String groupName = group.getTitle();
			String groupId = group.getId();
			roles.add(new EmailRole(groupId, groupId, groupName, groupName,
					EmailRole.Type.SECTION));
		}
	}
	Collections.sort(roles, new EmailRoleComparator(EmailRoleComparator.SORT_BY.PLURAL));
	return roles;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:25,代码来源:ComposeLogicImpl.java

示例13: createNewSubmission

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
private AssignmentSubmission createNewSubmission(String context, String submitterId) throws UserNotDefinedException, IdUnusedException {
    Assignment assignment = createNewAssignment(context);
    String assignmentReference = AssignmentReferenceReckoner.reckoner().assignment(assignment).reckon().getReference();
    Site site = mock(Site.class);
    when(site.getGroup(submitterId)).thenReturn(mock(Group.class));
    when(site.getMember(submitterId)).thenReturn(mock(Member.class));
    when(siteService.getSite(context)).thenReturn(site);
    when(securityService.unlock(AssignmentServiceConstants.SECURE_ADD_ASSIGNMENT_SUBMISSION, assignmentReference)).thenReturn(true);
    AssignmentSubmission submission = null;
    try {
        submission = assignmentService.addSubmission(assignment.getId(), submitterId);
    } catch (PermissionException e) {
        Assert.fail(e.getMessage());
    }
    return submission;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:17,代码来源:AssignmentServiceTest.java

示例14: getAResource

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * Pulls a ContentResource from ContentHostingService.
 * 
 * @param String
 *            	The resourceId of the resource to get
 *            
 * @return ContentResource
 * 				If found, null otherwise
 */
private ContentResource getAResource(String resourceId)
		throws PermissionException, IdUnusedException {
	ContentResource crEdit = null;

	try {
		crEdit = contentHostingService.getResource(resourceId);

	} 
	catch (TypeException e) {
		log.error("TypeException while attempting to pull resource: "
				+ resourceId + " for site: " + getSiteId() + ". " + e.getMessage(), e);
		throw new PodcastException(e);
	}
	
	return crEdit;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:26,代码来源:PodcastServiceImpl.java

示例15: isDropboxOwnerInCurrentUserGroups

import org.sakaiproject.exception.IdUnusedException; //导入依赖的package包/类
/**
 * Checks if a dropbox owner is in any group with current user, so AUTH_DROPBOX_GROUPS is rightly applied.
 * @return true if the dropbox owner is in the group, false otherwise. 
 */
public boolean isDropboxOwnerInCurrentUserGroups(String refString, String userId)
{
	String currentUser = sessionManager.getCurrentSessionUserId();
	
	List<Group> site_groups = new ArrayList<Group>();
	Reference ref = m_entityManager.newReference(refString);
	try
	{
		Site site = m_siteService.getSite(ref.getContext());

		site_groups.addAll(site.getGroupsWithMembers(new String[]{currentUser,userId}));
		if (site_groups.size()>0)
		{
			return true;
		}
	}
	catch (IdUnusedException e)
	{
	}
	
	return false;
}
 
开发者ID:sakaiproject,项目名称:sakai,代码行数:27,代码来源:BaseContentService.java


注:本文中的org.sakaiproject.exception.IdUnusedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。