org.sakaiproject.entity.api.Reference.getSubType()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(9.7k)|赞(0)|评价(0)|浏览(131)

本文整理了Java中org.sakaiproject.entity.api.Reference.getSubType方法的一些代码示例,展示了Reference.getSubType的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Reference.getSubType方法的具体详情如下:
包路径:org.sakaiproject.entity.api.Reference
类名称:Reference
方法名:getSubType

Reference.getSubType介绍

[英]Access the subType.
[中]访问子类型。

代码示例

代码示例来源:origin: org.sakaiproject/sakai-chat-impl

/**
* {@inheritDoc}
*/
public String getSubType(String reference)
{
 try {
   return getReference(reference).getSubType();
 } catch ( Exception ex ) {
   return "";
 }
}

代码示例来源:origin: org.sakaiproject/sakai-rwiki-impl

/**
 * Looks up the entity handler based on sybtype, the registerd subtype must
 * match the key in the m_handlers map
 * 
 * @param ref
 * @return
 */
private EntityHandler findEntityHandler(Reference ref)
{
  if (!APPLICATION_ID.equals(ref.getType())) return null;
  String subtype = ref.getSubType();
  return (EntityHandler) m_handlers.get(subtype);
}

代码示例来源:origin: org.sakaiproject/sakai-rwiki-impl

public String getSubType(String reference)
{
  try
  {
    String r = getReference(reference).getSubType();
    if (log.isDebugEnabled())
    {
      log.debug("Wiki.getSubType:" + reference + ":" + r);
    }
    return r;
  }
  catch (Exception ex)
  {
    return "";
  }
}

代码示例来源:origin: org.sakaiproject.mailarchive/sakai-search-adapters-impl

public String getSubType(String reference)
{
  try
  {
    String r = getReference(reference).getSubType();
    if (log.isDebugEnabled())
    {
      log.debug("Message." + toolName + ".getContainer" + reference + ":" + r);
    }
    return r;
  }
  catch (Exception ex)
  {
    return "";
  }
}

代码示例来源:origin: org.sakaiproject.polls/polls-impl

public Entity getEntity(Reference ref) {
  // TODO Auto-generated method stub
  Entity rv = null;
  if (REF_POLL_TYPE.equals(ref.getSubType())) {
    rv = getPoll(ref.getReference());
  }
  return rv;
}

代码示例来源:origin: sakaiproject/sakai

if (REF_TYPE_CHANNEL.equals(ref.getSubType()))
else if (REF_TYPE_MESSAGE.equals(ref.getSubType()))
  log.warn("getResource(): unknown message ref subtype: " + ref.getSubType() + " in ref: " + ref.getReference());

代码示例来源:origin: org.sakaiproject.message/sakai-message-util

if (REF_TYPE_CHANNEL.equals(ref.getSubType()))
else if (REF_TYPE_MESSAGE.equals(ref.getSubType()))
  log.warn("getResource(): unknown message ref subtype: " + ref.getSubType() + " in ref: " + ref.getReference());

代码示例来源:origin: org.sakaiproject.announcement/sakai-announcement-impl

public void handleAccess(HttpServletRequest req, HttpServletResponse res, Reference ref, Collection copyrightAcceptedRefs) 
    throws EntityPermissionException, EntityNotDefinedException //, EntityAccessOverloadException, EntityCopyrightException
  {
    // we only access the msg & rss reference
    if ( !REF_TYPE_MESSAGE.equals(ref.getSubType()) &&
       !REF_TYPE_ANNOUNCEMENT_RSS.equals(ref.getSubType()) ) 
        throw new EntityNotDefinedException(ref.getReference());
        
    try
    {
      if ( REF_TYPE_MESSAGE.equals(ref.getSubType()) )
      {
        res.setContentType("text/html; charset=UTF-8");
        printAnnouncementHtml( res.getWriter(), ref );
      }
      else
      {
        res.setContentType("application/xml"); 
        res.setCharacterEncoding("UTF-8");
        printAnnouncementRss( res.getOutputStream(), ref );
      }
    }
    catch ( IOException e )
    {
      throw new EntityNotDefinedException(ref.getReference());
    }
  }
};

代码示例来源:origin: org.sakaiproject/sakai-chat-impl

