List of usage examples for java.lang Boolean getBoolean
public static boolean getBoolean(String name)
From source file:org.sakaiproject.content.tool.ResourcesAction.java
/** * Sort based on the given property/*from w ww . j a v a2 s .c om*/ */ public void doReorder(RunData data) { logger.debug(this + ".doReorder()"); if (!"POST".equals(data.getRequest().getMethod())) { return; } SessionState state = ((JetspeedRunData) data).getPortletSessionState(((JetspeedRunData) data).getJs_peid()); //get the ParameterParser from RunData ParameterParser params = data.getParameters(); String folderId = params.getString("folderId"); if (folderId == null) { addAlert(state, "error"); } String sortBy = (String) state.getAttribute(STATE_REORDER_SORT_BY); if (sortBy == null) { sortBy = ResourceProperties.PROP_CONTENT_PRIORITY; state.setAttribute(STATE_REORDER_SORT_BY, sortBy); } String sortedAsc = (String) state.getAttribute(STATE_REORDER_SORT_ASC); if (sortedAsc == null) { sortedAsc = Boolean.TRUE.toString(); state.setAttribute(STATE_REORDER_SORT_ASC, sortedAsc); } Comparator comparator = ContentHostingService.newContentHostingComparator(sortBy, Boolean.getBoolean(sortedAsc)); state.setAttribute(STATE_REORDER_SORT, comparator); if (state.getAttribute(STATE_MESSAGE) == null) { state.setAttribute(STATE_REORDER_FOLDER, folderId); state.setAttribute(STATE_MODE, MODE_REORDER); } // if-else }
From source file:org.sakaiproject.site.tool.SiteAction.java
/** * %%% legacy properties, to be removed// www . j a va2s. c o m */ private void updateSiteInfo(ParameterParser params, SessionState state) { SiteInfo siteInfo = new SiteInfo(); if (state.getAttribute(STATE_SITE_INFO) != null) { siteInfo = (SiteInfo) state.getAttribute(STATE_SITE_INFO); } siteInfo.site_type = (String) state.getAttribute(STATE_SITE_TYPE); // title boolean hasRosterAttached = params.getString("hasRosterAttached") != null ? Boolean.getBoolean(params.getString("hasRosterAttached")) : false; if ((siteTitleEditable(state, siteInfo.site_type) || !hasRosterAttached) && params.getString("title") != null) { // site titel is editable and could not be null String title = StringUtils.trimToNull(params.getString("title")); siteInfo.title = title; if (title == null) { addAlert(state, rb.getString("java.specify") + " "); } // check for site title length else if (title.length() > SiteConstants.SITE_GROUP_TITLE_LIMIT) { addAlert(state, rb.getFormattedMessage("site_group_title_length_limit", new Object[] { SiteConstants.SITE_GROUP_TITLE_LIMIT })); } } if (params.getString("description") != null) { StringBuilder alertMsg = new StringBuilder(); String description = params.getString("description"); siteInfo.description = FormattedText.processFormattedText(description, alertMsg); } if (params.getString("short_description") != null) { siteInfo.short_description = params.getString("short_description"); } String skin = params.getString("skin"); if (skin != null) { // if there is a skin input for course site skin = StringUtils.trimToNull(skin); siteInfo.iconUrl = skin; } else { // if ther is a icon input for non-course site String icon = StringUtils.trimToNull(params.getString("icon")); if (icon != null) { if (icon.endsWith(PROTOCOL_STRING)) { addAlert(state, rb.getString("alert.protocol")); } siteInfo.iconUrl = icon; } else { siteInfo.iconUrl = ""; } } if (params.getString("additional") != null) { siteInfo.additional = params.getString("additional"); } if (params.getString("iconUrl") != null) { siteInfo.iconUrl = params.getString("iconUrl"); } else if (params.getString("skin") != null) { siteInfo.iconUrl = params.getString("skin"); } if (params.getString("joinerRole") != null) { siteInfo.joinerRole = params.getString("joinerRole"); } if (params.getString("joinable") != null) { boolean joinable = params.getBoolean("joinable"); siteInfo.joinable = joinable; if (!joinable) siteInfo.joinerRole = NULL_STRING; } if (params.getString("itemStatus") != null) { siteInfo.published = Boolean.valueOf(params.getString("itemStatus")).booleanValue(); } // bjones86 - SAK-24423 - update site info for joinable site settings JoinableSiteSettings.updateSiteInfoFromParams(params, siteInfo); // site contact information String name = StringUtils.trimToEmpty(params.getString("siteContactName")); if (name.length() == 0) { addAlert(state, rb.getString("alert.sitediinf.sitconnam")); } siteInfo.site_contact_name = name; String email = StringUtils.trimToEmpty(params.getString("siteContactEmail")); if (email != null) { if (!email.isEmpty() && !EmailValidator.getInstance().isValid(email)) { // invalid email addAlert(state, rb.getFormattedMessage("java.invalid.email", new Object[] { FormattedText.escapeHtml(email, false) })); } siteInfo.site_contact_email = email; } int aliasCount = params.getInt("alias_count", 0); siteInfo.siteRefAliases.clear(); for (int j = 0; j < aliasCount; j++) { String alias = StringUtils.trimToNull(params.getString("alias_" + j)); if (alias == null) { continue; } // Kernel will force these to lower case anyway. Forcing // to lower case whenever reading out of the form simplifies // comparisons at save time, though, and provides consistent // on-screen display. alias = alias.toLowerCase(); // An invalid alias will set an alert, which theoretically // disallows further progress in the workflow, but we // still need to re-render the invalid form contents. // Thus siteInfo.aliases contains all input aliases, even if // invalid. (Same thing happens above for email.) validateSiteAlias(alias, state); siteInfo.siteRefAliases.add(alias); } state.setAttribute(STATE_SITE_INFO, siteInfo); }