/** * Create the live properties for the object. */ protected void addLiveProperties(ResourcePropertiesEdit props) { String current = SessionManager.getCurrentSessionUserId(); props.addProperty(ResourceProperties.PROP_CREATOR, current); props.addProperty(ResourceProperties.PROP_MODIFIED_BY, current); String now = TimeService.newTime().toString(); props.addProperty(ResourceProperties.PROP_CREATION_DATE, now); props.addProperty(ResourceProperties.PROP_MODIFIED_DATE, now); } // addLiveProperties
private void saveUserFavorites(String userId, UserFavorites favorites) throws PermissionException, InUseException, IdUnusedException, PortalHandlerException { if (userId == null) { return; } PreferencesEdit edit = PreferencesService.edit(userId); ResourcePropertiesEdit props = edit.getPropertiesEdit(org.sakaiproject.user.api.PreferencesService.SITENAV_PREFS_KEY); // Replace all existing values props.removeProperty(FAVORITES_PROPERTY); for (String siteId : favorites.favoriteSiteIds) { props.addPropertyToList(FAVORITES_PROPERTY, siteId); } props.removeProperty(AUTO_FAVORITE_ENABLED_PROPERTY); props.addProperty(AUTO_FAVORITE_ENABLED_PROPERTY, String.valueOf(favorites.autoFavoritesEnabled)); PreferencesService.commit(edit); }
protected void addLiveSyllabusProperties(BaseResourceEdit r) { ResourcePropertiesEdit p = r.getPropertiesEdit(); String current = SessionManager.getCurrentSessionUserId(); p.addProperty(ResourceProperties.PROP_CREATOR, current); p.addProperty(ResourceProperties.PROP_MODIFIED_BY, current); String now = TimeService.newTime().toString(); p.addProperty(ResourceProperties.PROP_CREATION_DATE, now); p.addProperty(ResourceProperties.PROP_MODIFIED_DATE, now); p.addProperty(ResourceProperties.PROP_IS_COLLECTION, "false"); }
/** * Create the live properties for a collection. * * @param c * The collection. */ protected void addLiveCollectionProperties(ContentCollectionEdit c) { ResourcePropertiesEdit p = c.getPropertiesEdit(); String current = sessionManager.getCurrentSessionUserId(); p.addProperty(ResourceProperties.PROP_CREATOR, current); p.addProperty(ResourceProperties.PROP_MODIFIED_BY, current); String now = timeService.newTime().toString(); p.addProperty(ResourceProperties.PROP_CREATION_DATE, now); p.addProperty(ResourceProperties.PROP_MODIFIED_DATE, now); p.addProperty(ResourceProperties.PROP_IS_COLLECTION, "true"); } // addLiveCollectionProperties
public BaseResourceEdit(String siteId) { m_id = null; m_data = null; m_reference = Entity.SEPARATOR + siteId; m_properties = new BaseResourcePropertiesEdit(); m_properties.addProperty(ResourceProperties.PROP_DISPLAY_NAME, ""); }
/** * Create the live properties for the user. */ protected void addLiveProperties(ResourcePropertiesEdit props) { String current = sessionManager().getCurrentSessionUserId(); props.addProperty(ResourceProperties.PROP_CREATOR, current); props.addProperty(ResourceProperties.PROP_MODIFIED_BY, current); String now = timeService().newTime().toString(); props.addProperty(ResourceProperties.PROP_CREATION_DATE, now); props.addProperty(ResourceProperties.PROP_MODIFIED_DATE, now); } // addLiveProperties
public Object readSqlResultRecord(ResultSet result) { try { // read the fields String name = result.getString(1); String value = result.getString(2); // add to props, if we got stuff from the fields if ((name != null) && (value != null)) { props.addProperty(name, value); } // nothing to return return null; } catch (SQLException e) { log.warn("readProperties: " + e); return null; } } });
/** * Update the live properties for an object when modified. */ protected void addLiveUpdateProperties(ResourcePropertiesEdit props) { props.addProperty(ResourceProperties.PROP_MODIFIED_BY, SessionManager.getCurrentSessionUserId()); props.addProperty(ResourceProperties.PROP_MODIFIED_DATE, TimeService.newTime().toString()); } // addLiveUpdateProperties
public void setConditionallyReleased(boolean isConditionallyReleased) { try { Boolean oldValue = this.m_properties.getBooleanProperty(ConditionService.PROP_CONDITIONAL_RELEASE); if(oldValue.booleanValue() != isConditionallyReleased) { this.m_visibilityUpdated = true; } } catch (EntityPropertyNotDefinedException e) { // oldValue is false if(isConditionallyReleased) { this.m_visibilityUpdated = true; } } catch (EntityPropertyTypeException e) { // assume oldValue is false if(isConditionallyReleased) { this.m_visibilityUpdated = true; } } m_properties.addProperty(ConditionService.PROP_CONDITIONAL_RELEASE, Boolean.toString(isConditionallyReleased)); }
/** * Update the live properties for a resource when modified (for a resource). * * @param r * The resource. */ protected void addLiveUpdateResourceProperties(ContentResourceEdit r) { ResourcePropertiesEdit p = r.getPropertiesEdit(); String current = sessionManager.getCurrentSessionUserId(); p.addProperty(ResourceProperties.PROP_MODIFIED_BY, current); String now = timeService.newTime().toString(); p.addProperty(ResourceProperties.PROP_MODIFIED_DATE, now); p.addProperty(ResourceProperties.PROP_CONTENT_LENGTH, Long.toString(r.getContentLength())); p.addProperty(ResourceProperties.PROP_CONTENT_TYPE, r.getContentType()); } // addLiveUpdateResourceProperties
/** * Create the live properties for a collection. * * @param c * The collection. */ protected void addLiveUpdateCollectionProperties(ContentCollectionEdit c) { ResourcePropertiesEdit p = c.getPropertiesEdit(); String current = sessionManager.getCurrentSessionUserId(); p.addProperty(ResourceProperties.PROP_MODIFIED_BY, current); String now = timeService.newTime().toString(); p.addProperty(ResourceProperties.PROP_MODIFIED_DATE, now); } // addLiveUpdateCollectionProperties
/** * Update the live properties for a user for when modified. */ protected void addLiveUpdateProperties(ResourcePropertiesEdit props) { String current = sessionManager().getCurrentSessionUserId(); props.addProperty(ResourceProperties.PROP_MODIFIED_BY, current); props.addProperty(ResourceProperties.PROP_MODIFIED_DATE, timeService().newTime().toString()); } // addLiveUpdateProperties
public BaseResourceEdit(String id, SyllabusData data, String siteId) { m_id = id; m_data = data; m_reference = Entity.SEPARATOR + siteId + Entity.SEPARATOR + m_id; m_properties = new BaseResourcePropertiesEdit(); m_properties.addProperty(ResourceProperties.PROP_DISPLAY_NAME, data.getTitle()); }
/** * Get a duplicate copy of resource properties This copies everything except for the DISPLAYNAME - DISPLAYNAME is only copied if it is different than the file name as derived from the id (path) Note to Chuck - should the add operations check for empty * Display and set it to the file name rather than putting all the code all over the place. */ private ResourcePropertiesEdit duplicateResourceProperties(ResourceProperties properties, String id) { ResourcePropertiesEdit resourceProperties = newResourceProperties(); if (properties == null) return resourceProperties; // loop through the properties Iterator<String> propertyNames = properties.getPropertyNames(); while (propertyNames.hasNext()) { String propertyName = (String) propertyNames.next(); String propertyValue = properties.getProperty(propertyName); log.debug("copying: " + propertyName + " with value " + propertyValue); resourceProperties.addProperty(propertyName, propertyValue); } // while return resourceProperties; } // duplicateResourceProperties
public void setReplyToList(boolean replyToList) { if (replyToList) { getPropertiesEdit().addProperty(PROP_MAIL_CHANNEL_REPLY_LIST, "true"); } else { getPropertiesEdit().removeProperty(PROP_MAIL_CHANNEL_REPLY_LIST); } }
public void setSendToList(boolean sendToList) { //If not set it defaults to true if (sendToList==false) { getPropertiesEdit().addProperty(PROP_MAIL_CHANNEL_SENDTO_LIST, "false"); } else { getPropertiesEdit().removeProperty(PROP_MAIL_CHANNEL_SENDTO_LIST); } }
/** * Set the enabled status of the channe. Disabled channels will not recieve email. * * @param setting * The new setting. */ public void setEnabled(boolean setting) { if (setting) { getPropertiesEdit().addProperty(ResourceProperties.PROP_CHANNEL_ENABLED, "true"); } else { getPropertiesEdit().removeProperty(ResourceProperties.PROP_CHANNEL_ENABLED); } } // setEnabled
/** * Set the open status of the channe. Open channels will recieve email from anyone - otherwise messages will be accepted only from users (based on the main from email address) with add permission. * * @param setting * The new setting. */ public void setOpen(boolean setting) { if (setting) { getPropertiesEdit().addProperty(PROP_MAIL_CHANNEL_OPEN, "true"); } else { getPropertiesEdit().removeProperty(PROP_MAIL_CHANNEL_OPEN); } }
public BaseResourceEdit(String id, SyllabusData data) { Placement placement = ToolManager.getCurrentPlacement(); String currentSiteId = placement.getContext(); m_id = id; m_data = data; m_reference = Entity.SEPARATOR + currentSiteId + Entity.SEPARATOR + m_id; m_properties = new BaseResourcePropertiesEdit(); m_properties.addProperty(ResourceProperties.PROP_DISPLAY_NAME, data.getTitle()); }
private void addHomePageAndTools(final Site site) { // we will always have a home page SitePage homePage = site.addPage(); homePage.getPropertiesEdit().addProperty( SitePage.IS_HOME_PAGE, Boolean.TRUE.toString()); Tool homeTool = sakaiProxy.getTool(HOME_TOOL); ToolConfiguration homeToolConfig = homePage.addTool(); homeToolConfig.setTool(TOOL_ID_HOME, homeTool); homeToolConfig.setTitle(homeTool.getTitle()); // normally brings in sakai.siteinfo List<String> toolIds = sakaiProxy.getToolsRequired(SITE_TYPE_PROJECT); int synopticToolIndex = addRequiredToolsForWorksite(site, homePage, toolIds); // for synoptic tools if (synopticToolIndex > 0) { homePage.setLayout(SitePage.LAYOUT_DOUBLE_COL); } addRequiredHomeTools(homePage, toolIds, synopticToolIndex); }