if (ChatManager.REF_TYPE_CHANNEL.equals(ref.getSubType()))
else if (ChatManager.REF_TYPE_MESSAGE.equals(ref.getSubType()))
 logger.warn("getEntity(): unknown message ref subtype: " + ref.getSubType() + " in ref: " + ref.getReference());

代码示例来源:origin: org.sakaiproject.polls/polls-impl

public List<String> getSitesForUser(String userId, String permission) {
  log.debug("userId: " + userId + ", permission: " + permission);
  List<String> l = new ArrayList<String>();
  // get the groups from Sakai
  Set<String> authzGroupIds = 
    authzGroupService.getAuthzGroupsIsAllowed(userId, permission, null);
  Iterator<String> it = authzGroupIds.iterator();
  while (it.hasNext()) {
    String authzGroupId = it.next();
    Reference r = entityManager.newReference(authzGroupId);
    if (r.isKnownType()) {
     // check if this is a Sakai Site or Group
     if (r.getType().equals(SiteService.APPLICATION_ID)) {
       String type = r.getSubType();
       if (SAKAI_SITE_TYPE.equals(type)) {
        // this is a Site
        String siteId = r.getId();
        l.add(siteId);
       }
     }
    }
  }
  if (l.isEmpty()) log.info("Empty list of siteIds for user:" + userId + ", permission: " + permission);
  return l;
 }

代码示例来源:origin: sakaiproject/sakai

if (REF_TYPE_CHANNEL.equals(ref.getSubType()))
else if (REF_TYPE_MESSAGE.equals(ref.getSubType()))
  log.warn("getUrl(): unknown message ref subtype: " + ref.getSubType() + " in ref: " + ref.getReference());

代码示例来源:origin: sakaiproject/sakai

if (REF_TYPE_CHANNEL.equals(ref.getSubType()))
else if (REF_TYPE_MESSAGE.equals(ref.getSubType()))
  log.warn("getProperties(): unknown message ref subtype: " + ref.getSubType() + " in ref: " + ref.getReference());

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

/**
 * Update the site security when an AuthzGroup is deleted, if it is a site AuthzGroup.
 * 
 * @param azGroup
 *        The AuthzGroup.
 */
protected void removeSiteSecurity(AuthzGroup azGroup)
{
  // Special code for the site service
  Reference ref = entityManager().newReference(azGroup.getId());
  if (SiteService.APPLICATION_ID.equals(ref.getType()) && SiteService.SITE_SUBTYPE.equals(ref.getSubType()))
  {
    // no azGroup, no users
    Set empty = new HashSet();
    siteService.setSiteSecurity(ref.getId(), empty, empty, empty);
  }
}

代码示例来源:origin: org.sakaiproject/sakai-chat-impl

