/** * {@inheritDoc} */ public String getSubType(String reference) { try { return getReference(reference).getSubType(); } catch ( Exception ex ) { return ""; } }
/** * 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); }
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 ""; } }
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 ""; } }
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; }
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());
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());
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()); } } };
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());
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; }
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());
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());
/** * 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); } }
/** * {@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; }
/** * {@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); }
/** * {@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; }
/** * {@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); } }
/** * {@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; }
/** * {@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; }
/** * 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); } }