idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
21,700
private void loadLocalizationFromXmlBundle ( Locale locale ) { CmsXmlContentValueSequence messages = m_xmlBundle . getValueSequence ( "Message" , locale ) ; SortedProperties props = new SortedProperties ( ) ; if ( null != messages ) { for ( I_CmsXmlContentValue msg : messages . getValues ( ) ) { String msgpath = msg . ...
Loads the localization for the current locale from a bundle of type xmlvfsbundle . It assumes the content has already been unmarshalled before .
21,701
private void lockDescriptor ( ) throws CmsException { if ( ( null == m_descFile ) && ( null != m_desc ) ) { m_descFile = LockedFile . lockResource ( m_cms , m_desc ) ; } }
Locks the bundle descriptor .
21,702
private void lockLocalization ( Locale l ) throws CmsException { if ( null == m_lockedBundleFiles . get ( l ) ) { LockedFile lf = LockedFile . lockResource ( m_cms , m_bundleFiles . get ( l ) ) ; m_lockedBundleFiles . put ( l , lf ) ; } }
Locks the bundle file that contains the translation for the provided locale .
21,703
private void lockOnChange ( Object propertyId ) throws CmsException { if ( isDescriptorProperty ( propertyId ) ) { lockDescriptor ( ) ; } else { Locale l = m_bundleType . equals ( BundleType . PROPERTY ) ? m_locale : null ; lockLocalization ( l ) ; } }
Lock a file lazily if a value that should be written to the file has changed .
21,704
private boolean removeKeyForAllLanguages ( String key ) { try { if ( hasDescriptor ( ) ) { lockDescriptor ( ) ; } loadAllRemainingLocalizations ( ) ; lockAllLocalizations ( key ) ; } catch ( CmsException | IOException e ) { LOG . warn ( "Not able lock all localications for bundle." , e ) ; return false ; } if ( ! hasDe...
Remove a key for all language versions . If a descriptor is present the key is only removed in the descriptor .
21,705
private void removeXmlBundleFile ( ) throws CmsException { lockLocalization ( null ) ; m_cms . deleteResource ( m_resource , CmsResource . DELETE_PRESERVE_SIBLINGS ) ; m_resource = null ; }
Deletes the VFS XML bundle file .
21,706
private boolean renameKeyForAllLanguages ( String oldKey , String newKey ) { try { loadAllRemainingLocalizations ( ) ; lockAllLocalizations ( oldKey ) ; if ( hasDescriptor ( ) ) { lockDescriptor ( ) ; } } catch ( CmsException | IOException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; return false ; } for ( E...
Rename a key for all languages .
21,707
private boolean replaceValues ( Locale locale ) { try { SortedProperties localization = getLocalization ( locale ) ; if ( hasDescriptor ( ) ) { for ( Object itemId : m_container . getItemIds ( ) ) { Item item = m_container . getItem ( itemId ) ; String key = item . getItemProperty ( TableProperty . KEY ) . getValue ( )...
Replaces the translations in an existing container with the translations for the provided locale .
21,708
private void saveLocalization ( ) { SortedProperties localization = new SortedProperties ( ) ; for ( Object itemId : m_container . getItemIds ( ) ) { Item item = m_container . getItem ( itemId ) ; String key = item . getItemProperty ( TableProperty . KEY ) . getValue ( ) . toString ( ) ; String value = item . getItemPr...
Saves the current translations from the container to the respective localization .
21,709
private void saveToBundleDescriptor ( ) throws CmsException { if ( null != m_descFile ) { m_removeDescriptorOnCancel = false ; updateBundleDescriptorContent ( ) ; m_descFile . getFile ( ) . setContents ( m_descContent . marshal ( ) ) ; m_cms . writeFile ( m_descFile . getFile ( ) ) ; } }
Save the values to the bundle descriptor .
21,710
private void saveToPropertyVfsBundle ( ) throws CmsException { for ( Locale l : m_changedTranslations ) { SortedProperties props = m_localizations . get ( l ) ; LockedFile f = m_lockedBundleFiles . get ( l ) ; if ( ( null != props ) && ( null != f ) ) { try { ByteArrayOutputStream outputStream = new ByteArrayOutputStre...
Saves messages to a propertyvfsbundle file .
21,711
private void saveToXmlVfsBundle ( ) throws CmsException { if ( m_lockedBundleFiles . get ( null ) != null ) { for ( Locale l : m_locales ) { SortedProperties props = m_localizations . get ( l ) ; if ( null != props ) { if ( m_xmlBundle . hasLocale ( l ) ) { m_xmlBundle . removeLocale ( l ) ; } m_xmlBundle . addLocale (...
Saves messages to a xmlvfsbundle file .
21,712
private void setResourceInformation ( ) { String sitePath = m_cms . getSitePath ( m_resource ) ; int pathEnd = sitePath . lastIndexOf ( '/' ) + 1 ; String baseName = sitePath . substring ( pathEnd ) ; m_sitepath = sitePath . substring ( 0 , pathEnd ) ; switch ( CmsMessageBundleEditorTypes . BundleType . toBundleType ( ...
Extract site path base name and locale from the resource opened with the editor .
21,713
private void unmarshalDescriptor ( ) throws CmsXmlException , CmsException { if ( null != m_desc ) { m_descContent = CmsXmlContentFactory . unmarshal ( m_cms , m_cms . readFile ( m_desc ) ) ; CmsProperty bundleProp = m_cms . readPropertyObject ( m_desc , PROPERTY_BUNDLE_DESCRIPTOR_LOCALIZATION , true ) ; if ( ! ( bundl...
Unmarshals the descriptor content .
21,714
private void updateBundleDescriptorContent ( ) throws CmsXmlException { if ( m_descContent . hasLocale ( Descriptor . LOCALE ) ) { m_descContent . removeLocale ( Descriptor . LOCALE ) ; } m_descContent . addLocale ( m_cms , Descriptor . LOCALE ) ; int i = 0 ; Property < Object > descProp ; String desc ; Property < Obje...
Update the descriptor content with values from the editor .
21,715
protected void removeInvalidChildren ( ) { if ( getLoadState ( ) == LoadState . LOADED ) { List < CmsSitemapTreeItem > toDelete = new ArrayList < CmsSitemapTreeItem > ( ) ; for ( int i = 0 ; i < getChildCount ( ) ; i ++ ) { CmsSitemapTreeItem item = ( CmsSitemapTreeItem ) getChild ( i ) ; CmsUUID id = item . getEntryId...
Helper method to remove invalid children that don t have a corresponding CmsSitemapClientEntry .
21,716
@ UiHandler ( "m_everyDay" ) void onEveryDayChange ( ValueChangeEvent < String > event ) { if ( handleChange ( ) ) { m_controller . setInterval ( m_everyDay . getFormValueAsString ( ) ) ; } }
Handle interval change .
21,717
private String getApiKey ( CmsObject cms , String sitePath ) throws CmsException { String res = cms . readPropertyObject ( sitePath , CmsPropertyDefinition . PROPERTY_GOOGLE_API_KEY_WORKPLACE , true ) . getValue ( ) ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( res ) ) { res = cms . readPropertyObject ( sitePath , C...
Get the correct google api key . Tries to read a workplace key first .
21,718
private void propagateFacetNames ( ) { Collection < String > facetNames = new ArrayList < String > ( ) ; Collection < I_CmsSearchConfigurationFacet > facetConfigs = new ArrayList < I_CmsSearchConfigurationFacet > ( ) ; facetNames . addAll ( m_fieldFacets . keySet ( ) ) ; facetConfigs . addAll ( m_fieldFacets . values (...
Propagates the names of all facets to each single facet .
21,719
private int getDaysToNextMatch ( WeekDay weekDay ) { for ( WeekDay wd : m_weekDays ) { if ( wd . compareTo ( weekDay ) > 0 ) { return wd . toInt ( ) - weekDay . toInt ( ) ; } } return ( m_weekDays . iterator ( ) . next ( ) . toInt ( ) + ( m_interval * I_CmsSerialDateValue . NUM_OF_WEEKDAYS ) ) - weekDay . toInt ( ) ; }
Returns the number of days from the given weekday to the next weekday the event should occur .
21,720
public static I_CmsMacroResolver newWorkplaceLocaleResolver ( final CmsObject cms ) { CmsMacroResolver resolver = new CmsMacroResolver ( ) ; resolver . setCmsObject ( cms ) ; CmsUserSettings userSettings = new CmsUserSettings ( cms . getRequestContext ( ) . getCurrentUser ( ) ) ; CmsMultiMessages multimessages = new Cm...
Returns a new macro resolver that loads message keys from the workplace bundle in the user setting s language .
21,721
protected static List < String > parseMandatoryStringValues ( JSONObject json , String key ) throws JSONException { List < String > list = null ; JSONArray array = json . getJSONArray ( key ) ; list = new ArrayList < String > ( array . length ( ) ) ; for ( int i = 0 ; i < array . length ( ) ; i ++ ) { try { String entr...
Helper for reading a mandatory String value list - throwing an Exception if parsing fails .
21,722
protected Boolean getEscapeQueryChars ( ) { Boolean isEscape = parseOptionalBooleanValue ( m_configObject , JSON_KEY_ESCAPE_QUERY_CHARACTERS ) ; return ( null == isEscape ) && ( m_baseConfig != null ) ? Boolean . valueOf ( m_baseConfig . getGeneralConfig ( ) . getEscapeQueryChars ( ) ) : isEscape ; }
Returns the flag indicating if the characters in the query string that are commands to Solr should be escaped .
21,723
protected String getExtraSolrParams ( ) { try { return m_configObject . getString ( JSON_KEY_EXTRASOLRPARAMS ) ; } catch ( JSONException e ) { if ( null == m_baseConfig ) { if ( LOG . isInfoEnabled ( ) ) { LOG . info ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_NO_EXTRA_PARAMETERS_0 ) , e ) ; } return ""...
Returns the configured extra parameters that should be given to Solr or the empty string if no parameters are configured .
21,724
protected Boolean getIgnoreExpirationDate ( ) { Boolean isIgnoreExpirationDate = parseOptionalBooleanValue ( m_configObject , JSON_KEY_IGNORE_EXPIRATION_DATE ) ; return ( null == isIgnoreExpirationDate ) && ( m_baseConfig != null ) ? Boolean . valueOf ( m_baseConfig . getGeneralConfig ( ) . getIgnoreExpirationDate ( ) ...
Returns a flag indicating if also expired resources should be found .
21,725
protected Boolean getIgnoreQuery ( ) { Boolean isIgnoreQuery = parseOptionalBooleanValue ( m_configObject , JSON_KEY_IGNORE_QUERY ) ; return ( null == isIgnoreQuery ) && ( m_baseConfig != null ) ? Boolean . valueOf ( m_baseConfig . getGeneralConfig ( ) . getIgnoreQueryParam ( ) ) : isIgnoreQuery ; }
Returns a flag indicating if the query given by the parameters should be ignored .
21,726
protected Boolean getIgnoreReleaseDate ( ) { Boolean isIgnoreReleaseDate = parseOptionalBooleanValue ( m_configObject , JSON_KEY_IGNORE_RELEASE_DATE ) ; return ( null == isIgnoreReleaseDate ) && ( m_baseConfig != null ) ? Boolean . valueOf ( m_baseConfig . getGeneralConfig ( ) . getIgnoreReleaseDate ( ) ) : isIgnoreRel...
Returns a flag indicating if also unreleased resources should be found .
21,727
protected List < Integer > getPageSizes ( ) { try { return Collections . singletonList ( Integer . valueOf ( m_configObject . getInt ( JSON_KEY_PAGESIZE ) ) ) ; } catch ( JSONException e ) { List < Integer > result = null ; String pageSizesString = null ; try { pageSizesString = m_configObject . getString ( JSON_KEY_PA...
Returns the configured page sizes or the default page size if no core is configured .
21,728
protected String getQueryModifier ( ) { String queryModifier = parseOptionalStringValue ( m_configObject , JSON_KEY_QUERY_MODIFIER ) ; return ( null == queryModifier ) && ( null != m_baseConfig ) ? m_baseConfig . getGeneralConfig ( ) . getQueryModifier ( ) : queryModifier ; }
Returns the optional query modifier .
21,729
protected String getQueryParam ( ) { String param = parseOptionalStringValue ( m_configObject , JSON_KEY_QUERYPARAM ) ; if ( param == null ) { return null != m_baseConfig ? m_baseConfig . getGeneralConfig ( ) . getQueryParam ( ) : DEFAULT_QUERY_PARAM ; } else { return param ; } }
Returns the configured request parameter for the query string or the default parameter if no core is configured .
21,730
protected Boolean getSearchForEmptyQuery ( ) { Boolean isSearchForEmptyQuery = parseOptionalBooleanValue ( m_configObject , JSON_KEY_SEARCH_FOR_EMPTY_QUERY ) ; return ( isSearchForEmptyQuery == null ) && ( null != m_baseConfig ) ? Boolean . valueOf ( m_baseConfig . getGeneralConfig ( ) . getSearchForEmptyQueryParam ( )...
Returns a flag indicating if search should be performed using a wildcard if the empty query is given .
21,731
protected List < I_CmsSearchConfigurationSortOption > getSortOptions ( ) { List < I_CmsSearchConfigurationSortOption > options = new LinkedList < I_CmsSearchConfigurationSortOption > ( ) ; try { JSONArray sortOptions = m_configObject . getJSONArray ( JSON_KEY_SORTOPTIONS ) ; for ( int i = 0 ; i < sortOptions . length (...
Returns the list of the configured sort options or the empty list if no sort options are configured .
21,732
protected void init ( String configString , I_CmsSearchConfiguration baseConfig ) throws JSONException { m_configObject = new JSONObject ( configString ) ; m_baseConfig = baseConfig ; }
Initialization that parses the String to a JSON object .
21,733
protected I_CmsFacetQueryItem parseFacetQueryItem ( JSONObject item ) { String query ; try { query = item . getString ( JSON_KEY_QUERY_FACET_QUERY_QUERY ) ; } catch ( JSONException e ) { return null ; } String label = parseOptionalStringValue ( item , JSON_KEY_QUERY_FACET_QUERY_LABEL ) ; return new CmsFacetQueryItem ( ...
Parses a single query item for the query facet .
21,734
protected List < I_CmsFacetQueryItem > parseFacetQueryItems ( JSONObject queryFacetObject ) throws JSONException { JSONArray items = queryFacetObject . getJSONArray ( JSON_KEY_QUERY_FACET_QUERY ) ; List < I_CmsFacetQueryItem > result = new ArrayList < I_CmsFacetQueryItem > ( items . length ( ) ) ; for ( int i = 0 ; i <...
Parses the list of query items for the query facet .
21,735
protected I_CmsSearchConfigurationFacetField parseFieldFacet ( JSONObject fieldFacetObject ) { try { String field = fieldFacetObject . getString ( JSON_KEY_FACET_FIELD ) ; String name = parseOptionalStringValue ( fieldFacetObject , JSON_KEY_FACET_NAME ) ; String label = parseOptionalStringValue ( fieldFacetObject , JSO...
Parses the field facet configurations .
21,736
protected I_CmsSearchConfigurationFacetRange parseRangeFacet ( JSONObject rangeFacetObject ) { try { String range = rangeFacetObject . getString ( JSON_KEY_RANGE_FACET_RANGE ) ; String name = parseOptionalStringValue ( rangeFacetObject , JSON_KEY_FACET_NAME ) ; String label = parseOptionalStringValue ( rangeFacetObject...
Parses the query facet configurations .
21,737
protected I_CmsSearchConfigurationSortOption parseSortOption ( JSONObject json ) { try { String solrValue = json . getString ( JSON_KEY_SORTOPTION_SOLRVALUE ) ; String paramValue = parseOptionalStringValue ( json , JSON_KEY_SORTOPTION_PARAMVALUE ) ; paramValue = ( paramValue == null ) ? solrValue : paramValue ; String ...
Returns a single sort option configuration as configured via the methods parameter or null if the parameter does not specify a sort option .
21,738
private Map < String , String > mergeItem ( String item , Map < String , String > localeValues , Map < String , String > resultLocaleValues ) { if ( resultLocaleValues . get ( item ) != null ) { if ( localeValues . get ( item ) != null ) { localeValues . put ( item , localeValues . get ( item ) + " " + resultLocaleValu...
Merges the item from the resultLocaleValues into the corresponding item of the localeValues .
21,739
public static CmsGalleryTabConfiguration resolve ( String configStr ) { CmsGalleryTabConfiguration tabConfig ; if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( configStr ) ) { configStr = "*sitemap,types,galleries,categories,vfstree,search,results" ; } if ( DEFAULT_CONFIGURATIONS != null ) { tabConfig = DEFAULT_CONFIGURA...
Given a string which is either the name of a predefined tab configuration or a configuration string returns the corresponding tab configuration .
21,740
private void forward ( ) { Set < String > selected = new HashSet < > ( ) ; for ( CheckBox checkbox : m_componentCheckboxes ) { CmsSetupComponent component = ( CmsSetupComponent ) ( checkbox . getData ( ) ) ; if ( checkbox . getValue ( ) . booleanValue ( ) ) { selected . add ( component . getId ( ) ) ; } } String error ...
Moves to the next step .
21,741
private void initComponents ( List < CmsSetupComponent > components ) { for ( CmsSetupComponent component : components ) { CheckBox checkbox = new CheckBox ( ) ; checkbox . setValue ( component . isChecked ( ) ) ; checkbox . setCaption ( component . getName ( ) + " - " + component . getDescription ( ) ) ; checkbox . se...
Initializes the components .
21,742
protected void addFacetPart ( CmsSolrQuery query ) { query . set ( "facet" , "true" ) ; String excludes = "" ; if ( m_config . getIgnoreAllFacetFilters ( ) || ( ! m_state . getCheckedEntries ( ) . isEmpty ( ) && ! m_config . getIsAndFacet ( ) ) ) { excludes = "{!ex=" + m_config . getIgnoreTags ( ) + "}" ; } for ( I_Cms...
Add query part for the facet without filters .
21,743
protected void convertSearchResults ( final Collection < CmsSearchResource > searchResults ) { m_foundResources = new ArrayList < I_CmsSearchResourceBean > ( ) ; for ( final CmsSearchResource searchResult : searchResults ) { m_foundResources . add ( new CmsSearchResourceBean ( searchResult , m_cmsObject ) ) ; } }
Converts the search results from CmsSearchResource to CmsSearchResourceBean .
21,744
public void addAliasToConfigSite ( String alias , String redirect , String offset ) { long timeOffset = 0 ; try { timeOffset = Long . parseLong ( offset ) ; } catch ( Throwable e ) { } CmsSiteMatcher siteMatcher = new CmsSiteMatcher ( alias , timeOffset ) ; boolean redirectVal = new Boolean ( redirect ) . booleanValue ...
Adds an alias to the currently configured site .
21,745
private void addServer ( CmsSiteMatcher matcher , CmsSite site ) { Map < CmsSiteMatcher , CmsSite > siteMatcherSites = new HashMap < CmsSiteMatcher , CmsSite > ( m_siteMatcherSites ) ; siteMatcherSites . put ( matcher , site ) ; setSiteMatcherSites ( siteMatcherSites ) ; }
Adds a new Site matcher object to the map of server names .
21,746
private void updateLetsEncrypt ( ) { getReport ( ) . println ( Messages . get ( ) . container ( Messages . RPT_STARTING_LETSENCRYPT_UPDATE_0 ) ) ; CmsLetsEncryptConfiguration config = OpenCms . getLetsEncryptConfig ( ) ; if ( ( config == null ) || ! config . isValidAndEnabled ( ) ) { return ; } CmsSiteConfigToLetsEncry...
Updates LetsEncrypt configuration .
21,747
private String getDynamicAttributeValue ( CmsFile file , I_CmsXmlContentValue value , String attributeName , CmsEntity editedLocalEntity ) { if ( ( null != editedLocalEntity ) && ( editedLocalEntity . getAttribute ( attributeName ) != null ) ) { getSessionCache ( ) . setDynamicValue ( attributeName , editedLocalEntity ...
Returns the value that has to be set for the dynamic attribute .
21,748
public void setMonth ( String monthStr ) { final Month month = Month . valueOf ( monthStr ) ; if ( ( m_model . getMonth ( ) == null ) || ! m_model . getMonth ( ) . equals ( monthStr ) ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setMonth ( month ) ; onValueChange ( ) ; } } ) ; } ...
Set the month .
21,749
public void setPatternScheme ( final boolean isWeekDayBased ) { if ( isWeekDayBased ^ ( null != m_model . getWeekDay ( ) ) ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { if ( isWeekDayBased ) { m_model . setWeekDay ( getPatternDefaultValues ( ) . getWeekDay ( ) ) ; m_model . setWeekOfMonth (...
Set the pattern scheme .
21,750
public void setWeekDay ( String weekDayStr ) { final WeekDay weekDay = WeekDay . valueOf ( weekDayStr ) ; if ( ( m_model . getWeekDay ( ) != null ) || ! m_model . getWeekDay ( ) . equals ( weekDay ) ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setWeekDay ( weekDay ) ; onValueChan...
Set the week day .
21,751
public void setWeekOfMonth ( String weekOfMonthStr ) { final WeekOfMonth weekOfMonth = WeekOfMonth . valueOf ( weekOfMonthStr ) ; if ( ( null == m_model . getWeekOfMonth ( ) ) || ! m_model . getWeekOfMonth ( ) . equals ( weekOfMonth ) ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . ...
Set the week of month .
21,752
public static String getLocalizedKey ( Map < String , ? > propertiesMap , String key , Locale locale ) { List < String > localizedKeys = CmsLocaleManager . getLocaleVariants ( key , locale , true , false ) ; for ( String localizedKey : localizedKeys ) { if ( propertiesMap . containsKey ( localizedKey ) ) { return local...
Returns the key for the best matching local - specific property version .
21,753
private List < CmsSearchField > getFields ( ) { CmsSearchManager manager = OpenCms . getSearchManager ( ) ; I_CmsSearchFieldConfiguration fieldConfig = manager . getFieldConfiguration ( getParamFieldconfiguration ( ) ) ; List < CmsSearchField > result ; if ( fieldConfig != null ) { result = fieldConfig . getFields ( ) ...
Returns the configured fields of the current field configuration .
21,754
public static Function < String , String > createStringTemplateSource ( I_CmsFormatterBean formatter , Supplier < CmsXmlContent > contentSupplier ) { return key -> { String result = null ; if ( formatter != null ) { result = formatter . getAttributes ( ) . get ( key ) ; } if ( result == null ) { CmsXmlContent content =...
Helper method to create a string template source for a given formatter and content .
21,755
private Map < String , String > getContentsByContainerName ( CmsContainerElementBean element , Collection < CmsContainer > containers ) { CmsFormatterConfiguration configs = getFormatterConfiguration ( element . getResource ( ) ) ; Map < String , String > result = new HashMap < String , String > ( ) ; for ( CmsContaine...
Returns the rendered element content for all the given containers .
21,756
public void setWorkConnection ( CmsSetupDb db ) { db . setConnection ( m_setupBean . getDbDriver ( ) , m_setupBean . getDbWorkConStr ( ) , m_setupBean . getDbConStrParams ( ) , m_setupBean . getDbWorkUser ( ) , m_setupBean . getDbWorkPwd ( ) ) ; }
Set work connection .
21,757
private void updateDb ( String dbName , String webapp ) { m_mainLayout . removeAllComponents ( ) ; m_setupBean . setDatabase ( dbName ) ; CmsDbSettingsPanel panel = new CmsDbSettingsPanel ( m_setupBean ) ; m_panel [ 0 ] = panel ; panel . initFromSetupBean ( webapp ) ; m_mainLayout . addComponent ( panel ) ; }
Switches DB type .
21,758
public void removeExpiration ( ) { if ( getFilterQueries ( ) != null ) { for ( String fq : getFilterQueries ( ) ) { if ( fq . startsWith ( CmsSearchField . FIELD_DATE_EXPIRED + ":" ) || fq . startsWith ( CmsSearchField . FIELD_DATE_RELEASED + ":" ) ) { removeFilterQuery ( fq ) ; } } } m_ignoreExpiration = true ; }
Removes the expiration flag .
21,759
public Map < String , CmsJspCategoryAccessBean > getReadAllSubCategories ( ) { if ( null == m_allSubCategories ) { m_allSubCategories = CmsCollectionsGenericWrapper . createLazyMap ( new Transformer ( ) { public Object transform ( Object categoryPath ) { try { List < CmsCategory > categories = CmsCategoryService . getI...
Reads all sub - categories below the provided category .
21,760
public Map < String , CmsCategory > getReadCategory ( ) { if ( null == m_categories ) { m_categories = CmsCollectionsGenericWrapper . createLazyMap ( new Transformer ( ) { public Object transform ( Object categoryPath ) { try { CmsCategoryService catService = CmsCategoryService . getInstance ( ) ; return catService . l...
Transforms the category path of a category to the category .
21,761
public Map < String , CmsJspCategoryAccessBean > getReadResourceCategories ( ) { if ( null == m_resourceCategories ) { m_resourceCategories = CmsCollectionsGenericWrapper . createLazyMap ( new Transformer ( ) { public Object transform ( Object resourceName ) { try { CmsResource resource = m_cms . readResource ( getRequ...
Reads the categories assigned to a resource .
21,762
public Map < String , String > getSitePath ( ) { if ( m_sitePaths == null ) { m_sitePaths = CmsCollectionsGenericWrapper . createLazyMap ( new Transformer ( ) { public Object transform ( Object rootPath ) { if ( rootPath instanceof String ) { return getRequestContext ( ) . removeSiteRoot ( ( String ) rootPath ) ; } ret...
Transforms root paths to site paths .
21,763
public Map < String , String > getTitleLocale ( ) { if ( m_localeTitles == null ) { m_localeTitles = CmsCollectionsGenericWrapper . createLazyMap ( new Transformer ( ) { public Object transform ( Object inputLocale ) { Locale locale = null ; if ( null != inputLocale ) { if ( inputLocale instanceof Locale ) { locale = (...
Get the title and read the Title property according the provided locale .
21,764
protected String getLocaleSpecificTitle ( Locale locale ) { String result = null ; try { if ( isDetailRequest ( ) ) { CmsResource res = getDetailContent ( ) ; CmsFile file = m_cms . readFile ( res ) ; CmsXmlContent content = CmsXmlContentFactory . unmarshal ( m_cms , file ) ; result = content . getHandler ( ) . getTitl...
Returns the title according to the given locale .
21,765
public void setStringValue ( String value ) { if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( value ) ) { try { m_editValue = CmsLocationValue . parse ( value ) ; m_currentValue = m_editValue . cloneValue ( ) ; displayValue ( ) ; if ( ( m_popup != null ) && m_popup . isVisible ( ) ) { m_popupContent . displayValues (...
Sets the location value as string .
21,766
public static byte [ ] hashPassword ( String password ) throws InvalidKeyException , NoSuchAlgorithmException { PasswordEncryptor encryptor = new PasswordEncryptor ( ) ; return encryptor . generateEncryptedPassword ( password , null , PasswordEncryptor . MD4 , null , null ) ; }
Computes an MD4 hash for the password .
21,767
public void setHeader ( String header , String value ) { StringValidator . throwIfEmptyOrNull ( "header" , header ) ; StringValidator . throwIfEmptyOrNull ( "value" , value ) ; if ( headers == null ) { headers = new HashMap < String , String > ( ) ; } headers . put ( header , value ) ; }
Sets a request header with the given name and value . If a header with the specified name has already been set then the new value overwrites the current value .
21,768
protected List < CmsResource > getTopFolders ( List < CmsResource > folders ) { List < String > folderPaths = new ArrayList < String > ( ) ; List < CmsResource > topFolders = new ArrayList < CmsResource > ( ) ; Map < String , CmsResource > foldersByPath = new HashMap < String , CmsResource > ( ) ; for ( CmsResource fol...
Gives the roots of a list of folders i . e . the list of folders which are not descendants of any other folders in the original list
21,769
public void setDates ( SortedSet < Date > dates ) { if ( ! m_model . getIndividualDates ( ) . equals ( dates ) ) { m_model . setIndividualDates ( dates ) ; onValueChange ( ) ; } }
Set the individual dates .
21,770
public static CmsSolrSpellchecker getInstance ( CoreContainer container ) { if ( null == instance ) { synchronized ( CmsSolrSpellchecker . class ) { if ( null == instance ) { @ SuppressWarnings ( "resource" ) SolrCore spellcheckCore = container . getCore ( CmsSolrSpellchecker . SPELLCHECKER_INDEX_CORE ) ; if ( spellche...
Return an instance of this class .
21,771
public void getSpellcheckingResult ( final HttpServletResponse res , final ServletRequest servletRequest , final CmsObject cms ) throws CmsPermissionViolationException , IOException { performPermissionCheck ( cms ) ; setResponeHeaders ( res ) ; CmsSpellcheckingRequest cmsSpellcheckingRequest = null ; try { String reque...
Performs spellchecking using Solr and returns the spellchecking results using JSON .
21,772
public void parseAndAddDictionaries ( CmsObject cms ) throws CmsRoleViolationException { OpenCms . getRoleManager ( ) . checkRole ( cms , CmsRole . ROOT_ADMIN ) ; CmsSpellcheckDictionaryIndexer . parseAndAddZippedDictionaries ( m_solrClient , cms ) ; CmsSpellcheckDictionaryIndexer . parseAndAddDictionaries ( m_solrClie...
Parses and adds dictionaries to the Solr index .
21,773
private JSONObject getConvertedResponseAsJson ( SpellCheckResponse response ) { if ( null == response ) { return null ; } final JSONObject suggestions = new JSONObject ( ) ; final Map < String , Suggestion > solrSuggestions = response . getSuggestionMap ( ) ; for ( final String key : solrSuggestions . keySet ( ) ) { bo...
Converts the suggestions from the Solrj format to JSON format .
21,774
private JSONObject getJsonFormattedSpellcheckResult ( CmsSpellcheckingRequest request ) { final JSONObject response = new JSONObject ( ) ; try { if ( null != request . m_id ) { response . put ( JSON_ID , request . m_id ) ; } response . put ( JSON_RESULT , request . m_wordSuggestions ) ; } catch ( Exception e ) { try { ...
Returns the result of the performed spellcheck formatted in JSON .
21,775
private String getRequestBody ( ServletRequest request ) throws IOException { final StringBuilder sb = new StringBuilder ( ) ; String line = request . getReader ( ) . readLine ( ) ; while ( null != line ) { sb . append ( line ) ; line = request . getReader ( ) . readLine ( ) ; } return sb . toString ( ) ; }
Returns the body of the request . This method is used to read posted JSON data .
21,776
private CmsSpellcheckingRequest parseHttpRequest ( final ServletRequest req , final CmsObject cms ) { if ( ( null != cms ) && OpenCms . getRoleManager ( ) . hasRole ( cms , CmsRole . ROOT_ADMIN ) ) { try { if ( null != req . getParameter ( HTTP_PARAMETER_CHECKREBUILD ) ) { if ( CmsSpellcheckDictionaryIndexer . updating...
Parse parameters from this request using HTTP .
21,777
private CmsSpellcheckingRequest parseJsonRequest ( JSONObject jsonRequest ) { final String id = jsonRequest . optString ( JSON_ID ) ; final JSONObject params = jsonRequest . optJSONObject ( JSON_PARAMS ) ; if ( null == params ) { LOG . debug ( "Invalid JSON request: No field \"params\" defined. " ) ; return null ; } fi...
Parse JSON parameters from this request .
21,778
private void performPermissionCheck ( CmsObject cms ) throws CmsPermissionViolationException { if ( cms . getRequestContext ( ) . getCurrentUser ( ) . isGuestUser ( ) ) { throw new CmsPermissionViolationException ( null ) ; } }
Perform a security check against OpenCms .
21,779
private SpellCheckResponse performSpellcheckQuery ( CmsSpellcheckingRequest request ) { if ( ( null == request ) || ! request . isInitialized ( ) ) { return null ; } final String [ ] wordsToCheck = request . m_wordsToCheck ; final ModifiableSolrParams params = new ModifiableSolrParams ( ) ; params . set ( "spellcheck" ...
Performs the actual spell check query using Solr .
21,780
private void sendResponse ( final HttpServletResponse res , final CmsSpellcheckingRequest request ) throws IOException { final PrintWriter pw = res . getWriter ( ) ; final JSONObject response = getJsonFormattedSpellcheckResult ( request ) ; pw . println ( response . toString ( ) ) ; pw . close ( ) ; }
Sends the JSON - formatted spellchecking results to the client .
21,781
private void setResponeHeaders ( HttpServletResponse response ) { response . setHeader ( "Cache-Control" , "no-store, no-cache" ) ; response . setHeader ( "Pragma" , "no-cache" ) ; response . setDateHeader ( "Expires" , System . currentTimeMillis ( ) ) ; response . setContentType ( "text/plain; charset=utf-8" ) ; respo...
Sets the appropriate headers to response of this request .
21,782
public static int toIntWithDefault ( String value , int defaultValue ) { int result = defaultValue ; try { result = Integer . parseInt ( value ) ; } catch ( @ SuppressWarnings ( "unused" ) Exception e ) { } return result ; }
Parses int value and returns the provided default if the value can t be parsed .
21,783
public void init ( NamedList args ) { Object regex = args . remove ( PARAM_REGEX ) ; if ( null == regex ) { throw new SolrException ( ErrorCode . SERVER_ERROR , "Missing required init parameter: " + PARAM_REGEX ) ; } try { m_regex = Pattern . compile ( regex . toString ( ) ) ; } catch ( PatternSyntaxException e ) { thr...
Read the parameters on initialization .
21,784
String getDefaultReturnFields ( ) { StringBuffer fields = new StringBuffer ( "" ) ; fields . append ( CmsSearchField . FIELD_PATH ) ; fields . append ( ',' ) ; fields . append ( CmsSearchField . FIELD_INSTANCEDATE ) . append ( '_' ) . append ( getSearchLocale ( ) . toString ( ) ) . append ( "_dt" ) ; fields . append ( ...
The fields returned by default . Typically the output is done via display formatters and hence nearly no field is necessary . Returning all fields might cause performance problems .
21,785
private Map < String , I_CmsSearchConfigurationFacetField > getDefaultFieldFacets ( boolean categoryConjunction ) { Map < String , I_CmsSearchConfigurationFacetField > fieldFacets = new HashMap < String , I_CmsSearchConfigurationFacetField > ( ) ; fieldFacets . put ( CmsListManager . FIELD_CATEGORIES , new CmsSearchCon...
The default field facets .
21,786
public static String stripHtml ( String html ) { if ( html == null ) { return null ; } Element el = DOM . createDiv ( ) ; el . setInnerHTML ( html ) ; return el . getInnerText ( ) ; }
Returns the text content to any HTML .
21,787
public void setUserInfo ( String username , String infoName , String value ) throws CmsException { CmsUser user = m_cms . readUser ( username ) ; user . setAdditionalInfo ( infoName , value ) ; m_cms . writeUser ( user ) ; }
Sets a string - valued additional info entry on the user .
21,788
public void setTimewarpInt ( String timewarp ) { try { m_userSettings . setTimeWarp ( Long . valueOf ( timewarp ) . longValue ( ) ) ; } catch ( Exception e ) { m_userSettings . setTimeWarp ( - 1 ) ; } }
Sets the timewarp setting from a numeric string
21,789
String buildSelect ( String htmlAttributes , SelectOptions options ) { return buildSelect ( htmlAttributes , options . getOptions ( ) , options . getValues ( ) , options . getSelectedIndex ( ) ) ; }
Builds the HTML code for a select widget given a bean containing the select options
21,790
private String getValueFromProp ( final String propValue ) { String value = propValue ; value = value . trim ( ) ; if ( ( value . startsWith ( "\"" ) && value . endsWith ( "\"" ) ) || ( value . startsWith ( "'" ) && value . endsWith ( "'" ) ) ) { value = value . substring ( 1 , value . length ( ) - 1 ) ; } return value...
Helper to read a line from the config file .
21,791
public String getDynamicValue ( String attribute ) { return null == m_dynamicValues ? null : m_dynamicValues . get ( attribute ) ; }
Get cached value that is dynamically loaded by the Acacia content editor .
21,792
public void setDynamicValue ( String attribute , String value ) { if ( null == m_dynamicValues ) { m_dynamicValues = new ConcurrentHashMap < String , String > ( ) ; } m_dynamicValues . put ( attribute , value ) ; }
Set cached value for the attribute . Used for dynamically loaded values in the Acacia content editor .
21,793
public static CmsPair < String , Map < String , String > > parseEmbeddedGalleryOptions ( String configuration ) { final Map < String , String > galleryOptions = Maps . newHashMap ( ) ; String resultConfig = CmsStringUtil . substitute ( PATTERN_EMBEDDED_GALLERY_CONFIG , configuration , new I_CmsRegexSubstitution ( ) { p...
Parses and removes embedded gallery configuration strings .
21,794
private void updateScaling ( ) { List < I_CmsTransform > transforms = new ArrayList < > ( ) ; CmsCroppingParamBean crop = m_croppingProvider . get ( ) ; CmsImageInfoBean info = m_imageInfoProvider . get ( ) ; double wv = m_image . getElement ( ) . getParentElement ( ) . getOffsetWidth ( ) ; double hv = m_image . getEle...
Sets up the coordinate transformations between the coordinate system of the parent element of the image element and the native coordinate system of the original image .
21,795
public static String getEncoding ( CmsObject cms , CmsResource file ) { CmsProperty encodingProperty = CmsProperty . getNullProperty ( ) ; try { encodingProperty = cms . readPropertyObject ( file , CmsPropertyDefinition . PROPERTY_CONTENT_ENCODING , true ) ; } catch ( CmsException e ) { LOG . debug ( e . getLocalizedMe...
Returns the encoding of the file . Encoding is read from the content - encoding property and defaults to the systems default encoding . Since properties can change without rewriting content the actual encoding can differ .
21,796
public String getEditorParameter ( CmsObject cms , String editor , String param ) { String path = OpenCms . getSystemInfo ( ) . getConfigFilePath ( cms , "editors/" + editor + ".properties" ) ; CmsVfsMemoryObjectCache cache = CmsVfsMemoryObjectCache . getVfsMemoryObjectCache ( ) ; CmsParameterConfiguration config = ( C...
Gets the value of a global editor configuration parameter .
21,797
public Date getEnd ( ) { if ( null != m_explicitEnd ) { return isWholeDay ( ) ? adjustForWholeDay ( m_explicitEnd , true ) : m_explicitEnd ; } if ( ( null == m_end ) && ( m_series . getInstanceDuration ( ) != null ) ) { m_end = new Date ( m_start . getTime ( ) + m_series . getInstanceDuration ( ) . longValue ( ) ) ; } ...
Returns the end time of the event .
21,798
public void setEnd ( Date endDate ) { if ( ( null == endDate ) || getStart ( ) . after ( endDate ) ) { m_explicitEnd = null ; } else { m_explicitEnd = endDate ; } }
Explicitly set the end time of the event .
21,799
private Date adjustForWholeDay ( Date date , boolean isEnd ) { Calendar result = new GregorianCalendar ( ) ; result . setTime ( date ) ; result . set ( Calendar . HOUR_OF_DAY , 0 ) ; result . set ( Calendar . MINUTE , 0 ) ; result . set ( Calendar . SECOND , 0 ) ; result . set ( Calendar . MILLISECOND , 0 ) ; if ( isEn...
Adjust the date according to the whole day options .