/**
* {@inheritDoc}
*/
public String getEntityDescription(Reference ref)
{
 // we could check that the type is one of the message services, but lets just assume it is so we don't need to know them here -ggolden
 String rv = "Message: " + ref.getReference();
 try
 {
   // if this is a channel
   if (ChatManager.REF_TYPE_CHANNEL.equals(ref.getSubType()))
   {
    ChatChannel channel = getChannel(ref);
    rv = "Channel: " + channel.getId() + " (" + channel.getContext() + ")";
   }
 }
 catch (PermissionException e)
 {
 }
 catch (IdUnusedException e)
 {
 }
 catch (NullPointerException e)
 {
 }
 return rv;
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

/**
 * {@inheritDoc}
 */
public Group getGroup(String id)
{
  if (id == null) return null;
  // if this is a reference, starting with a "/", parse it, make sure it's
  // a group, in this site, and pull the id
  if (id.startsWith(Entity.SEPARATOR))
  {
    Reference ref = siteService
        .entityManager().newReference(id);
    if ((SiteService.APPLICATION_ID.equals(ref.getType()))
        && (SiteService.GROUP_SUBTYPE.equals(ref.getSubType()))
        && (m_id.equals(ref.getContainer())))
    {
      return (Group) ((ResourceVector) getGroups()).getById(ref.getId());
    }
    return null;
  }
  return (Group) ((ResourceVector) getGroups()).getById(id);
}

代码示例来源:origin: sakaiproject/sakai

/**
 * {@inheritDoc}
 */
public String getEntityDescription(Reference ref)
{
  // we could check that the type is one of the message services, but lets just assume it is so we don't need to know them here -ggolden
  String rv = "Message: " + ref.getReference();
  try
  {
    // if this is a channel
    if (REF_TYPE_CHANNEL.equals(ref.getSubType()))
    {
      MessageChannel channel = getChannel(ref.getReference());
      rv = "Channel: " + channel.getId() + " (" + channel.getContext() + ")";
    }
  }
  catch (PermissionException e)
  {
  }
  catch (IdUnusedException e)
  {
  }
  catch (NullPointerException e)
  {
  }
  return rv;
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

/**
 * {@inheritDoc}
 */
public void refreshAuthzGroup(BaseAuthzGroup azGroup) {
  if (azGroup == null) return;
  if (azGroup.m_isNew) {
    // refresh new authz groups immediately
    log.debug("Refresh new authz group: {}", azGroup.getId());
    refreshAuthzGroupInternal(azGroup);
    // refresh parent
    Reference reference = entityManager.newReference(azGroup.getId());
    if (SiteService.APPLICATION_ID.equals(reference.getType()) && SiteService.GROUP_SUBTYPE.equals(reference.getSubType())) {
      try {
        refreshAuthzGroupInternal((BaseAuthzGroup) getAuthzGroup(siteService.siteReference(reference.getContainer())));
      } catch (Exception e) {
        log.warn("Cannot refresh parent authz group for authz group: {}", azGroup.getId(), e);
      }
    }
  } else {
    // Add the AuthzGroup to the queue, keyed on id to eliminate duplicate refreshes
    log.debug("Queue authz group for refresh " + azGroup.getId());
    refreshQueue.put(azGroup.getId(), azGroup);
  }
}

代码示例来源:origin: org.sakaiproject.message/sakai-message-util

/**
 * {@inheritDoc}
 */
public String getEntityDescription(Reference ref)
{
  // we could check that the type is one of the message services, but lets just assume it is so we don't need to know them here -ggolden
  String rv = "Message: " + ref.getReference();
  try
  {
    // if this is a channel
    if (REF_TYPE_CHANNEL.equals(ref.getSubType()))
    {
      MessageChannel channel = getChannel(ref.getReference());
      rv = "Channel: " + channel.getId() + " (" + channel.getContext() + ")";
    }
  }
  catch (PermissionException e)
  {
  }
  catch (IdUnusedException e)
  {
  }
  catch (NullPointerException e)
  {
  }
  return rv;
}

代码示例来源:origin: org.sakaiproject.message/sakai-message-impl

/**
 * {@inheritDoc}
 */
public String getEntityDescription(Reference ref)
{
  // we could check that the type is one of the message services, but lets just assume it is so we don't need to know them here -ggolden
  String rv = "Message: " + ref.getReference();
  try
  {
    // if this is a channel
    if (REF_TYPE_CHANNEL.equals(ref.getSubType()))
    {
      MessageChannel channel = getChannel(ref.getReference());
      rv = "Channel: " + channel.getId() + " (" + channel.getContext() + ")";
    }
  }
  catch (PermissionException e)
  {
  }
  catch (IdUnusedException e)
  {
  }
  catch (NullPointerException e)
  {
  }
  return rv;
}

代码示例来源:origin: org.sakaiproject.kernel/sakai-kernel-impl

/**
 * Update the site security based on the values in the AuthzGroup, if it is a site AuthzGroup.
 * 
 * @param azGroup
 *        The AuthzGroup.
 */
protected void updateSiteSecurity(AuthzGroup azGroup)
{
  // Special code for the site service
  Reference ref = entityManager().newReference(azGroup.getId());
  if (SiteService.APPLICATION_ID.equals(ref.getType()) && SiteService.SITE_SUBTYPE.equals(ref.getSubType()))
  {
    // collect the users
    Set updUsers = azGroup.getUsersIsAllowed(SiteService.SECURE_UPDATE_SITE);
    Set unpUsers = azGroup.getUsersIsAllowed(SiteService.SITE_VISIT_UNPUBLISHED);
    Set visitUsers = azGroup.getUsersIsAllowed(SiteService.SITE_VISIT);
    siteService.setSiteSecurity(ref.getId(), updUsers, unpUsers, visitUsers);
  }
}

相关文章