idx
int64
0
41.2k
question
stringlengths
83
4.15k
target
stringlengths
5
715
21,400
private static List < CmsCategory > getCategories ( CmsObject cms , CmsResource resource ) { if ( ( null != resource ) && ( null != cms ) ) { try { return CmsCategoryService . getInstance ( ) . readResourceCategories ( cms , resource ) ; } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } }...
Reads the categories for the given resource .
21,401
public List < CmsCategory > getLeafItems ( ) { List < CmsCategory > result = new ArrayList < CmsCategory > ( ) ; if ( m_categories . isEmpty ( ) ) { return result ; } Iterator < CmsCategory > it = m_categories . iterator ( ) ; CmsCategory current = it . next ( ) ; while ( it . hasNext ( ) ) { CmsCategory next = it . ne...
Returns only the leaf categories of the wrapped categories .
21,402
public Map < String , CmsJspCategoryAccessBean > getSubCategories ( ) { if ( m_subCategories == null ) { m_subCategories = CmsCollectionsGenericWrapper . createLazyMap ( new Transformer ( ) { @ SuppressWarnings ( "synthetic-access" ) public Object transform ( Object pathPrefix ) { return new CmsJspCategoryAccessBean ( ...
Returns a map from a category path to the wrapper of all the sub - categories of the category with the path given as key .
21,403
public List < CmsCategory > getTopItems ( ) { List < CmsCategory > categories = new ArrayList < CmsCategory > ( ) ; String matcher = Pattern . quote ( m_mainCategoryPath ) + "[^/]*/" ; for ( CmsCategory category : m_categories ) { if ( category . getPath ( ) . matches ( matcher ) ) { categories . add ( category ) ; } }...
Returns all categories that are direct children of the current main category .
21,404
public void addHiDpiImage ( String factor , CmsJspImageBean image ) { if ( m_hiDpiImages == null ) { m_hiDpiImages = CmsCollectionsGenericWrapper . createLazyMap ( new CmsScaleHiDpiTransformer ( ) ) ; } m_hiDpiImages . put ( factor , image ) ; }
adds a CmsJspImageBean as hi - DPI variant to this image
21,405
public static final String [ ] getRequiredSolrFields ( ) { if ( null == m_requiredSolrFields ) { List < Locale > locales = OpenCms . getLocaleManager ( ) . getAvailableLocales ( ) ; m_requiredSolrFields = new String [ 14 + ( locales . size ( ) * 6 ) ] ; int count = 0 ; m_requiredSolrFields [ count ++ ] = CmsSearchField...
Returns the list of Solr fields a search result must have to initialize the gallery search result correctly .
21,406
private static CmsUUID toUuid ( String uuid ) { if ( "null" . equals ( uuid ) || CmsStringUtil . isEmpty ( uuid ) ) { return null ; } return new CmsUUID ( uuid ) ; }
Converts string to UUID and returns it or null if the conversion is not possible .
21,407
private void ensureIndexIsUnlocked ( String dataDir ) { Collection < File > lockFiles = new ArrayList < File > ( 2 ) ; lockFiles . add ( new File ( CmsFileUtil . addTrailingSeparator ( CmsFileUtil . addTrailingSeparator ( dataDir ) + "index" ) + "write.lock" ) ) ; lockFiles . add ( new File ( CmsFileUtil . addTrailingS...
Remove write . lock file in the data directory to ensure the index is unlocked .
21,408
private void maybeUpdateScrollbarPositions ( ) { if ( ! isAttached ( ) ) { return ; } if ( m_scrollbar != null ) { int vPos = getVerticalScrollPosition ( ) ; if ( m_scrollbar . getVerticalScrollPosition ( ) != vPos ) { m_scrollbar . setVerticalScrollPosition ( vPos ) ; } } }
Synchronize the scroll positions of the scrollbars with the actual scroll position of the content .
21,409
private void setVerticalScrollbar ( final CmsScrollBar scrollbar , int width ) { if ( ( scrollbar == m_scrollbar ) || ( scrollbar == null ) ) { return ; } scrollbar . asWidget ( ) . removeFromParent ( ) ; if ( m_scrollbar != null ) { if ( m_verticalScrollbarHandlerRegistration != null ) { m_verticalScrollbarHandlerRegi...
Set the scrollbar used for vertical scrolling .
21,410
public boolean detectBlackBerryHigh ( ) { if ( detectBlackBerryWebKit ( ) ) { return false ; } if ( detectBlackBerry ( ) ) { if ( detectBlackBerryTouch ( ) || ( userAgent . indexOf ( deviceBBBold ) != - 1 ) || ( userAgent . indexOf ( deviceBBTour ) != - 1 ) || ( userAgent . indexOf ( deviceBBCurve ) != - 1 ) ) { return...
Detects if the current browser is a BlackBerry device AND has a more capable recent browser . Excludes the Playbook . Examples Storm Bold Tour Curve2 Excludes the new BlackBerry OS 6 and 7 browser!!
21,411
public boolean detectBlackBerryTouch ( ) { if ( detectBlackBerry ( ) && ( ( userAgent . indexOf ( deviceBBStorm ) != - 1 ) || ( userAgent . indexOf ( deviceBBTorch ) != - 1 ) || ( userAgent . indexOf ( deviceBBBoldTouch ) != - 1 ) || ( userAgent . indexOf ( deviceBBCurveTouch ) != - 1 ) ) ) { return true ; } return fal...
Detects if the current browser is a BlackBerry Touch device such as the Storm Torch and Bold Touch . Excludes the Playbook .
21,412
public boolean detectMobileQuick ( ) { if ( isTierTablet ) { return false ; } if ( detectSmartphone ( ) ) { return true ; } if ( userAgent . indexOf ( mobile ) != - 1 ) { return true ; } if ( detectOperaMobile ( ) ) { return true ; } if ( detectKindle ( ) || detectAmazonSilk ( ) ) { return true ; } if ( detectWapWml ( ...
Detects if the current device is a mobile device . This method catches most of the popular modern devices . Excludes Apple iPads and other modern tablets .
21,413
public boolean detectNintendo ( ) { if ( ( userAgent . indexOf ( deviceNintendo ) != - 1 ) || ( userAgent . indexOf ( deviceWii ) != - 1 ) || ( userAgent . indexOf ( deviceNintendoDs ) != - 1 ) ) { return true ; } return false ; }
Detects if the current device is a Nintendo game device .
21,414
public boolean detectOperaMobile ( ) { if ( ( userAgent . indexOf ( engineOpera ) != - 1 ) && ( ( userAgent . indexOf ( mini ) != - 1 ) || ( userAgent . indexOf ( mobi ) != - 1 ) ) ) { return true ; } return false ; }
Detects Opera Mobile or Opera Mini .
21,415
public boolean detectSonyMylo ( ) { if ( ( userAgent . indexOf ( manuSony ) != - 1 ) && ( ( userAgent . indexOf ( qtembedded ) != - 1 ) || ( userAgent . indexOf ( mylocom2 ) != - 1 ) ) ) { return true ; } return false ; }
Detects if the current browser is a Sony Mylo device .
21,416
public boolean detectTierIphone ( ) { if ( detectIphoneOrIpod ( ) || detectAndroidPhone ( ) || detectWindowsPhone ( ) || detectBlackBerry10Phone ( ) || ( detectBlackBerryWebKit ( ) && detectBlackBerryTouch ( ) ) || detectPalmWebOS ( ) || detectBada ( ) || detectTizen ( ) || detectFirefoxOSPhone ( ) || detectSailfishPho...
The quick way to detect for a tier of devices . This method detects for devices which can display iPhone - optimized web content . Includes iPhone iPod Touch Android Windows Phone 7 and 8 BB10 WebOS Playstation Vita etc .
21,417
public boolean detectTierRichCss ( ) { boolean result = false ; if ( detectMobileQuick ( ) ) { if ( ! detectTierIphone ( ) && ! detectKindle ( ) ) { if ( detectWebkit ( ) || detectS60OssBrowser ( ) || detectBlackBerryHigh ( ) || detectWindowsMobile ( ) || ( userAgent . indexOf ( engineTelecaQ ) != - 1 ) ) { result = tr...
The quick way to detect for a tier of devices . This method detects for devices which are likely to be capable of viewing CSS content optimized for the iPhone but may not necessarily support JavaScript . Excludes all iPhone Tier devices .
21,418
private void setCorrectDay ( Calendar date ) { if ( monthHasNotDay ( date ) ) { date . set ( Calendar . DAY_OF_MONTH , date . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) ; } else { date . set ( Calendar . DAY_OF_MONTH , m_dayOfMonth ) ; } }
Set the correct day for the date with year and month already fixed .
21,419
public String getDbProperty ( String key ) { String databaseKey = key . substring ( 0 , key . indexOf ( '.' ) ) ; Properties databaseProperties = getDatabaseProperties ( ) . get ( databaseKey ) ; return databaseProperties . getProperty ( key , "" ) ; }
Returns the value for a given key from the database properties .
21,420
public String isChecked ( String value1 , String value2 ) { if ( ( value1 == null ) || ( value2 == null ) ) { return "" ; } if ( value1 . trim ( ) . equalsIgnoreCase ( value2 . trim ( ) ) ) { return "checked" ; } return "" ; }
Over simplistic helper to compare two strings to check radio buttons .
21,421
public boolean canLockBecauseOfInactivity ( CmsObject cms , CmsUser user ) { return ! user . isManaged ( ) && ! user . isWebuser ( ) && ! OpenCms . getDefaultUsers ( ) . isDefaultUser ( user . getName ( ) ) && ! OpenCms . getRoleManager ( ) . hasRole ( cms , user . getName ( ) , CmsRole . ROOT_ADMIN ) ; }
Checks whether a user account can be locked because of inactivity .
21,422
private void addDownloadButton ( final CmsLogFileView view ) { Button button = CmsToolBar . createButton ( FontOpenCms . DOWNLOAD , CmsVaadinUtils . getMessageText ( Messages . GUI_LOGFILE_DOWNLOAD_0 ) ) ; button . addClickListener ( new ClickListener ( ) { private static final long serialVersionUID = 1L ; public void ...
Adds the download button .
21,423
@ SuppressWarnings ( "unchecked" ) public static boolean addPropertyDefault ( PropertiesImpl props , PropertyDefinition < ? > propDef ) { if ( ( props == null ) || ( props . getProperties ( ) == null ) ) { throw new IllegalArgumentException ( "Props must not be null!" ) ; } if ( propDef == null ) { return false ; } Lis...
Adds the default value of property if defined .
21,424
public static boolean checkAddProperty ( CmsCmisTypeManager typeManager , Properties properties , String typeId , Set < String > filter , String id ) { if ( ( properties == null ) || ( properties . getProperties ( ) == null ) ) { throw new IllegalArgumentException ( "Properties must not be null!" ) ; } if ( id == null ...
Checks whether a property can be added to a Properties .
21,425
public static GregorianCalendar millisToCalendar ( long millis ) { GregorianCalendar result = new GregorianCalendar ( ) ; result . setTimeZone ( TimeZone . getTimeZone ( "GMT" ) ) ; result . setTimeInMillis ( ( long ) ( Math . ceil ( millis / 1000 ) * 1000 ) ) ; return result ; }
Converts milliseconds into a calendar object .
21,426
private void updateGhostStyle ( ) { if ( CmsStringUtil . isEmpty ( m_realValue ) ) { if ( CmsStringUtil . isEmpty ( m_ghostValue ) ) { updateTextArea ( m_realValue ) ; return ; } if ( ! m_focus ) { setGhostStyleEnabled ( true ) ; updateTextArea ( m_ghostValue ) ; } else { setGhostStyleEnabled ( false ) ; } } else { set...
Updates the styling and content of the internal text area based on the real value the ghost value and whether it has focus .
21,427
private Map < String , String > generateCommonConfigPart ( ) { Map < String , String > result = new HashMap < > ( ) ; if ( m_category != null ) { result . put ( CONFIGURATION_CATEGORY , m_category ) ; } if ( m_onlyLeafs ) { result . put ( CONFIGURATION_ONLYLEAFS , null ) ; } if ( m_property != null ) { result . put ( C...
Helper to generate the common configuration part for client - side and server - side widget .
21,428
public Map < TimestampMode , List < String > > getDefaultTimestampModes ( ) { Map < TimestampMode , List < String > > result = new HashMap < TimestampMode , List < String > > ( ) ; for ( String resourcetype : m_defaultTimestampModes . keySet ( ) ) { TimestampMode mode = m_defaultTimestampModes . get ( resourcetype ) ; ...
Returns the map from resourcetype names to default timestamp modes .
21,429
protected < H extends EventHandler > HandlerRegistration addHandler ( final H handler , GwtEvent . Type < H > type ) { return ensureHandlers ( ) . addHandlerToSource ( type , this , handler ) ; }
Adds this handler to the widget .
21,430
protected List < I_CmsFacetQueryItem > parseFacetQueryItems ( final String path ) throws Exception { final List < I_CmsXmlContentValue > values = m_xml . getValues ( path , m_locale ) ; if ( values == null ) { return null ; } else { List < I_CmsFacetQueryItem > parsedItems = new ArrayList < I_CmsFacetQueryItem > ( valu...
Helper to read a mandatory String value list .
21,431
protected I_CmsSearchConfigurationFacetField parseFieldFacet ( final String pathPrefix ) { try { final String field = parseMandatoryStringValue ( pathPrefix + XML_ELEMENT_FACET_FIELD ) ; final String name = parseOptionalStringValue ( pathPrefix + XML_ELEMENT_FACET_NAME ) ; final String label = parseOptionalStringValue ...
Reads the configuration of a field facet .
21,432
protected Boolean parseOptionalBooleanValue ( final String path ) { final I_CmsXmlContentValue value = m_xml . getValue ( path , m_locale ) ; if ( value == null ) { return null ; } else { final String stringValue = value . getStringValue ( null ) ; try { final Boolean boolValue = Boolean . valueOf ( stringValue ) ; ret...
Helper to read an optional Boolean value .
21,433
protected Integer parseOptionalIntValue ( final String path ) { final I_CmsXmlContentValue value = m_xml . getValue ( path , m_locale ) ; if ( value == null ) { return null ; } else { final String stringValue = value . getStringValue ( null ) ; try { final Integer intValue = Integer . valueOf ( stringValue ) ; return i...
Helper to read an optional Integer value .
21,434
protected String parseOptionalStringValue ( final String path ) { final I_CmsXmlContentValue value = m_xml . getValue ( path , m_locale ) ; if ( value == null ) { return null ; } else { return value . getStringValue ( null ) ; } }
Helper to read an optional String value .
21,435
protected List < String > parseOptionalStringValues ( final String path ) { final List < I_CmsXmlContentValue > values = m_xml . getValues ( path , m_locale ) ; if ( values == null ) { return null ; } else { List < String > stringValues = new ArrayList < String > ( values . size ( ) ) ; for ( I_CmsXmlContentValue value...
Helper to read an optional String value list .
21,436
protected I_CmsSearchConfigurationFacetRange parseRangeFacet ( String pathPrefix ) { try { final String range = parseMandatoryStringValue ( pathPrefix + XML_ELEMENT_RANGE_FACET_RANGE ) ; final String name = parseOptionalStringValue ( pathPrefix + XML_ELEMENT_FACET_NAME ) ; final String label = parseOptionalStringValue ...
Reads the configuration of a range facet .
21,437
private List < Integer > getPageSizes ( ) { final String pageSizes = parseOptionalStringValue ( XML_ELEMENT_PAGESIZE ) ; if ( pageSizes != null ) { String [ ] pageSizesArray = pageSizes . split ( "-" ) ; if ( pageSizesArray . length > 0 ) { try { List < Integer > result = new ArrayList < > ( pageSizesArray . length ) ;...
Returns the configured page size or the default page size if it is not configured .
21,438
private String getQueryParam ( ) { final String param = parseOptionalStringValue ( XML_ELEMENT_QUERYPARAM ) ; if ( param == null ) { return DEFAULT_QUERY_PARAM ; } else { return param ; } }
Returns the configured request parameter for the current query string or the default parameter if the core is not specified .
21,439
private List < I_CmsSearchConfigurationSortOption > getSortOptions ( ) { final List < I_CmsSearchConfigurationSortOption > options = new ArrayList < I_CmsSearchConfigurationSortOption > ( ) ; final CmsXmlContentValueSequence sortOptions = m_xml . getValueSequence ( XML_ELEMENT_SORTOPTIONS , m_locale ) ; if ( sortOption...
Returns the configured sort options or the empty list if no such options are configured .
21,440
private I_CmsFacetQueryItem parseFacetQueryItem ( final String prefix ) { I_CmsXmlContentValue query = m_xml . getValue ( prefix + XML_ELEMENT_QUERY_FACET_QUERY_QUERY , m_locale ) ; if ( null != query ) { String queryString = query . getStringValue ( null ) ; I_CmsXmlContentValue label = m_xml . getValue ( prefix + XML...
Parses a single query facet item with query and label .
21,441
private String parseMandatoryStringValue ( final String path ) throws Exception { final String value = parseOptionalStringValue ( path ) ; if ( value == null ) { throw new Exception ( ) ; } return value ; }
Helper to read a mandatory String value .
21,442
protected I_CmsSearchDocument createDefaultIndexDocument ( ) { try { return m_index . getFieldConfiguration ( ) . createDocument ( m_cms , m_res , m_index , null ) ; } catch ( CmsException e ) { LOG . error ( "Default document for " + m_res . getRootPath ( ) + " and index " + m_index . getName ( ) + " could not be crea...
Creates a document for the resource without extracting the content . The aim is to get a content indexed even if extraction runs into a timeout .
21,443
public CmsJspInstanceDateBean getToInstanceDate ( ) { if ( m_instanceDate == null ) { m_instanceDate = new CmsJspInstanceDateBean ( getToDate ( ) , m_cms . getRequestContext ( ) . getLocale ( ) ) ; } return m_instanceDate ; }
Converts a date to an instance date bean .
21,444
public static String getGalleryNotFoundKey ( String gallery ) { StringBuffer sb = new StringBuffer ( ERROR_REASON_NO_PREFIX ) ; sb . append ( gallery . toUpperCase ( ) ) ; sb . append ( GUI_TITLE_POSTFIX ) ; return sb . toString ( ) ; }
Convert gallery name to not found error key .
21,445
public static String getTitleGalleryKey ( String gallery ) { StringBuffer sb = new StringBuffer ( GUI_TITLE_PREFIX ) ; sb . append ( gallery . toUpperCase ( ) ) ; sb . append ( GUI_TITLE_POSTFIX ) ; return sb . toString ( ) ; }
Convert gallery name to title key .
21,446
public static String getTemplateMapperConfig ( ServletRequest request ) { String result = null ; CmsTemplateContext templateContext = ( CmsTemplateContext ) request . getAttribute ( CmsTemplateContextManager . ATTR_TEMPLATE_CONTEXT ) ; if ( templateContext != null ) { I_CmsTemplateContextProvider provider = templateCon...
Checks if the selected template context is templatemapper .
21,447
private CmsTemplateMapperConfiguration getConfiguration ( final CmsObject cms ) { if ( ! m_enabled ) { return CmsTemplateMapperConfiguration . EMPTY_CONFIG ; } if ( m_configPath == null ) { m_configPath = OpenCms . getSystemInfo ( ) . getConfigFilePath ( cms , "template-mapping.xml" ) ; } return ( CmsTemplateMapperConf...
Loads the configuration file using CmsVfsMemoryObjectCache for caching .
21,448
private void onShow ( ) { if ( m_detailsFieldset != null ) { m_detailsFieldset . getContentPanel ( ) . getElement ( ) . getStyle ( ) . setPropertyPx ( "maxHeight" , getAvailableHeight ( m_messageWidget . getOffsetHeight ( ) ) ) ; } }
Checks the available space and sets max - height to the details field - set .
21,449
public void addModuleToExport ( final String moduleName ) { if ( m_modulesToExport == null ) { m_modulesToExport = new HashSet < String > ( ) ; } m_modulesToExport . add ( moduleName ) ; }
Adds a module to the modules that should be exported . If called at least once the explicitly added modules will be exported instead of the default modules .
21,450
public int checkIn ( ) { try { synchronized ( STATIC_LOCK ) { m_logStream = new PrintStream ( new FileOutputStream ( DEFAULT_LOGFILE_PATH , false ) ) ; CmsObject cms = getCmsObject ( ) ; if ( cms != null ) { return checkInInternal ( ) ; } else { m_logStream . println ( "No CmsObject given. Did you call init() first?" )...
Start export and check in of the selected modules .
21,451
public boolean setCurrentConfiguration ( CmsGitConfiguration configuration ) { if ( ( null != configuration ) && configuration . isValid ( ) ) { m_currentConfiguration = configuration ; return true ; } return false ; }
Sets the current configuration if it is a valid configuration . Otherwise the configuration is not set .
21,452
private int checkInInternal ( ) { m_logStream . println ( "[" + new Date ( ) + "] STARTING Git task" ) ; m_logStream . println ( "=========================" ) ; m_logStream . println ( ) ; if ( m_checkout ) { m_logStream . println ( "Running checkout script" ) ; } else if ( ! ( m_resetHead || m_resetRemoteHead ) ) { m_...
Export modules and check them in . Assumes the log stream already open .
21,453
private String checkinScriptCommand ( ) { String exportModules = "" ; if ( ( m_modulesToExport != null ) && ! m_modulesToExport . isEmpty ( ) ) { StringBuffer exportModulesParam = new StringBuffer ( ) ; for ( String moduleName : m_modulesToExport ) { exportModulesParam . append ( " " ) . append ( moduleName ) ; } expor...
Returns the command to run by the shell to normally run the checkin script .
21,454
private void exportModules ( ) { if ( ( ( null != m_copyAndUnzip ) && ! m_copyAndUnzip . booleanValue ( ) ) || ( ( null == m_copyAndUnzip ) && ! m_currentConfiguration . getDefaultCopyAndUnzip ( ) ) ) { m_logStream . println ( ) ; m_logStream . println ( "NOT EXPORTING MODULES - you disabled copy and unzip." ) ; m_logS...
Export the modules that should be checked in into git .
21,455
private List < CmsGitConfiguration > readConfigFiles ( ) { List < CmsGitConfiguration > configurations = new LinkedList < CmsGitConfiguration > ( ) ; addConfigurationIfValid ( configurations , new File ( DEFAULT_CONFIG_FILE ) ) ; File configFolder = new File ( DEFAULT_CONFIG_FOLDER ) ; if ( configFolder . isDirectory (...
Read all configuration files .
21,456
private int runCommitScript ( ) { if ( m_checkout && ! m_fetchAndResetBeforeImport ) { m_logStream . println ( "Skipping script...." ) ; return 0 ; } try { m_logStream . flush ( ) ; String commandParam ; if ( m_resetRemoteHead ) { commandParam = resetRemoteHeadScriptCommand ( ) ; } else if ( m_resetHead ) { commandPara...
Runs the shell script for committing and optionally pushing the changes in the module .
21,457
protected void updateForNewConfiguration ( CmsGitConfiguration gitConfig ) { if ( ! m_checkinBean . setCurrentConfiguration ( gitConfig ) ) { Notification . show ( CmsVaadinUtils . getMessageText ( Messages . GUI_GIT_CONFIGURATION_SWITCH_FAILED_0 ) , CmsVaadinUtils . getMessageText ( Messages . GUI_GIT_CONFIGURATION_SW...
Updates the options panel for a special configuration .
21,458
private void configureConfigurationSelector ( ) { if ( m_checkinBean . getConfigurations ( ) . size ( ) < 2 ) { removeComponent ( m_configurationSelectionPanel ) ; } else { for ( CmsGitConfiguration configuration : m_checkinBean . getConfigurations ( ) ) { m_configurationSelector . addItem ( configuration ) ; m_configu...
Configures the configuration selector .
21,459
public void loadWithTimeout ( int timeout ) { for ( String stylesheet : m_stylesheets ) { boolean alreadyLoaded = checkStylesheet ( stylesheet ) ; if ( alreadyLoaded ) { m_loadCounter += 1 ; } else { appendStylesheet ( stylesheet , m_jsCallback ) ; } } checkAllLoaded ( ) ; if ( timeout > 0 ) { Timer timer = new Timer (...
Starts the loading process and creates a timer that sets of the callback after a given tiime if it hasn t already been triggered .
21,460
protected boolean hasPermissions ( CmsObject cms , CmsSolrDocument doc , CmsResourceFilter filter ) { return null != ( filter == null ? getResource ( cms , doc ) : getResource ( cms , doc , filter ) ) ; }
Check if the current user has permissions on the document s resource .
21,461
private boolean isDebug ( CmsObject cms , CmsSolrQuery query ) { String [ ] debugSecretValues = query . remove ( REQUEST_PARAM_DEBUG_SECRET ) ; String debugSecret = ( debugSecretValues == null ) || ( debugSecretValues . length < 1 ) ? null : debugSecretValues [ 0 ] ; if ( ( null != debugSecret ) && ! debugSecret . trim...
Checks if the query should be executed using the debug mode where the security restrictions do not apply .
21,462
private void throwExceptionIfSafetyRestrictionsAreViolated ( CmsObject cms , CmsSolrQuery query , boolean isSpell ) throws CmsSearchException { if ( ! isDebug ( cms , query ) ) { if ( isSpell ) { if ( m_handlerSpellDisabled ) { throw new CmsSearchException ( Messages . get ( ) . container ( Messages . GUI_HANDLER_REQUE...
Throws an exception if the request can for security reasons not be performed . Security restrictions can be set via parameters of the index .
21,463
private String alterPrefix ( String word , String oldPrefix , String newPrefix ) { if ( word . startsWith ( oldPrefix ) ) { return word . replaceFirst ( oldPrefix , newPrefix ) ; } return ( newPrefix + word ) ; }
Manipulates a string by cutting of a prefix if present and adding a new prefix .
21,464
public void updateColor ( TestColor color ) { switch ( color ) { case green : m_forwardButton . setEnabled ( true ) ; m_confirmCheckbox . setVisible ( false ) ; m_status . setValue ( STATUS_GREEN ) ; break ; case yellow : m_forwardButton . setEnabled ( false ) ; m_confirmCheckbox . setVisible ( true ) ; m_status . setV...
Sets test status .
21,465
public void copyCategories ( CmsObject cms , CmsResource fromResource , String toResourceSitePath ) throws CmsException { List < CmsCategory > categories = readResourceCategories ( cms , fromResource ) ; for ( CmsCategory category : categories ) { addResourceToCategory ( cms , toResourceSitePath , category ) ; } }
Adds all categories from one resource to another skipping categories that are not available for the resource copied to .
21,466
static Locale getLocale ( PageContext pageContext , String name ) { Locale loc = null ; Object obj = javax . servlet . jsp . jstl . core . Config . find ( pageContext , name ) ; if ( obj != null ) { if ( obj instanceof Locale ) { loc = ( Locale ) obj ; } else { loc = SetLocaleSupport . parseLocale ( ( String ) obj ) ; ...
Returns the locale specified by the named scoped attribute or context configuration parameter .
21,467
protected String generateCacheKey ( CmsObject cms , String targetSiteRoot , String detailPagePart , String absoluteLink ) { return cms . getRequestContext ( ) . getSiteRoot ( ) + ":" + targetSiteRoot + ":" + detailPagePart + absoluteLink ; }
Generates the cache key for Online links .
21,468
protected boolean isSecureLink ( CmsObject cms , String vfsName , CmsSite targetSite , boolean secureRequest ) { return OpenCms . getStaticExportManager ( ) . isSecureLink ( cms , vfsName , targetSite . getSiteRoot ( ) , secureRequest ) ; }
Checks if the link target is a secure link . <p
21,469
private float MIN ( float first , float second , float third ) { float min = Integer . MAX_VALUE ; if ( first < min ) { min = first ; } if ( second < min ) { min = second ; } if ( third < min ) { min = third ; } return min ; }
Calculates the smallest value between the three inputs .
21,470
private void setHex ( ) { String hRed = Integer . toHexString ( getRed ( ) ) ; String hGreen = Integer . toHexString ( getGreen ( ) ) ; String hBlue = Integer . toHexString ( getBlue ( ) ) ; if ( hRed . length ( ) == 0 ) { hRed = "00" ; } if ( hRed . length ( ) == 1 ) { hRed = "0" + hRed ; } if ( hGreen . length ( ) ==...
Converts from RGB to Hexadecimal notation .
21,471
private String formatDate ( Date date ) { if ( null == m_dateFormat ) { m_dateFormat = DateFormat . getDateInstance ( 0 , OpenCms . getWorkplaceManager ( ) . getWorkplaceLocale ( getCmsObject ( ) ) ) ; } return m_dateFormat . format ( date ) ; }
Format the date for the status messages .
21,472
public static String createResource ( CmsObject cmsObject , String newLink , Locale locale , String sitePath , String modelFileName , String mode , String postCreateHandler ) { String [ ] newLinkParts = newLink . split ( "\\|" ) ; String rootPath = newLinkParts [ 1 ] ; String typeName = newLinkParts [ 2 ] ; CmsFile mod...
Creates a new resource .
21,473
private static I_CmsResourceBundle tryBundle ( String localizedName ) { I_CmsResourceBundle result = null ; try { String resourceName = localizedName . replace ( '.' , '/' ) + ".properties" ; URL url = CmsResourceBundleLoader . class . getClassLoader ( ) . getResource ( resourceName ) ; I_CmsResourceBundle additionalBu...
Tries to load a property file with the specified name .
21,474
private static ResourceBundle tryBundle ( String baseName , Locale locale , boolean wantBase ) { I_CmsResourceBundle first = null ; I_CmsResourceBundle last = null ; List < String > bundleNames = CmsLocaleManager . getLocaleVariants ( baseName , locale , true , true ) ; for ( String bundleName : bundleNames ) { if ( bu...
Tries to load a the bundle for a given locale also loads the backup locales with the same language .
21,475
public CmsMessageContainer validateWithMessage ( ) { if ( m_parsingFailed ) { return Messages . get ( ) . container ( Messages . ERR_SERIALDATE_INVALID_VALUE_0 ) ; } if ( ! isStartSet ( ) ) { return Messages . get ( ) . container ( Messages . ERR_SERIALDATE_START_MISSING_0 ) ; } if ( ! isEndValid ( ) ) { return Message...
Validates the wrapped value and returns a localized error message in case of invalid values .
21,476
private JSONArray datesToJson ( Collection < Date > individualDates ) { if ( null != individualDates ) { JSONArray result = new JSONArray ( ) ; for ( Date d : individualDates ) { result . put ( dateToJson ( d ) ) ; } return result ; } return null ; }
Converts a list of dates to a Json array with the long representation of the dates as strings .
21,477
private JSONArray readOptionalArray ( JSONObject json , String key ) { try { return json . getJSONArray ( key ) ; } catch ( JSONException e ) { LOG . debug ( "Reading optional JSON array failed. Default to provided default value." , e ) ; } return null ; }
Read an optional JSON array .
21,478
private Boolean readOptionalBoolean ( JSONObject json , String key ) { try { return Boolean . valueOf ( json . getBoolean ( key ) ) ; } catch ( JSONException e ) { LOG . debug ( "Reading optional JSON boolean failed. Default to provided default value." , e ) ; } return null ; }
Read an optional boolean value form a JSON Object .
21,479
private String readOptionalString ( JSONObject json , String key , String defaultValue ) { try { String str = json . getString ( key ) ; if ( str != null ) { return str ; } } catch ( JSONException e ) { LOG . debug ( "Reading optional JSON string failed. Default to provided default value." , e ) ; } return defaultValue...
Read an optional string value form a JSON Object .
21,480
private void readPattern ( JSONObject patternJson ) { setPatternType ( readPatternType ( patternJson ) ) ; setInterval ( readOptionalInt ( patternJson , JsonKey . PATTERN_INTERVAL ) ) ; setWeekDays ( readWeekDays ( patternJson ) ) ; setDayOfMonth ( readOptionalInt ( patternJson , JsonKey . PATTERN_DAY_OF_MONTH ) ) ; se...
Read pattern information from the provided JSON object .
21,481
private JSONArray toJsonStringArray ( Collection < ? extends Object > collection ) { if ( null != collection ) { JSONArray array = new JSONArray ( ) ; for ( Object o : collection ) { array . put ( "" + o ) ; } return array ; } else { return null ; } }
Convert a collection of objects to a JSON array with the string representations of that objects .
21,482
private String validateDuration ( ) { if ( ! isValidEndTypeForPattern ( ) ) { return Messages . ERR_SERIALDATE_INVALID_END_TYPE_FOR_PATTERN_0 ; } switch ( getEndType ( ) ) { case DATE : return ( getStart ( ) . getTime ( ) < ( getSeriesEndDate ( ) . getTime ( ) + DAY_IN_MILLIS ) ) ? null : Messages . ERR_SERIALDATE_SERI...
Checks if the provided duration information is valid .
21,483
private String validatePattern ( ) { String error = null ; switch ( getPatternType ( ) ) { case DAILY : error = isEveryWorkingDay ( ) ? null : validateInterval ( ) ; break ; case WEEKLY : error = validateInterval ( ) ; if ( null == error ) { error = validateWeekDaySet ( ) ; } break ; case MONTHLY : error = validateInte...
Check if all values used for calculating the series for a specific pattern are valid .
21,484
public static HikariConfig createHikariConfig ( CmsParameterConfiguration config , String key ) { Map < String , String > poolMap = Maps . newHashMap ( ) ; for ( Map . Entry < String , String > entry : config . entrySet ( ) ) { String suffix = getPropertyRelativeSuffix ( KEY_DATABASE_POOL + "." + key , entry . getKey (...
Creates the HikariCP configuration based on the configuration of a pool defined in opencms . properties .
21,485
private CmsXmlContent unmarshalXmlContent ( CmsFile file ) throws CmsXmlException { CmsXmlContent content = CmsXmlContentFactory . unmarshal ( m_cms , file ) ; content . setAutoCorrectionEnabled ( true ) ; content . correctXmlStructure ( m_cms ) ; return content ; }
Unmarshal the XML content with auto - correction .
21,486
protected CmsAccessControlEntry getImportAccessControlEntry ( CmsResource res , String id , String allowed , String denied , String flags ) { return new CmsAccessControlEntry ( res . getResourceId ( ) , new CmsUUID ( id ) , Integer . parseInt ( allowed ) , Integer . parseInt ( denied ) , Integer . parseInt ( flags ) ) ...
Creates a new access control entry and stores it for later write out .
21,487
public static String getStateKey ( CmsResourceState state ) { StringBuffer sb = new StringBuffer ( STATE_PREFIX ) ; sb . append ( state ) ; sb . append ( STATE_POSTFIX ) ; return sb . toString ( ) ; }
Create constant name .
21,488
public static Button createPublishButton ( final I_CmsUpdateListener < String > updateListener ) { Button publishButton = CmsToolBar . createButton ( FontOpenCms . PUBLISH , CmsVaadinUtils . getMessageText ( Messages . GUI_PUBLISH_BUTTON_TITLE_0 ) ) ; if ( CmsAppWorkplaceUi . isOnlineProject ( ) ) { publishButton . set...
Creates the publish button .
21,489
Map < Object , Object > getFilters ( ) { Map < Object , Object > result = new HashMap < Object , Object > ( 4 ) ; result . put ( TableProperty . KEY , m_table . getFilterFieldValue ( TableProperty . KEY ) ) ; result . put ( TableProperty . DEFAULT , m_table . getFilterFieldValue ( TableProperty . DEFAULT ) ) ; result ....
Returns the currently set filters in a map column - > filter .
21,490
void saveAction ( ) { Map < Object , Object > filters = getFilters ( ) ; m_table . clearFilters ( ) ; try { m_model . save ( ) ; disableSaveButtons ( ) ; } catch ( CmsException e ) { LOG . error ( m_messages . key ( Messages . ERR_SAVING_CHANGES_0 ) , e ) ; CmsErrorDialog . showErrorDialog ( m_messages . key ( Messages...
Save the changes .
21,491
void setFilters ( Map < Object , Object > filters ) { for ( Object column : filters . keySet ( ) ) { Object filterValue = filters . get ( column ) ; if ( ( filterValue != null ) && ! filterValue . toString ( ) . isEmpty ( ) && ! m_table . isColumnCollapsed ( column ) ) { m_table . setFilterFieldValue ( column , filterV...
Sets the provided filters .
21,492
private void adjustOptionsColumn ( CmsMessageBundleEditorTypes . EditMode oldMode , CmsMessageBundleEditorTypes . EditMode newMode ) { if ( m_model . isShowOptionsColumn ( oldMode ) != m_model . isShowOptionsColumn ( newMode ) ) { m_table . removeGeneratedColumn ( TableProperty . OPTIONS ) ; if ( m_model . isShowOption...
Show or hide the options column dependent on the provided edit mode .
21,493
private void adjustVisibleColumns ( ) { if ( m_table . isColumnCollapsingAllowed ( ) ) { if ( ( m_model . hasDefaultValues ( ) ) || m_model . getBundleType ( ) . equals ( BundleType . DESCRIPTOR ) ) { m_table . setColumnCollapsed ( TableProperty . DEFAULT , false ) ; } else { m_table . setColumnCollapsed ( TablePropert...
Adjust the visible columns .
21,494
private void cleanUpAction ( ) { try { m_model . deleteDescriptorIfNecessary ( ) ; } catch ( CmsException e ) { LOG . error ( m_messages . key ( Messages . ERR_DELETING_DESCRIPTOR_0 ) , e ) ; } m_model . unlock ( ) ; }
Unlock all edited resources .
21,495
@ SuppressWarnings ( "serial" ) private Component createAddDescriptorButton ( ) { Button addDescriptorButton = CmsToolBar . createButton ( FontOpenCms . COPY_LOCALE , m_messages . key ( Messages . GUI_ADD_DESCRIPTOR_0 ) ) ; addDescriptorButton . setDisableOnClick ( true ) ; addDescriptorButton . addClickListener ( new ...
Returns a button component . On click it triggers adding a bundle descriptor .
21,496
@ SuppressWarnings ( "serial" ) private Component createCloseButton ( ) { Button closeBtn = CmsToolBar . createButton ( FontOpenCms . CIRCLE_INV_CANCEL , m_messages . key ( Messages . GUI_BUTTON_CANCEL_0 ) ) ; closeBtn . addClickListener ( new ClickListener ( ) { public void buttonClick ( ClickEvent event ) { closeActi...
Create the close button UI Component .
21,497
private Component createConvertToPropertyBundleButton ( ) { Button addDescriptorButton = CmsToolBar . createButton ( FontOpenCms . SETTINGS , m_messages . key ( Messages . GUI_CONVERT_TO_PROPERTY_BUNDLE_0 ) ) ; addDescriptorButton . setDisableOnClick ( true ) ; addDescriptorButton . addClickListener ( new ClickListener...
Creates the button for converting an XML bundle in a property bundle .
21,498
private Component createMainComponent ( ) throws IOException , CmsException { VerticalLayout mainComponent = new VerticalLayout ( ) ; mainComponent . setSizeFull ( ) ; mainComponent . addStyleName ( "o-message-bundle-editor" ) ; m_table = createTable ( ) ; Panel navigator = new Panel ( ) ; navigator . setSizeFull ( ) ;...
Creates the main component of the editor with all sub - components .
21,499
@ SuppressWarnings ( "serial" ) private Button createSaveExitButton ( ) { Button saveExitBtn = CmsToolBar . createButton ( FontOpenCms . SAVE_EXIT , m_messages . key ( Messages . GUI_BUTTON_SAVE_AND_EXIT_0 ) ) ; saveExitBtn . addClickListener ( new ClickListener ( ) { public void buttonClick ( ClickEvent event ) { save...
Creates the save and exit button UI Component .