/** * Returns the parameters.<p> * * @return the parameters */ public Map<String, String[]> getParams() { // get the params Map<String, String[]> params = CmsCollectionsGenericWrapper.map(m_request.getParameterMap()); if (params.size() == 0) { return null; } return params; }
/** * Constructor that initializes the editor display options for the workplace.<p> */ public CmsEditorDisplayOptions() { // initialize members m_userMappings = CmsCollectionsGenericWrapper.createLRUMap(SIZE_USERENTRIES); m_loadedConfigurations = CmsCollectionsGenericWrapper.createLRUMap(SIZE_CONFIGURATIONFILES); }
/** * Returns a lazy initialized map that describes if a certain element if part of this container.<p> * * @return a lazy initialized map that describes if a certain element if part of this container */ public Map<CmsUUID, Boolean> getContainsElement() { if (m_containsElement == null) { m_containsElement = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object input) { return Boolean.valueOf(containsElement((CmsUUID)input)); } }); } return m_containsElement; }
/** * Returns the html code for component selection.<p> * * @return html code */ public String htmlComponents() { StringBuffer html = new StringBuffer(1024); Iterator<CmsSetupComponent> itComponents = CmsCollectionsGenericWrapper.<CmsSetupComponent> list( m_components.elementList()).iterator(); while (itComponents.hasNext()) { CmsSetupComponent component = itComponents.next(); html.append(htmlComponent(component)); } return html.toString(); }
/** * Returns a map with all request attributes.<p> * * @param req the request * * @return the attribute map */ public static Map<String, Object> getAtrributeMap(ServletRequest req) { if (req instanceof CmsFlexRequest) { return ((CmsFlexRequest)req).getAttributeMap(); } Map<String, Object> attrs = new HashMap<String, Object>(); Enumeration<String> atrrEnum = CmsCollectionsGenericWrapper.enumeration(req.getAttributeNames()); while (atrrEnum.hasMoreElements()) { String key = atrrEnum.nextElement(); Object value = req.getAttribute(key); attrs.put(key, value); } return attrs; }
/** * Returns js code with array definition for the component modules.<p> * * @return js code */ public String jsComponentModules() { List<CmsSetupComponent> components = CmsCollectionsGenericWrapper.list(m_components.elementList()); StringBuffer jsCode = new StringBuffer(1024); jsCode.append("\t// an array holding the components modules\n"); jsCode.append("\tvar componentModules = new Array("); jsCode.append(components.size()); jsCode.append(");\n"); for (int i = 0; i < components.size(); i++) { CmsSetupComponent component = components.get(i); jsCode.append("\tcomponentModules[" + i + "] = \""); List<String> modules = getComponentModules(component); for (int j = 0; j < modules.size(); j++) { jsCode.append(modules.get(j)); if (j < (modules.size() - 1)) { jsCode.append("|"); } } jsCode.append("\";\n"); } jsCode.append("\n\n"); return jsCode.toString(); }
/** * @see org.opencms.main.I_CmsSessionStorageProvider#getAllOfUser(org.opencms.util.CmsUUID) */ public List<CmsSessionInfo> getAllOfUser(CmsUUID userId) { try { return getAllSelected(CmsCollectionsGenericWrapper.<CmsUUID, CmsSessionInfo> map(m_sessions), userId); } catch (ConcurrentModificationException e) { // try again with a clone this time return getAllSelected( CmsCollectionsGenericWrapper.<CmsUUID, CmsSessionInfo> map(m_sessions.clone()), userId); } }
/** * Returns js code with array definition for the available component dependencies.<p> * * @return js code */ public String jsComponentDependencies() { List<CmsSetupComponent> components = CmsCollectionsGenericWrapper.list(m_components.elementList()); Map<String, List<String>> componentDependencies = buildDepsForAllComponents(); StringBuffer jsCode = new StringBuffer(1024); jsCode.append("\t// an array holding the dependent components for the n-th component\n"); jsCode.append("\tvar componentDependencies = new Array("); jsCode.append(components.size()); jsCode.append(");\n"); for (int i = 0; i < components.size(); i++) { CmsSetupComponent component = components.get(i); List<String> dependencies = componentDependencies.get(component.getId()); jsCode.append("\tcomponentDependencies[" + i + "] = new Array("); if (dependencies != null) { for (int j = 0; j < dependencies.size(); j++) { jsCode.append("\"" + dependencies.get(j) + "\""); if (j < (dependencies.size() - 1)) { jsCode.append(", "); } } } jsCode.append(");\n"); } jsCode.append("\n\n"); return jsCode.toString(); }
/** * Returns a lazy initialized map that describes if a certain element if part of this container.<p> * * @return a lazy initialized map that describes if a certain element if part of this container */ public Map<CmsUUID, Boolean> getContainsElement() { if (m_containsElement == null) { m_containsElement = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { public Object transform(Object input) { return Boolean.valueOf(containsElement((CmsUUID)input)); } }); } return m_containsElement; }
/** * Initializes (also clears) the internal part cache map.<p> * * @return the new created part cache map */ private synchronized Map initPartsMap() { Map cacheParts = CmsCollectionsGenericWrapper.createLRUMap(512); Map oldParts = m_parts; m_parts = Collections.synchronizedMap(cacheParts); if (oldParts != null) { oldParts.clear(); oldParts = null; } return m_parts; } }
/** * Returns the (internal use only) map of list objects.<p> * * @param settings the wp settings for accessing the session * * @return the (internal use only) map of list objects */ private static Map<String, CmsHtmlList> getListObjectMap(CmsWorkplaceSettings settings) { Map<String, CmsHtmlList> objects = CmsCollectionsGenericWrapper.map(settings.getListObject()); if (objects == null) { // using hashtable as most efficient version of a synchronized map objects = new Hashtable<String, CmsHtmlList>(); settings.setListObject(objects); } return objects; }
/** * Returns the text which should be written to the configuration file for a given property value.<p> * * @param obj the property value * * @return the text to write for that property value */ private String getPropertyValueToWrite(Object obj) { String value; String valueToWrite = null; if (obj instanceof List<?>) { String[] values = {}; values = CmsCollectionsGenericWrapper.list(obj).toArray(values); // write it valueToWrite = "\\\n" + createValueString(values); } else { value = String.valueOf(obj).trim(); // escape commas and equals in value value = CmsStringUtil.substitute(value, ",", "\\,"); // value = CmsStringUtil.substitute(value, "=", "\\="); // write it valueToWrite = value; } return valueToWrite; }
/** * @see org.opencms.jsp.search.state.I_CmsSearchStateSorting#getCheckSelected() */ @Override public Map<I_CmsSearchConfigurationSortOption, Boolean> getCheckSelected() { if (m_selectedMap == null) { m_selectedMap = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { @Override public Object transform(final Object option) { return Boolean.valueOf(((I_CmsSearchConfigurationSortOption)option).equals(m_selected)); } }); } return m_selectedMap; }
Map<String, String[]> params = CmsCollectionsGenericWrapper.map(req.getParameterMap()); Iterator<Map.Entry<String, String[]>> i = params.entrySet().iterator(); while (i.hasNext()) {
Iterator<CmsSetupComponent> itComponents = CmsCollectionsGenericWrapper.<CmsSetupComponent> list( m_components.elementList()).iterator(); while (itComponents.hasNext()) { itComponents = CmsCollectionsGenericWrapper.<CmsSetupComponent> list(m_components.elementList()).iterator(); while (itComponents.hasNext()) { CmsSetupComponent component = itComponents.next();
/** * @see org.opencms.jsp.search.state.I_CmsSearchStateFacet#getIsChecked() */ @Override public Map<String, Boolean> getIsChecked() { if (m_checkedMap == null) { m_checkedMap = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { @Override public Object transform(final Object option) { return Boolean.valueOf(m_checked.contains(option)); } }); } return m_checkedMap; }
/** * Loads a Java properties hash containing SQL queries.<p> * * @param propertyFilename the package/filename of the properties hash */ protected void loadQueryProperties(String propertyFilename) { Properties properties = new Properties(); try { properties.load(getClass().getClassLoader().getResourceAsStream(propertyFilename)); m_queries.putAll(CmsCollectionsGenericWrapper.<String, String> map(properties)); replaceQuerySearchPatterns(); } catch (Throwable t) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_LOAD_QUERY_PROP_FILE_FAILED_1, propertyFilename), t); } properties = null; } }
/** * Returns a pipe separated list of module names for the given list of components.<p> * * @param componentIds the list of component IDs to get the modules for * * @return a pipe separated list of module names for the given list of components */ protected String getComponentModules(List<String> componentIds) { Set<String> comps = new HashSet<String>(); List<CmsSetupComponent> components = CmsCollectionsGenericWrapper.list(m_components.elementList()); for (CmsSetupComponent comp : components) { if (componentIds.contains(comp.getId())) { comps.addAll(getComponentModules(comp)); } } StringBuffer buf = new StringBuffer(); List<String> moduleNames = sortModules(getAvailableModules().values()); boolean first = true; for (String moduleName : moduleNames) { if (!first) { buf.append("|"); } if (comps.contains(moduleName)) { buf.append(moduleName); } first = false; } return buf.toString(); }
/** * @see org.opencms.jsp.search.result.I_CmsSearchResultWrapper#getFieldFacet() */ @Override public Map<String, FacetField> getFieldFacet() { if (m_fieldFacetMap == null) { m_fieldFacetMap = CmsCollectionsGenericWrapper.createLazyMap(new Transformer() { @Override public Object transform(final Object fieldName) { return m_solrResultList == null ? null : m_solrResultList.getFacetField(fieldName.toString()); } }); } return m_fieldFacetMap; }
/** * Loads a Java properties hash containing JPQL queries.<p> * * @param propertyFilename the package/filename of the properties hash */ protected void loadQueryProperties(String propertyFilename) { Properties properties = new Properties(); try { properties.load(getClass().getClassLoader().getResourceAsStream(propertyFilename)); m_queries.putAll(CmsCollectionsGenericWrapper.<String, String> map(properties)); replaceQuerySearchPatterns(); } catch (Throwable t) { if (LOG.isErrorEnabled()) { LOG.error( Messages.get().getBundle().key(Messages.LOG_LOAD_QUERY_PROP_FILE_FAILED_1, propertyFilename), t); } properties = null; } }