public boolean siteCanUseReviewService(Site site) { ResourceProperties properties = site.getProperties(); String prop = (String) properties.get(siteProperty); if (prop != null) { return Boolean.valueOf(prop).booleanValue(); } return false; } }
/** * @param p * @return */ private Map createPageProps(SitePage p) { Map properties = new HashMap(); for (Iterator<String> i = p.getProperties().getPropertyNames(); i.hasNext();) { String propName = i.next(); properties.put(propName, p.getProperties().get(propName)); } return properties; }
protected Artifact createArtifact(ContentResource resource) { String formType = (String) resource.getProperties().get( resource.getProperties().getNamePropStructObjType()); StructuredArtifactHomeInterface home = (StructuredArtifactHomeInterface) getHomeFactory().getHome(formType); return home.load(resource); }
public StructuredArtifact load(ContentResource resource, Id artifactId) { try { Agent resourceOwner = getAgentManager().getAgent( resource.getProperties().getProperty(ResourceProperties.PROP_CREATOR)); SAXBuilder builder = new SAXBuilder(); builder.setFeature("http://apache.org/xml/features/disallow-doctype-decl", true); // SAK-23245 Document doc = builder.build(resource.streamContent()); StructuredArtifact xmlObject = new StructuredArtifact(doc.getRootElement(), getSchema().getChild(getRootNode())); xmlObject.setBaseResource(resource); xmlObject.setId(artifactId); xmlObject.setDisplayName( (String) resource.getProperties().get( resource.getProperties().getNamePropDisplayName())); xmlObject.setHome(this); xmlObject.setOwner(resourceOwner); return xmlObject; } catch (Exception e) { throw new PersistenceException(e, "", null, null); } }
/** * @inheritDoc */ public boolean isHomePage() { String isHomePage = (String)getProperties().get(IS_HOME_PAGE); if (isHomePage != null ) return Boolean.parseBoolean(isHomePage); else return false; }
/** * @param p * @return */ private Map createPageProps(SitePage p) { Map properties = new HashMap(); for (Iterator<String> i = p.getProperties().getPropertyNames(); i.hasNext();) { String propName = i.next(); properties.put(propName, p.getProperties().get(propName)); } return properties; }
/** * @inheritDoc */ public boolean getHomeToolsTitleCustom(String toolId) { String homeToolsTitleCustom = (String)getProperties().get(PAGE_HOME_TOOLS_CUSTOM_TITLE_PROP); if (homeToolsTitleCustom == null) return false; else { String[] toolIds = homeToolsTitleCustom.split(","); for (int i=0;i<toolIds.length;i++) { if (toolIds[i].equals(toolId)) return true; } return false; } }
/** * @inheritDoc */ public boolean getTitleCustom() { String custom = (String)getProperties().get(PAGE_CUSTOM_TITLE_PROP); if ( custom == null ) return getTitleCustomLegacy(); else return Boolean.parseBoolean(custom); }
public Set<String> getAdditionalRoles(String userId) { if (userId != null) { try { User user = userDirectoryService.getUser(userId); String status = (String) user.getProperties().get(statusAttribute); if (status != null && status.length() > 0) { Set<String> roles = statusRoles.get(status); if (roles != null) { return roles; } } } catch (UserNotDefinedException e) { // This really shouldn't happen as this should only be called for known users log.warn("User couldn't be loaded to find additional roles: "+ userId, e); } } return Collections.emptySet(); }
public Set<String> getAdditionalRoles(String userId) { if (userId != null) { try { User user = userDirectoryService.getUser(userId); String status = (String) user.getProperties().get(statusAttribute); if (status != null && status.length() > 0) { Set<String> roles = statusRoles.get(status); if (roles != null) { return roles; } } } catch (UserNotDefinedException e) { // This really shouldn't happen as this should only be called for known users log.warn("User couldn't be loaded to find additional roles: "+ userId, e); } } return Collections.emptySet(); }
@Override public boolean isSiteAcceptable(Site site) { if (site == null) { return false; } log.debug("isSiteAcceptable: {} / {}", site.getId(), site.getTitle()); // Delegated to another bean if (siteAdvisor != null) { return siteAdvisor.siteCanUseReviewService(site); } // Check site property ResourceProperties properties = site.getProperties(); String prop = (String) properties.get(URKUND_SITE_PROPERTY); if (StringUtils.isNotBlank(prop)) { log.debug("Using site property: {}", prop); return Boolean.parseBoolean(prop); } // No property set, no restriction on site types, so allow return true; }
@Override public boolean isSiteAcceptable(Site site) { if (site == null) { return false; } log.debug("isSiteAcceptable ("+siteAdvisor+"): " + site.getId() + " / " + site.getTitle()); // Delegated to another bean if (siteAdvisor != null) { return siteAdvisor.siteCanUseReviewService(site); } // Check site property ResourceProperties properties = site.getProperties(); String prop = (String) properties.get(COMPILATIO_SITE_PROPERTY); if (StringUtils.isNotBlank(prop)) { log.debug("Using site property: " + prop); return Boolean.parseBoolean(prop); } // No property set, no restriction on site types, so allow return true; }
/** * Allow Turnitin for this site? */ @Override public boolean isSiteAcceptable(Site s) { if (s == null) { return false; } log.debug("isSiteAcceptable: " + s.getId() + " / " + s.getTitle()); // Delegated to another bean if (siteAdvisor != null) { return siteAdvisor.siteCanUseReviewService(s); } // Check site property ResourceProperties properties = s.getProperties(); String prop = (String) properties.get(TURNITIN_SITE_PROPERTY); if (prop != null) { log.debug("Using site property: " + prop); return Boolean.parseBoolean(prop); } // Check list of allowed site types, if defined if (enabledSiteTypes != null && !enabledSiteTypes.isEmpty()) { log.debug("Using site type: " + s.getType()); return enabledSiteTypes.contains(s.getType()); } // No property set, no restriction on site types, so allow return true; }
/** * @inheritDoc */ public void setHomeToolsTitleCustom(String toolId) { String homeToolsTitleCustom = (String)getProperties().get(PAGE_HOME_TOOLS_CUSTOM_TITLE_PROP); if (homeToolsTitleCustom == null) getProperties().addProperty(PAGE_HOME_TOOLS_CUSTOM_TITLE_PROP, toolId); else { if (!homeToolsTitleCustom.contains(toolId)) getProperties().addProperty(PAGE_HOME_TOOLS_CUSTOM_TITLE_PROP, homeToolsTitleCustom+","+toolId); } }
public void setupPageCategory(String toolId) { String defaultCategory = null; if (m_site != null) { Map<String, String> toolCategories = siteService.serverConfigurationService() .getToolToCategoryMap(m_site.getType()); defaultCategory = toolCategories.get(toolId); } if (getProperties().get(PAGE_CATEGORY_PROP) == null && defaultCategory != null) { getProperties().addProperty(PAGE_CATEGORY_PROP, defaultCategory); } }
public SiteSerialized(Site site, String termProp){ this.id = site.getId(); this.url = site.getUrl(); this.title = site.getTitle(); Object prop = site.getProperties().get(termProp); term = ""; if(prop != null){ term = prop.toString(); } this.reference = site.getReference(); this.setPublished(site.isPublished()); }
public SiteSerialized(Site site, String termProp){ this.id = site.getId(); this.url = site.getUrl(); this.title = site.getTitle(); Object prop = site.getProperties().get(termProp); term = ""; if(prop != null){ term = prop.toString(); } this.reference = site.getReference(); this.setPublished(site.isPublished()); }
/** ** Checks if the tool's page has set the custom_title property (for custom page or tool titles), ** or alternately checks if this tool should be cosidered a "legacy" custom tool title ** (e.g. iframe, news, linktool). ** ** @see org.sakaiproject.site.impl.BaseSitePage#getTitleCustom **/ private boolean getTitleCustom(SitePage page) { if (page.isHomePage()) { return page.getHomeToolsTitleCustom(m_id) || page.isTitleToolException(m_toolId); } else { String custom = (String)page.getProperties().get(SitePage.PAGE_CUSTOM_TITLE_PROP); if ( custom != null ) return Boolean.parseBoolean(custom); else if (page.isTitleToolException(m_toolId)) return true; else return false; } }
protected StructuredArtifactHomeInterface getSchema(Map session) { if (session.get(FormHelper.PREVIEW_HOME_TAG) != null) { return getStructuredArtifactDefinitionManager().convertToHome( (StructuredArtifactDefinitionBean)session.get(FormHelper.PREVIEW_HOME_TAG)); } else if (session.get(ResourceToolAction.ACTION_PIPE) != null) { ResourceToolActionPipe pipe = (ResourceToolActionPipe)session.get(ResourceToolAction.ACTION_PIPE); ContentEntity entity = pipe.getContentEntity(); String schemaName = (String) entity.getProperties().get(ResourceProperties.PROP_STRUCTOBJ_TYPE); if (schemaName == null) { // must be a create schemaName = getSchemaName(session); } StructuredArtifactHomeInterface home = (StructuredArtifactHomeInterface) getHomeFactory().getHome(schemaName); return new ResourceHelperArtifactHome(home, pipe); } else { return (StructuredArtifactHomeInterface) getHomeFactory().getHome(getSchemaName(session)); } }
/** * Access a text string suitable for use as a very brief description of a particular resource. * If the string is more than about 40 or 50 characters, it may be truncated at an arbitrary * length. The string may identify the type of this resource or more specific information. * The string should be localized. If no value is supplied, a default hover-string will be * used. * * @param member The resource that's being displayed * @return i18n label of the form type */ public String getLocalizedHoverText(ContentEntity member) { String formName = ""; if (member != null) { StructuredArtifactDefinitionBean home = getStructuredArtifactDefinitionManager().loadHome( (String)member.getProperties().get(ResourceProperties.PROP_STRUCTOBJ_TYPE)); if (home != null) { formName = home.getDescription(); } } return rb.getFormattedMessage("form_item_tip", new Object[]{formName}); }