idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
145,000
protected String getBasePath ( String rootPath ) { if ( rootPath . endsWith ( INHERITANCE_CONFIG_FILE_NAME ) ) { return rootPath . substring ( 0 , rootPath . length ( ) - INHERITANCE_CONFIG_FILE_NAME . length ( ) ) ; } return rootPath ; }
Returns the base path for a given configuration file .
72
10
145,001
public static String getStringOption ( Map < String , String > configOptions , String optionKey , String defaultValue ) { String result = configOptions . get ( optionKey ) ; return null != result ? result : defaultValue ; }
Returns the value of an option or the default if the value is null or the key is not part of the map .
48
24
145,002
private String generateValue ( ) { String result = "" ; for ( CmsCheckBox checkbox : m_checkboxes ) { if ( checkbox . isChecked ( ) ) { result += checkbox . getInternalValue ( ) + "," ; } } if ( result . contains ( "," ) ) { result = result . substring ( 0 , result . lastIndexOf ( "," ) ) ; } return result ; }
Generate a string with all selected checkboxes separated with .
91
12
145,003
protected void runQuery ( ) { String pool = m_pool . getValue ( ) ; String stmt = m_script . getValue ( ) ; if ( stmt . trim ( ) . isEmpty ( ) ) { return ; } CmsStringBufferReport report = new CmsStringBufferReport ( Locale . ENGLISH ) ; List < Throwable > errors = new ArrayList <> ( ) ; CmsSqlConsoleResults result = m_console . execute ( stmt , pool , report , errors ) ; if ( errors . size ( ) > 0 ) { CmsErrorDialog . showErrorDialog ( report . toString ( ) + errors . get ( 0 ) . getMessage ( ) , errors . get ( 0 ) ) ; } else { Window window = CmsBasicDialog . prepareWindow ( DialogWidth . max ) ; window . setCaption ( CmsVaadinUtils . getMessageText ( Messages . GUI_SQLCONSOLE_QUERY_RESULTS_0 ) ) ; window . setContent ( new CmsSqlConsoleResultsForm ( result , report . toString ( ) ) ) ; A_CmsUI . get ( ) . addWindow ( window ) ; window . center ( ) ; } }
Runs the currently entered query and displays the results .
265
11
145,004
public static Resource getSetupPage ( I_SetupUiContext context , String name ) { String path = CmsStringUtil . joinPaths ( context . getSetupBean ( ) . getContextPath ( ) , CmsSetupBean . FOLDER_SETUP , name ) ; Resource resource = new ExternalResource ( path ) ; return resource ; }
Gets external resource for an HTML page in the setup - resources folder .
77
15
145,005
protected void showStep ( A_CmsSetupStep step ) { Window window = newWindow ( ) ; window . setContent ( step ) ; window . setCaption ( step . getTitle ( ) ) ; A_CmsUI . get ( ) . addWindow ( window ) ; window . center ( ) ; }
Shows the given step .
67
6
145,006
protected void updateStep ( int stepNo ) { if ( ( 0 <= stepNo ) && ( stepNo < m_steps . size ( ) ) ) { Class < ? extends A_CmsSetupStep > cls = m_steps . get ( stepNo ) ; A_CmsSetupStep step ; try { step = cls . getConstructor ( I_SetupUiContext . class ) . newInstance ( this ) ; showStep ( step ) ; m_stepNo = stepNo ; // Only update step number if no exceptions } catch ( Exception e ) { CmsSetupErrorDialog . showErrorDialog ( e ) ; } } }
Moves to the step with the given number .
137
10
145,007
protected void appendFacetOption ( StringBuffer query , final String name , final String value ) { query . append ( " facet." ) . append ( name ) . append ( "=" ) . append ( value ) ; }
Appends the query part for the facet to the query string .
46
13
145,008
public void setEditedFilePath ( final String editedFilePath ) { m_filePathField . setReadOnly ( false ) ; m_filePathField . setValue ( editedFilePath ) ; m_filePathField . setReadOnly ( true ) ; }
Sets the path of the edited file in the corresponding display .
55
13
145,009
public void updateShownOptions ( boolean showModeSwitch , boolean showAddKeyOption ) { if ( showModeSwitch != m_showModeSwitch ) { m_upperLeftComponent . removeAllComponents ( ) ; m_upperLeftComponent . addComponent ( m_languageSwitch ) ; if ( showModeSwitch ) { m_upperLeftComponent . addComponent ( m_modeSwitch ) ; } m_upperLeftComponent . addComponent ( m_filePathLabel ) ; m_showModeSwitch = showModeSwitch ; } if ( showAddKeyOption != m_showAddKeyOption ) { if ( showAddKeyOption ) { m_optionsComponent . addComponent ( m_lowerLeftComponent , 0 , 1 ) ; m_optionsComponent . addComponent ( m_lowerRightComponent , 1 , 1 ) ; } else { m_optionsComponent . removeComponent ( 0 , 1 ) ; m_optionsComponent . removeComponent ( 1 , 1 ) ; } m_showAddKeyOption = showAddKeyOption ; } }
Update which options are shown .
215
6
145,010
void handleAddKey ( ) { String key = m_addKeyInput . getValue ( ) ; if ( m_listener . handleAddKey ( key ) ) { Notification . show ( key . isEmpty ( ) ? m_messages . key ( Messages . GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_EMPTY_KEY_SUCCESSFULLY_ADDED_0 ) : m_messages . key ( Messages . GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_SUCCESSFULLY_ADDED_1 , key ) ) ; } else { CmsMessageBundleEditorTypes . showWarning ( m_messages . key ( Messages . GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_ALREADEY_EXISTS_CAPTION_0 ) , m_messages . key ( Messages . GUI_NOTIFICATION_MESSAGEBUNDLEEDITOR_KEY_ALREADEY_EXISTS_DESCRIPTION_1 , key ) ) ; } m_addKeyInput . focus ( ) ; m_addKeyInput . selectAll ( ) ; }
Handles adding a key . Calls the registered listener and wraps it s method in some GUI adjustments .
259
20
145,011
void setLanguage ( final Locale locale ) { if ( ! m_languageSelect . getValue ( ) . equals ( locale ) ) { m_languageSelect . setValue ( locale ) ; } }
Sets the currently edited locale .
42
7
145,012
private Component createAddKeyButton ( ) { // the "+" button Button addKeyButton = new Button ( ) ; addKeyButton . addStyleName ( "icon-only" ) ; addKeyButton . addStyleName ( "borderless-colored" ) ; addKeyButton . setDescription ( m_messages . key ( Messages . GUI_ADD_KEY_0 ) ) ; addKeyButton . setIcon ( FontOpenCms . CIRCLE_PLUS , m_messages . key ( Messages . GUI_ADD_KEY_0 ) ) ; addKeyButton . addClickListener ( new ClickListener ( ) { private static final long serialVersionUID = 1L ; public void buttonClick ( ClickEvent event ) { handleAddKey ( ) ; } } ) ; return addKeyButton ; }
Creates the Add key button .
170
7
145,013
private void initModeSwitch ( final EditMode current ) { FormLayout modes = new FormLayout ( ) ; modes . setHeight ( "100%" ) ; modes . setDefaultComponentAlignment ( Alignment . MIDDLE_LEFT ) ; m_modeSelect = new ComboBox ( ) ; m_modeSelect . setCaption ( m_messages . key ( Messages . GUI_VIEW_SWITCHER_LABEL_0 ) ) ; // add Modes m_modeSelect . addItem ( CmsMessageBundleEditorTypes . EditMode . DEFAULT ) ; m_modeSelect . setItemCaption ( CmsMessageBundleEditorTypes . EditMode . DEFAULT , m_messages . key ( Messages . GUI_VIEW_SWITCHER_EDITMODE_DEFAULT_0 ) ) ; m_modeSelect . addItem ( CmsMessageBundleEditorTypes . EditMode . MASTER ) ; m_modeSelect . setItemCaption ( CmsMessageBundleEditorTypes . EditMode . MASTER , m_messages . key ( Messages . GUI_VIEW_SWITCHER_EDITMODE_MASTER_0 ) ) ; // set current mode as selected m_modeSelect . setValue ( current ) ; m_modeSelect . setNewItemsAllowed ( false ) ; m_modeSelect . setTextInputAllowed ( false ) ; m_modeSelect . setNullSelectionAllowed ( false ) ; m_modeSelect . addValueChangeListener ( new ValueChangeListener ( ) { private static final long serialVersionUID = 1L ; public void valueChange ( ValueChangeEvent event ) { m_listener . handleModeChange ( ( EditMode ) event . getProperty ( ) . getValue ( ) ) ; } } ) ; modes . addComponent ( m_modeSelect ) ; m_modeSwitch = modes ; }
Initializes the mode switcher .
394
7
145,014
private void initUpperLeftComponent ( ) { m_upperLeftComponent = new HorizontalLayout ( ) ; m_upperLeftComponent . setHeight ( "100%" ) ; m_upperLeftComponent . setSpacing ( true ) ; m_upperLeftComponent . setDefaultComponentAlignment ( Alignment . MIDDLE_RIGHT ) ; m_upperLeftComponent . addComponent ( m_languageSwitch ) ; m_upperLeftComponent . addComponent ( m_filePathLabel ) ; }
Initializes the upper left component . Does not show the mode switch .
105
14
145,015
public CmsScheduledJobInfo getJob ( String id ) { Iterator < CmsScheduledJobInfo > it = m_jobs . iterator ( ) ; while ( it . hasNext ( ) ) { CmsScheduledJobInfo job = it . next ( ) ; if ( job . getId ( ) . equals ( id ) ) { return job ; } } // not found return null ; }
Returns the currently scheduled job description identified by the given id .
88
12
145,016
@ UiHandler ( { "m_atMonth" , "m_everyMonth" } ) void onMonthChange ( ValueChangeEvent < String > event ) { if ( handleChange ( ) ) { m_controller . setMonth ( event . getValue ( ) ) ; } }
Handler for month changes .
60
5
145,017
@ UiHandler ( "m_atNumber" ) void onWeekOfMonthChange ( ValueChangeEvent < String > event ) { if ( handleChange ( ) ) { m_controller . setWeekOfMonth ( event . getValue ( ) ) ; } }
Handler for week of month changes .
55
7
145,018
public CmsResource buildResource ( ) { return new CmsResource ( m_structureId , m_resourceId , m_rootPath , m_type , m_flags , m_projectLastModified , m_state , m_dateCreated , m_userCreated , m_dateLastModified , m_userLastModified , m_dateReleased , m_dateExpired , m_length , m_flags , m_dateContent , m_version ) ; }
Builds the resource .
104
5
145,019
public List < CmsProject > getAllAccessibleProjects ( CmsObject cms , String ouFqn , boolean includeSubOus ) throws CmsException { CmsOrganizationalUnit orgUnit = readOrganizationalUnit ( cms , ouFqn ) ; return ( m_securityManager . getAllAccessibleProjects ( cms . getRequestContext ( ) , orgUnit , includeSubOus ) ) ; }
Returns all accessible projects of the given organizational unit .
95
10
145,020
public CmsJspDateSeriesBean getToDateSeries ( ) { if ( m_dateSeries == null ) { m_dateSeries = new CmsJspDateSeriesBean ( this , m_cms . getRequestContext ( ) . getLocale ( ) ) ; } return m_dateSeries ; }
Converts a date series configuration to a date series bean .
68
12
145,021
public void copyPageOnly ( CmsResource originalPage , String targetPageRootPath ) throws CmsException , NoCustomReplacementException { if ( ( null == originalPage ) || ! OpenCms . getResourceManager ( ) . getResourceType ( originalPage ) . getTypeName ( ) . equals ( CmsResourceTypeXmlContainerPage . getStaticTypeName ( ) ) ) { throw new CmsException ( new CmsMessageContainer ( Messages . get ( ) , Messages . ERR_PAGECOPY_INVALID_PAGE_0 ) ) ; } m_originalPage = originalPage ; CmsObject rootCms = getRootCms ( ) ; rootCms . copyResource ( originalPage . getRootPath ( ) , targetPageRootPath ) ; CmsResource copiedPage = rootCms . readResource ( targetPageRootPath , CmsResourceFilter . IGNORE_EXPIRATION ) ; m_targetFolder = rootCms . readResource ( CmsResource . getFolderPath ( copiedPage . getRootPath ( ) ) ) ; replaceElements ( copiedPage ) ; attachLocaleGroups ( copiedPage ) ; tryUnlock ( copiedPage ) ; }
Copies the given container page to the provided root path .
257
12
145,022
private void attachLocaleGroups ( CmsResource copiedPage ) throws CmsException { CmsLocaleGroupService localeGroupService = getRootCms ( ) . getLocaleGroupService ( ) ; if ( Status . linkable == localeGroupService . checkLinkable ( m_originalPage , copiedPage ) ) { try { localeGroupService . attachLocaleGroupIndirect ( m_originalPage , copiedPage ) ; } catch ( CmsException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } }
Attaches locale groups to the copied page .
119
9
145,023
protected List < CmsUUID > undelete ( ) throws CmsException { List < CmsUUID > modifiedResources = new ArrayList < CmsUUID > ( ) ; CmsObject cms = m_context . getCms ( ) ; for ( CmsResource resource : m_context . getResources ( ) ) { CmsLockActionRecord actionRecord = null ; try { actionRecord = CmsLockUtil . ensureLock ( m_context . getCms ( ) , resource ) ; cms . undeleteResource ( cms . getSitePath ( resource ) , true ) ; modifiedResources . add ( resource . getStructureId ( ) ) ; } finally { if ( ( actionRecord != null ) && ( actionRecord . getChange ( ) == LockChange . locked ) ) { try { cms . unlockResource ( resource ) ; } catch ( CmsLockException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; } } } } return modifiedResources ; }
Undeletes the selected files
218
6
145,024
protected void importUserFromFile ( ) { CmsImportUserThread thread = new CmsImportUserThread ( m_cms , m_ou , m_userImportList , getGroupsList ( m_importGroups , true ) , getRolesList ( m_importRoles , true ) , m_sendMail . getValue ( ) . booleanValue ( ) ) ; thread . start ( ) ; CmsShowReportDialog dialog = new CmsShowReportDialog ( thread , new Runnable ( ) { public void run ( ) { m_window . close ( ) ; } } ) ; m_window . setContent ( dialog ) ; }
Import user from file .
139
5
145,025
private void toCorrectDateWithDay ( Calendar date , WeekOfMonth week ) { date . set ( Calendar . DAY_OF_MONTH , 1 ) ; int daysToFirstWeekDayMatch = ( ( m_weekDay . toInt ( ) + I_CmsSerialDateValue . NUM_OF_WEEKDAYS ) - ( date . get ( Calendar . DAY_OF_WEEK ) ) ) % I_CmsSerialDateValue . NUM_OF_WEEKDAYS ; date . add ( Calendar . DAY_OF_MONTH , daysToFirstWeekDayMatch ) ; int wouldBeDayOfMonth = date . get ( Calendar . DAY_OF_MONTH ) + ( ( week . ordinal ( ) ) * I_CmsSerialDateValue . NUM_OF_WEEKDAYS ) ; if ( wouldBeDayOfMonth > date . getActualMaximum ( Calendar . DAY_OF_MONTH ) ) { date . set ( Calendar . DAY_OF_MONTH , wouldBeDayOfMonth - I_CmsSerialDateValue . NUM_OF_WEEKDAYS ) ; } else { date . set ( Calendar . DAY_OF_MONTH , wouldBeDayOfMonth ) ; } }
Sets the day of the month that matches the condition i . e . the day of month of the 2nd Saturday . If the day does not exist in the current month the last possible date is set i . e . instead of the fifth Saturday the fourth is chosen .
263
55
145,026
private void toNextDate ( Calendar date , int interval ) { long previousDate = date . getTimeInMillis ( ) ; if ( ! m_weekOfMonthIterator . hasNext ( ) ) { date . add ( Calendar . MONTH , interval ) ; m_weekOfMonthIterator = m_weeksOfMonth . iterator ( ) ; } toCorrectDateWithDay ( date , m_weekOfMonthIterator . next ( ) ) ; if ( previousDate == date . getTimeInMillis ( ) ) { // this can happen if the fourth and the last week are checked. toNextDate ( date ) ; } }
Calculates the next date starting from the provided date .
133
12
145,027
public static boolean isResourceTypeIdFree ( int id ) { try { OpenCms . getResourceManager ( ) . getResourceType ( id ) ; } catch ( CmsLoaderException e ) { return true ; } return false ; }
Is the given resource type id free?
50
8
145,028
protected Map < String , String > getGalleryOpenParams ( CmsObject cms , CmsMessages messages , I_CmsWidgetParameter param , String resource , long hashId ) { Map < String , String > result = new HashMap < String , String > ( ) ; result . put ( I_CmsGalleryProviderConstants . CONFIG_GALLERY_MODE , A_CmsAjaxGallery . MODE_WIDGET ) ; result . put ( I_CmsGalleryProviderConstants . CONFIG_GALLERY_STORAGE_PREFIX , getGalleryStoragePrefix ( ) ) ; result . put ( I_CmsGalleryProviderConstants . CONFIG_RESOURCE_TYPES , getGalleryTypes ( ) ) ; if ( param . getId ( ) != null ) { result . put ( I_CmsGalleryProviderConstants . KEY_FIELD_ID , param . getId ( ) ) ; // use javascript to read the current field value result . put ( I_CmsGalleryProviderConstants . CONFIG_CURRENT_ELEMENT , "'+document.getElementById('" + param . getId ( ) + "').getAttribute('value')+'" ) ; } result . put ( I_CmsGalleryProviderConstants . KEY_HASH_ID , "" + hashId ) ; // the edited resource if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( resource ) ) { result . put ( I_CmsGalleryProviderConstants . CONFIG_REFERENCE_PATH , resource ) ; } // the start up gallery path CmsGalleryWidgetConfiguration configuration = getWidgetConfiguration ( cms , messages , param ) ; if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( configuration . getStartup ( ) ) ) { result . put ( I_CmsGalleryProviderConstants . CONFIG_GALLERY_PATH , configuration . getStartup ( ) ) ; } // set gallery types if available if ( CmsStringUtil . isNotEmptyOrWhitespaceOnly ( configuration . getGalleryTypes ( ) ) ) { result . put ( I_CmsGalleryProviderConstants . CONFIG_GALLERY_TYPES , configuration . getGalleryTypes ( ) ) ; } result . put ( I_CmsGalleryProviderConstants . CONFIG_GALLERY_NAME , getGalleryName ( ) ) ; return result ; }
Returns the required gallery open parameters .
519
7
145,029
protected I_CmsSearchDocument appendFieldMappingsFromElementsOnThePage ( I_CmsSearchDocument document , CmsObject cms , CmsResource resource , List < String > systemFields ) { try { CmsFile file = cms . readFile ( resource ) ; CmsXmlContainerPage containerPage = CmsXmlContainerPageFactory . unmarshal ( cms , file ) ; CmsContainerPageBean containerBean = containerPage . getContainerPage ( cms ) ; if ( containerBean != null ) { for ( CmsContainerElementBean element : containerBean . getElements ( ) ) { element . initResource ( cms ) ; CmsResource elemResource = element . getResource ( ) ; Set < CmsSearchField > mappedFields = getXSDMappingsForPage ( cms , elemResource ) ; if ( mappedFields != null ) { for ( CmsSearchField field : mappedFields ) { if ( ! systemFields . contains ( field . getName ( ) ) ) { document = appendFieldMapping ( document , field , cms , elemResource , CmsSolrDocumentXmlContent . extractXmlContent ( cms , elemResource , getIndex ( ) ) , cms . readPropertyObjects ( resource , false ) , cms . readPropertyObjects ( resource , true ) ) ; } else { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_SOLR_ERR_MAPPING_TO_INTERNALLY_USED_FIELD_3 , elemResource . getRootPath ( ) , field . getName ( ) , resource . getRootPath ( ) ) ) ; } } } } } } catch ( CmsException e ) { // Should be thrown if element on the page does not exist anymore - this is possible, but not necessarily an error. // Hence, just notice it in the debug log. if ( LOG . isDebugEnabled ( ) ) { LOG . debug ( e . getLocalizedMessage ( ) , e ) ; } } return document ; }
Adds search fields from elements on a container page to a container page s document .
460
16
145,030
public void clearHandlers ( ) { for ( Map < String , CmsAttributeHandler > handlers : m_handlers ) { for ( CmsAttributeHandler handler : handlers . values ( ) ) { handler . clearHandlers ( ) ; } handlers . clear ( ) ; } m_handlers . clear ( ) ; m_handlers . add ( new HashMap < String , CmsAttributeHandler > ( ) ) ; m_handlerById . clear ( ) ; }
Clears the handler hierarchy .
99
6
145,031
public void setDates ( SortedSet < Date > dates , boolean checked ) { m_checkBoxes . clear ( ) ; for ( Date date : dates ) { CmsCheckBox cb = generateCheckBox ( date , checked ) ; m_checkBoxes . add ( cb ) ; } reInitLayoutElements ( ) ; setDatesInternal ( dates ) ; }
Sets all dates in the list .
82
8
145,032
public void setDatesWithCheckState ( Collection < CmsPair < Date , Boolean > > datesWithCheckInfo ) { SortedSet < Date > dates = new TreeSet <> ( ) ; m_checkBoxes . clear ( ) ; for ( CmsPair < Date , Boolean > p : datesWithCheckInfo ) { addCheckBox ( p . getFirst ( ) , p . getSecond ( ) . booleanValue ( ) ) ; dates . add ( p . getFirst ( ) ) ; } reInitLayoutElements ( ) ; setDatesInternal ( dates ) ; }
Set dates with the provided check states .
126
8
145,033
private void addCheckBox ( Date date , boolean checkState ) { CmsCheckBox cb = generateCheckBox ( date , checkState ) ; m_checkBoxes . add ( cb ) ; reInitLayoutElements ( ) ; }
Add a new check box .
52
6
145,034
private void addDateWithCheckState ( Date date , boolean checkState ) { addCheckBox ( date , checkState ) ; if ( ! m_dates . contains ( date ) ) { m_dates . add ( date ) ; fireValueChange ( ) ; } }
Add a date with a certain check state .
56
9
145,035
private CmsCheckBox generateCheckBox ( Date date , boolean checkState ) { CmsCheckBox cb = new CmsCheckBox ( ) ; cb . setText ( m_dateFormat . format ( date ) ) ; cb . setChecked ( checkState ) ; cb . getElement ( ) . setPropertyObject ( "date" , date ) ; return cb ; }
Generate a new check box with the provided date and check state .
84
14
145,036
private void reInitLayoutElements ( ) { m_panel . clear ( ) ; for ( CmsCheckBox cb : m_checkBoxes ) { m_panel . add ( setStyle ( m_onlyLabels ? new Label ( cb . getText ( ) ) : cb ) ) ; } }
Refresh the layout element .
68
6
145,037
private void setDatesInternal ( SortedSet < Date > dates ) { if ( ! m_dates . equals ( dates ) ) { m_dates = new TreeSet <> ( dates ) ; fireValueChange ( ) ; } }
Updates the internal list of dates and fires a value change if necessary .
50
15
145,038
private Widget setStyle ( Widget widget ) { widget . setWidth ( m_width ) ; widget . getElement ( ) . getStyle ( ) . setDisplay ( Display . INLINE_BLOCK ) ; return widget ; }
Set the style for the widgets in the panel according to the chosen style option .
49
16
145,039
private List < CmsResource > getDetailContainerResources ( CmsObject cms , CmsResource res ) throws CmsException { CmsRelationFilter filter = CmsRelationFilter . relationsFromStructureId ( res . getStructureId ( ) ) . filterType ( CmsRelationType . DETAIL_ONLY ) ; List < CmsResource > result = Lists . newArrayList ( ) ; List < CmsRelation > relations = cms . readRelations ( filter ) ; for ( CmsRelation relation : relations ) { try { result . add ( relation . getTarget ( cms , CmsResourceFilter . ALL ) ) ; } catch ( Exception e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } return result ; }
Reads the detail container resources which are connected by relations to the given resource .
172
16
145,040
private List < I_CmsSearchFieldMapping > getMappings ( ) { CmsSearchManager manager = OpenCms . getSearchManager ( ) ; I_CmsSearchFieldConfiguration fieldConfig = manager . getFieldConfiguration ( getParamFieldconfiguration ( ) ) ; CmsLuceneField field ; List < I_CmsSearchFieldMapping > result = null ; Iterator < CmsSearchField > itFields ; if ( fieldConfig != null ) { itFields = fieldConfig . getFields ( ) . iterator ( ) ; while ( itFields . hasNext ( ) ) { field = ( CmsLuceneField ) itFields . next ( ) ; if ( field . getName ( ) . equals ( getParamField ( ) ) ) { result = field . getMappings ( ) ; } } } else { result = Collections . emptyList ( ) ; if ( LOG . isErrorEnabled ( ) ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_SEARCHINDEX_EDIT_MISSING_PARAM_1 , A_CmsFieldConfigurationDialog . PARAM_FIELDCONFIGURATION ) ) ; } } return result ; }
Returns the configured mappings of the current field .
267
10
145,041
public static void showErrorDialog ( String message , String details ) { Window window = prepareWindow ( DialogWidth . wide ) ; window . setCaption ( "Error" ) ; window . setContent ( new CmsSetupErrorDialog ( message , details , null , window ) ) ; A_CmsUI . get ( ) . addWindow ( window ) ; }
Shows error dialog manually supplying details instead of getting them from an exception stack trace .
77
17
145,042
protected Object getMacroBeanValue ( Object bean , String property ) { Object result = null ; if ( ( bean != null ) && CmsStringUtil . isNotEmptyOrWhitespaceOnly ( property ) ) { try { PropertyUtilsBean propBean = BeanUtilsBean . getInstance ( ) . getPropertyUtils ( ) ; result = propBean . getProperty ( bean , property ) ; } catch ( Exception e ) { LOG . error ( "Unable to access property '" + property + "' of '" + bean + "'." , e ) ; } } else { LOG . info ( "Invalid parameters: property='" + property + "' bean='" + bean + "'." ) ; } return result ; }
Returns the property value read from the given JavaBean .
160
12
145,043
public void setEndTime ( final Date date ) { if ( ! Objects . equals ( m_model . getEnd ( ) , date ) ) { m_model . setEnd ( date ) ; valueChanged ( ) ; } }
Set the end time .
48
5
145,044
public void setEndType ( final String value ) { final EndType endType = EndType . valueOf ( value ) ; if ( ! endType . equals ( m_model . getEndType ( ) ) ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { switch ( endType ) { case SINGLE : m_model . setOccurrences ( 0 ) ; m_model . setSeriesEndDate ( null ) ; break ; case TIMES : m_model . setOccurrences ( 10 ) ; m_model . setSeriesEndDate ( null ) ; break ; case DATE : m_model . setOccurrences ( 0 ) ; m_model . setSeriesEndDate ( m_model . getStart ( ) == null ? new Date ( ) : m_model . getStart ( ) ) ; break ; default : break ; } m_model . setEndType ( endType ) ; valueChanged ( ) ; } } ) ; } }
Set the duration option .
211
5
145,045
public void setIsSeries ( Boolean isSeries ) { if ( null != isSeries ) { final boolean series = isSeries . booleanValue ( ) ; if ( ( null != m_model . getParentSeriesId ( ) ) && series ) { m_removeSeriesBindingConfirmDialog . show ( new Command ( ) { public void execute ( ) { m_model . setParentSeriesId ( null ) ; setPattern ( PatternType . DAILY . toString ( ) ) ; } } ) ; } else { setPattern ( series ? PatternType . DAILY . toString ( ) : PatternType . NONE . toString ( ) ) ; } } }
Toggle between single events and series .
139
8
145,046
public void setOccurrences ( String occurrences ) { int o = CmsSerialDateUtil . toIntWithDefault ( occurrences , - 1 ) ; if ( m_model . getOccurrences ( ) != o ) { m_model . setOccurrences ( o ) ; valueChanged ( ) ; } }
Set the occurrences . If the String is invalid the occurrences will be set to - 1 to cause server - side validation to fail .
67
26
145,047
public void setPattern ( String patternType ) { final PatternType type = PatternType . valueOf ( patternType ) ; if ( type != m_model . getPatternType ( ) ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { EndType oldEndType = m_model . getEndType ( ) ; m_model . setPatternType ( type ) ; m_model . setIndividualDates ( null ) ; m_model . setInterval ( getPatternDefaultValues ( ) . getInterval ( ) ) ; m_model . setEveryWorkingDay ( Boolean . FALSE ) ; m_model . clearWeekDays ( ) ; m_model . clearIndividualDates ( ) ; m_model . clearWeeksOfMonth ( ) ; m_model . clearExceptions ( ) ; if ( type . equals ( PatternType . NONE ) || type . equals ( PatternType . INDIVIDUAL ) ) { m_model . setEndType ( EndType . SINGLE ) ; } else if ( oldEndType . equals ( EndType . SINGLE ) ) { m_model . setEndType ( EndType . TIMES ) ; m_model . setOccurrences ( 10 ) ; m_model . setSeriesEndDate ( null ) ; } m_model . setDayOfMonth ( getPatternDefaultValues ( ) . getDayOfMonth ( ) ) ; m_model . setMonth ( getPatternDefaultValues ( ) . getMonth ( ) ) ; if ( type . equals ( PatternType . WEEKLY ) ) { m_model . setWeekDay ( getPatternDefaultValues ( ) . getWeekDay ( ) ) ; } valueChanged ( ) ; } } ) ; } }
Set the serial pattern type .
369
6
145,048
public void setSeriesEndDate ( Date date ) { if ( ! Objects . equals ( m_model . getSeriesEndDate ( ) , date ) ) { m_model . setSeriesEndDate ( date ) ; valueChanged ( ) ; } }
Set the serial end date .
52
6
145,049
public void setStartTime ( final Date date ) { if ( ! Objects . equals ( m_model . getStart ( ) , date ) ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setStart ( date ) ; setPatternDefaultValues ( date ) ; valueChanged ( ) ; } } ) ; } }
Set the start time .
77
5
145,050
public void setWholeDay ( Boolean isWholeDay ) { if ( m_model . isWholeDay ( ) ^ ( ( null != isWholeDay ) && isWholeDay . booleanValue ( ) ) ) { m_model . setWholeDay ( isWholeDay ) ; valueChanged ( ) ; } }
Sets the whole day flag .
71
7
145,051
public void updateExceptions ( SortedSet < Date > exceptions ) { SortedSet < Date > e = null == exceptions ? new TreeSet < Date > ( ) : exceptions ; if ( ! m_model . getExceptions ( ) . equals ( e ) ) { m_model . setExceptions ( e ) ; m_view . updateExceptions ( ) ; valueChanged ( ) ; sizeChanged ( ) ; } }
Updates the exceptions .
90
5
145,052
I_CmsSerialDateServiceAsync getService ( ) { if ( SERVICE == null ) { SERVICE = GWT . create ( I_CmsSerialDateService . class ) ; String serviceUrl = CmsCoreProvider . get ( ) . link ( "org.opencms.ade.contenteditor.CmsSerialDateService.gwt" ) ; ( ( ServiceDefTarget ) SERVICE ) . setServiceEntryPoint ( serviceUrl ) ; } return SERVICE ; }
Returns the RPC service for serial dates .
99
8
145,053
void setPatternDefaultValues ( Date startDate ) { if ( ( m_patternDefaultValues == null ) || ! Objects . equals ( m_patternDefaultValues . getDate ( ) , startDate ) ) { m_patternDefaultValues = new PatternDefaultValues ( startDate ) ; } }
Sets the default pattern values dependent on the provided start date .
61
13
145,054
private void initPatternControllers ( ) { m_patternControllers . put ( PatternType . NONE , new CmsPatternPanelNoneController ( ) ) ; m_patternControllers . put ( PatternType . DAILY , new CmsPatternPanelDailyController ( m_model , this ) ) ; m_patternControllers . put ( PatternType . WEEKLY , new CmsPatternPanelWeeklyController ( m_model , this ) ) ; m_patternControllers . put ( PatternType . MONTHLY , new CmsPatternPanelMonthlyController ( m_model , this ) ) ; m_patternControllers . put ( PatternType . YEARLY , new CmsPatternPanelYearlyController ( m_model , this ) ) ; // m_patternControllers.put(PatternType.INDIVIDUAL, new CmsPatternPanelIndividualController(m_model, this)); }
Initialize the pattern controllers .
190
6
145,055
@ Override public void begin ( String namespace , String name , Attributes attributes ) throws Exception { // not now: 6.0.0 // digester.setLogger(CmsLog.getLog(digester.getClass())); // Push an array to capture the parameter values if necessary if ( m_paramCount > 0 ) { Object [ ] parameters = new Object [ m_paramCount ] ; for ( int i = 0 ; i < parameters . length ; i ++ ) { parameters [ i ] = null ; } getDigester ( ) . pushParams ( parameters ) ; } }
Process the start of this element .
125
7
145,056
public void setPublishQueueShutdowntime ( String publishQueueShutdowntime ) { if ( m_frozen ) { throw new CmsRuntimeException ( Messages . get ( ) . container ( Messages . ERR_CONFIG_FROZEN_0 ) ) ; } m_publishQueueShutdowntime = Integer . parseInt ( publishQueueShutdowntime ) ; }
Sets the publish queue shutdown time .
85
8
145,057
@ PrefMetadata ( type = CmsElementViewPreference . class ) public String getElementView ( ) { return m_settings . getAdditionalPreference ( CmsElementViewPreference . PREFERENCE_NAME , false ) ; }
Gets the element view .
51
6
145,058
@ PrefMetadata ( type = CmsHiddenBuiltinPreference . class ) public String getExplorerFileEntryOptions ( ) { if ( m_settings . getExplorerFileEntryOptions ( ) == null ) { return "" ; } else { return "" + m_settings . getExplorerFileEntryOptions ( ) ; } }
Gets the explorer file entry options .
70
8
145,059
@ PrefMetadata ( type = CmsTimeWarpPreference . class ) public String getTimeWarp ( ) { long warp = m_settings . getTimeWarp ( ) ; return warp < 0 ? "" : "" + warp ; // if timewarp < 0 (i.e. time warp is not set), use the empty string because we don't want the date selector widget to interpret the negative value }
Gets the time warp .
88
6
145,060
public void setTimeWarp ( String l ) { long warp = CmsContextInfo . CURRENT_TIME ; try { warp = Long . parseLong ( l ) ; } catch ( NumberFormatException e ) { // if parsing the time warp fails, it will be set to -1 (i.e. disabled) } m_settings . setTimeWarp ( warp ) ; }
Sets the time warp .
81
6
145,061
public final void setExceptions ( SortedSet < Date > dates ) { m_exceptions . clear ( ) ; if ( null != dates ) { m_exceptions . addAll ( dates ) ; } }
Set dates where the event should not take place even if they are part of the series .
45
18
145,062
public final void setIndividualDates ( SortedSet < Date > dates ) { m_individualDates . clear ( ) ; if ( null != dates ) { m_individualDates . addAll ( dates ) ; } for ( Date d : getExceptions ( ) ) { if ( ! m_individualDates . contains ( d ) ) { m_exceptions . remove ( d ) ; } } }
Set the individual dates where the event should take place .
87
11
145,063
public final void setWeekDay ( WeekDay weekDay ) { SortedSet < WeekDay > wds = new TreeSet <> ( ) ; if ( null != weekDay ) { wds . add ( weekDay ) ; } setWeekDays ( wds ) ; }
Set the week day the events should occur .
58
9
145,064
public final void setWeekDays ( SortedSet < WeekDay > weekDays ) { m_weekDays . clear ( ) ; if ( null != weekDays ) { m_weekDays . addAll ( weekDays ) ; } }
Set the week days the events should occur .
49
9
145,065
public final void setWeekOfMonth ( WeekOfMonth weekOfMonth ) { SortedSet < WeekOfMonth > woms = new TreeSet <> ( ) ; if ( null != weekOfMonth ) { woms . add ( weekOfMonth ) ; } setWeeksOfMonth ( woms ) ; }
Set the week of the month the events should occur .
66
11
145,066
public final void setWeeksOfMonth ( SortedSet < WeekOfMonth > weeksOfMonth ) { m_weeksOfMonth . clear ( ) ; if ( null != weeksOfMonth ) { m_weeksOfMonth . addAll ( weeksOfMonth ) ; } }
Set the weeks of the month the events should occur .
59
11
145,067
protected final boolean isDurationValid ( ) { if ( isValidEndTypeForPattern ( ) ) { switch ( getEndType ( ) ) { case DATE : return ( getStart ( ) . getTime ( ) < ( getSeriesEndDate ( ) . getTime ( ) + DAY_IN_MILLIS ) ) ; case TIMES : return getOccurrences ( ) > 0 ; case SINGLE : return true ; default : return false ; } } else { return false ; } }
Checks if the duration option is valid .
105
9
145,068
protected final boolean isPatternValid ( ) { switch ( getPatternType ( ) ) { case DAILY : return isEveryWorkingDay ( ) || isIntervalValid ( ) ; case WEEKLY : return isIntervalValid ( ) && isWeekDaySet ( ) ; case MONTHLY : return isIntervalValid ( ) && isWeekDaySet ( ) ? isWeekOfMonthSet ( ) : isDayOfMonthValid ( ) ; case YEARLY : return isMonthSet ( ) && isWeekDaySet ( ) ? isWeekOfMonthSet ( ) : isDayOfMonthValid ( ) ; case INDIVIDUAL : case NONE : return true ; default : return false ; } }
Checks if all values necessary for a specific pattern are valid .
146
13
145,069
protected final boolean isValidEndTypeForPattern ( ) { if ( getEndType ( ) == null ) { return false ; } switch ( getPatternType ( ) ) { case DAILY : case WEEKLY : case MONTHLY : case YEARLY : return ( getEndType ( ) . equals ( EndType . DATE ) || getEndType ( ) . equals ( EndType . TIMES ) ) ; case INDIVIDUAL : case NONE : return getEndType ( ) . equals ( EndType . SINGLE ) ; default : return false ; } }
Checks if the end type is valid for the set pattern type .
120
14
145,070
protected final void setDefaultValue ( ) { m_start = null ; m_end = null ; m_patterntype = PatternType . NONE ; m_dayOfMonth = 0 ; m_exceptions . clear ( ) ; m_individualDates . clear ( ) ; m_interval = 0 ; m_isEveryWorkingDay = false ; m_isWholeDay = false ; m_month = Month . JANUARY ; m_seriesEndDate = null ; m_seriesOccurrences = 0 ; m_weekDays . clear ( ) ; m_weeksOfMonth . clear ( ) ; m_endType = EndType . SINGLE ; m_parentSeriesId = null ; }
Sets the value to a default .
155
8
145,071
protected final void setDerivedEndType ( ) { m_endType = getPatternType ( ) . equals ( PatternType . NONE ) || getPatternType ( ) . equals ( PatternType . INDIVIDUAL ) ? EndType . SINGLE : null != getSeriesEndDate ( ) ? EndType . DATE : EndType . TIMES ; }
Set the end type as derived from other values .
77
10
145,072
public static String defaultHtml ( HttpServletRequest request ) { CmsObject cms = CmsFlexController . getController ( request ) . getCmsObject ( ) ; // We only want the big red warning in Offline mode if ( cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ) { return "<div><!--Dynamic function not configured--></div>" ; } else { Locale locale = OpenCms . getWorkplaceManager ( ) . getWorkplaceLocale ( cms ) ; String message = Messages . get ( ) . getBundle ( locale ) . key ( Messages . GUI_FUNCTION_DEFAULT_HTML_0 ) ; return "<div style=\"border: 2px solid red; padding: 10px;\">" + message + "</div>" ; } }
Returns the default output for functions without configured JSPs .
180
12
145,073
private static String getEncodedInstance ( String encodedResponse ) { if ( isReturnValue ( encodedResponse ) || isThrownException ( encodedResponse ) ) { return encodedResponse . substring ( 4 ) ; } return encodedResponse ; }
Returns a string that encodes the result of a method invocation . Effectively this just removes any headers from the encoded response .
49
25
145,074
protected < T > Request doInvoke ( ResponseReader responseReader , String methodName , RpcStatsContext statsContext , String requestData , AsyncCallback < T > callback ) { RequestBuilder rb = doPrepareRequestBuilderImpl ( responseReader , methodName , statsContext , requestData , callback ) ; try { return rb . send ( ) ; } catch ( RequestException ex ) { InvocationException iex = new InvocationException ( "Unable to initiate the asynchronous service invocation (" + methodName + ") -- check the network connection" , ex ) ; callback . onFailure ( iex ) ; } finally { if ( statsContext . isStatsAvailable ( ) ) { statsContext . stats ( statsContext . bytesStat ( methodName , requestData . length ( ) , "requestSent" ) ) ; } } return null ; }
Performs a remote service method invocation . This method is called by generated proxy classes .
178
17
145,075
protected < T > RequestBuilder doPrepareRequestBuilder ( ResponseReader responseReader , String methodName , RpcStatsContext statsContext , String requestData , AsyncCallback < T > callback ) { RequestBuilder rb = doPrepareRequestBuilderImpl ( responseReader , methodName , statsContext , requestData , callback ) ; return rb ; }
Configures a RequestBuilder to send an RPC request when the RequestBuilder is intended to be returned through the asynchronous proxy interface .
73
25
145,076
private < T > RequestBuilder doPrepareRequestBuilderImpl ( ResponseReader responseReader , String methodName , RpcStatsContext statsContext , String requestData , AsyncCallback < T > callback ) { if ( getServiceEntryPoint ( ) == null ) { throw new NoServiceEntryPointSpecifiedException ( ) ; } RequestCallback responseHandler = doCreateRequestCallback ( responseReader , methodName , statsContext , callback ) ; ensureRpcRequestBuilder ( ) ; rpcRequestBuilder . create ( getServiceEntryPoint ( ) ) ; rpcRequestBuilder . setCallback ( responseHandler ) ; // changed code rpcRequestBuilder . setSync ( isSync ( methodName ) ) ; // changed code rpcRequestBuilder . setContentType ( RPC_CONTENT_TYPE ) ; rpcRequestBuilder . setRequestData ( requestData ) ; rpcRequestBuilder . setRequestId ( statsContext . getRequestId ( ) ) ; return rpcRequestBuilder . finish ( ) ; }
Configures a RequestBuilder to send an RPC request .
206
11
145,077
private void deselectChildren ( CmsTreeItem item ) { for ( String childId : m_childrens . get ( item . getId ( ) ) ) { CmsTreeItem child = m_categories . get ( childId ) ; deselectChildren ( child ) ; child . getCheckBox ( ) . setChecked ( false ) ; if ( m_selectedCategories . contains ( childId ) ) { m_selectedCategories . remove ( childId ) ; } } }
Deselects all child items of the provided item .
104
12
145,078
private void normalizeSelectedCategories ( ) { Collection < String > normalizedCategories = new ArrayList < String > ( m_selectedCategories . size ( ) ) ; for ( CmsTreeItem item : m_categories . values ( ) ) { if ( item . getCheckBox ( ) . isChecked ( ) ) { normalizedCategories . add ( item . getId ( ) ) ; } } m_selectedCategories = normalizedCategories ; }
Normalize the list of selected categories to fit for the ids of the tree items .
99
18
145,079
private void uncheckAll ( CmsList < ? extends I_CmsListItem > list ) { for ( Widget it : list ) { CmsTreeItem treeItem = ( CmsTreeItem ) it ; treeItem . getCheckBox ( ) . setChecked ( false ) ; uncheckAll ( treeItem . getChildren ( ) ) ; } }
Uncheck all items in the list including all sub - items .
77
13
145,080
public static String getButtonName ( String gallery ) { StringBuffer sb = new StringBuffer ( GUI_BUTTON_PREF ) ; sb . append ( gallery . toUpperCase ( ) ) ; sb . append ( GUI_BUTTON_SUF ) ; return sb . toString ( ) ; }
Create button message key .
68
5
145,081
public boolean addDescriptor ( ) { saveLocalization ( ) ; IndexedContainer oldContainer = m_container ; try { createAndLockDescriptorFile ( ) ; unmarshalDescriptor ( ) ; updateBundleDescriptorContent ( ) ; m_hasMasterMode = true ; m_container = createContainer ( ) ; m_editorState . put ( EditMode . DEFAULT , getDefaultState ( ) ) ; m_editorState . put ( EditMode . MASTER , getMasterState ( ) ) ; } catch ( CmsException | IOException e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; if ( m_descContent != null ) { m_descContent = null ; } if ( m_descFile != null ) { m_descFile = null ; } if ( m_desc != null ) { try { m_cms . deleteResource ( m_desc , CmsResourceDeleteMode . valueOf ( 1 ) ) ; } catch ( CmsException ex ) { LOG . error ( ex . getLocalizedMessage ( ) , ex ) ; } m_desc = null ; } m_hasMasterMode = false ; m_container = oldContainer ; return false ; } m_removeDescriptorOnCancel = true ; return true ; }
Creates a descriptor for the currently edited message bundle .
280
11
145,082
public void deleteDescriptorIfNecessary ( ) throws CmsException { if ( m_removeDescriptorOnCancel && ( m_desc != null ) ) { m_cms . deleteResource ( m_desc , CmsResourceDeleteMode . valueOf ( 2 ) ) ; } }
When the descriptor was added while editing but the change was not saved it has to be removed when the editor is closed .
65
24
145,083
public ConfigurableMessages getConfigurableMessages ( CmsMessages defaultMessages , Locale locale ) { return new ConfigurableMessages ( defaultMessages , locale , m_configuredBundle ) ; }
Returns the configured bundle or the provided default bundle .
46
10
145,084
public CmsContextMenu getContextMenuForItem ( Object itemId ) { CmsContextMenu result = null ; try { final Item item = m_container . getItem ( itemId ) ; Property < ? > keyProp = item . getItemProperty ( TableProperty . KEY ) ; String key = ( String ) keyProp . getValue ( ) ; if ( ( null != key ) && ! key . isEmpty ( ) ) { loadAllRemainingLocalizations ( ) ; final Map < Locale , String > localesWithEntries = new HashMap < Locale , String > ( ) ; for ( Locale l : m_localizations . keySet ( ) ) { if ( l != m_locale ) { String value = m_localizations . get ( l ) . getProperty ( key ) ; if ( ( null != value ) && ! value . isEmpty ( ) ) { localesWithEntries . put ( l , value ) ; } } } if ( ! localesWithEntries . isEmpty ( ) ) { result = new CmsContextMenu ( ) ; ContextMenuItem mainItem = result . addItem ( Messages . get ( ) . getBundle ( UI . getCurrent ( ) . getLocale ( ) ) . key ( Messages . GUI_BUNDLE_EDITOR_CONTEXT_COPY_LOCALE_0 ) ) ; for ( final Locale l : localesWithEntries . keySet ( ) ) { ContextMenuItem menuItem = mainItem . addItem ( l . getDisplayName ( UI . getCurrent ( ) . getLocale ( ) ) ) ; menuItem . addItemClickListener ( new ContextMenuItemClickListener ( ) { public void contextMenuItemClicked ( ContextMenuItemClickEvent event ) { item . getItemProperty ( TableProperty . TRANSLATION ) . setValue ( localesWithEntries . get ( l ) ) ; } } ) ; } } } } catch ( Exception e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; //TODO: Improve } return result ; }
Returns the context menu for the table item .
448
9
145,085
public List < TableProperty > getEditableColumns ( CmsMessageBundleEditorTypes . EditMode mode ) { return m_editorState . get ( mode ) . getEditableColumns ( ) ; }
Returns the editable columns for the provided edit mode .
45
11
145,086
public String getEditedFilePath ( ) { switch ( getBundleType ( ) ) { case DESCRIPTOR : return m_cms . getSitePath ( m_desc ) ; case PROPERTY : return null != m_lockedBundleFiles . get ( getLocale ( ) ) ? m_cms . getSitePath ( m_lockedBundleFiles . get ( getLocale ( ) ) . getFile ( ) ) : m_cms . getSitePath ( m_resource ) ; case XML : return m_cms . getSitePath ( m_resource ) ; default : throw new IllegalArgumentException ( ) ; } }
Returns the site path for the edited bundle file .
135
10
145,087
public void handleChange ( Object propertyId ) { try { lockOnChange ( propertyId ) ; } catch ( CmsException e ) { LOG . debug ( e ) ; } if ( isDescriptorProperty ( propertyId ) ) { m_descriptorHasChanges = true ; } if ( isBundleProperty ( propertyId ) ) { m_changedTranslations . add ( getLocale ( ) ) ; } }
Handles the change of a value in the current translation .
90
12
145,088
public KeyChangeResult handleKeyChange ( EntryChangeEvent event , boolean allLanguages ) { if ( m_keyset . getKeySet ( ) . contains ( event . getNewValue ( ) ) ) { m_container . getItem ( event . getItemId ( ) ) . getItemProperty ( TableProperty . KEY ) . setValue ( event . getOldValue ( ) ) ; return KeyChangeResult . FAILED_DUPLICATED_KEY ; } if ( allLanguages && ! renameKeyForAllLanguages ( event . getOldValue ( ) , event . getNewValue ( ) ) ) { m_container . getItem ( event . getItemId ( ) ) . getItemProperty ( TableProperty . KEY ) . setValue ( event . getOldValue ( ) ) ; return KeyChangeResult . FAILED_FOR_OTHER_LANGUAGE ; } return KeyChangeResult . SUCCESS ; }
Handles a key change .
198
6
145,089
public boolean handleKeyDeletion ( final String key ) { if ( m_keyset . getKeySet ( ) . contains ( key ) ) { if ( removeKeyForAllLanguages ( key ) ) { m_keyset . removeKey ( key ) ; return true ; } else { return false ; } } return true ; }
Handles the deletion of a key .
71
8
145,090
public void publish ( ) { CmsDirectPublishDialogAction action = new CmsDirectPublishDialogAction ( ) ; List < CmsResource > resources = getBundleResources ( ) ; I_CmsDialogContext context = new A_CmsDialogContext ( "" , ContextType . appToolbar , resources ) { public void focus ( CmsUUID structureId ) { //Nothing to do. } public List < CmsUUID > getAllStructureIdsInView ( ) { return null ; } public void updateUserInfo ( ) { //Nothing to do. } } ; action . executeAction ( context ) ; updateLockInformation ( ) ; }
Publish the bundle resources directly .
141
7
145,091
public void save ( ) throws CmsException { if ( hasChanges ( ) ) { switch ( m_bundleType ) { case PROPERTY : saveLocalization ( ) ; saveToPropertyVfsBundle ( ) ; break ; case XML : saveLocalization ( ) ; saveToXmlVfsBundle ( ) ; break ; case DESCRIPTOR : break ; default : throw new IllegalArgumentException ( ) ; } if ( null != m_descFile ) { saveToBundleDescriptor ( ) ; } resetChanges ( ) ; } }
Saves the messages for all languages that were opened in the editor .
119
14
145,092
public void saveAsPropertyBundle ( ) throws UnsupportedEncodingException , CmsException , IOException { switch ( m_bundleType ) { case XML : saveLocalization ( ) ; loadAllRemainingLocalizations ( ) ; createPropertyVfsBundleFiles ( ) ; saveToPropertyVfsBundle ( ) ; m_bundleType = BundleType . PROPERTY ; removeXmlBundleFile ( ) ; break ; default : throw new IllegalArgumentException ( "The method should only be called when editing an XMLResourceBundle." ) ; } }
Saves the loaded XML bundle as property bundle .
122
10
145,093
public void unlock ( ) { for ( Locale l : m_lockedBundleFiles . keySet ( ) ) { LockedFile f = m_lockedBundleFiles . get ( l ) ; f . tryUnlock ( ) ; } if ( null != m_descFile ) { m_descFile . tryUnlock ( ) ; } }
Unlock all files opened for writing .
73
8
145,094
List < CmsResource > getBundleResources ( ) { List < CmsResource > resources = new ArrayList <> ( m_bundleFiles . values ( ) ) ; if ( m_desc != null ) { resources . add ( m_desc ) ; } return resources ; }
Returns all resources that belong to the bundle This includes the descriptor if one exists .
61
16
145,095
private void createAndLockDescriptorFile ( ) throws CmsException { String sitePath = m_sitepath + m_basename + CmsMessageBundleEditorTypes . Descriptor . POSTFIX ; m_desc = m_cms . createResource ( sitePath , OpenCms . getResourceManager ( ) . getResourceType ( CmsMessageBundleEditorTypes . BundleType . DESCRIPTOR . toString ( ) ) ) ; m_descFile = LockedFile . lockResource ( m_cms , m_desc ) ; m_descFile . setCreated ( true ) ; }
Creates a descriptor for the bundle in the same folder where the bundle files are located .
128
18
145,096
private IndexedContainer createContainerForBundleWithDescriptor ( ) throws IOException , CmsException { IndexedContainer container = new IndexedContainer ( ) ; // create properties container . addContainerProperty ( TableProperty . KEY , String . class , "" ) ; container . addContainerProperty ( TableProperty . DESCRIPTION , String . class , "" ) ; container . addContainerProperty ( TableProperty . DEFAULT , String . class , "" ) ; container . addContainerProperty ( TableProperty . TRANSLATION , String . class , "" ) ; // add entries SortedProperties localization = getLocalization ( m_locale ) ; CmsXmlContentValueSequence messages = m_descContent . getValueSequence ( Descriptor . N_MESSAGE , Descriptor . LOCALE ) ; String descValue ; boolean hasDescription = false ; String defaultValue ; boolean hasDefault = false ; for ( int i = 0 ; i < messages . getElementCount ( ) ; i ++ ) { String prefix = messages . getValue ( i ) . getPath ( ) + "/" ; Object itemId = container . addItem ( ) ; Item item = container . getItem ( itemId ) ; String key = m_descContent . getValue ( prefix + Descriptor . N_KEY , Descriptor . LOCALE ) . getStringValue ( m_cms ) ; item . getItemProperty ( TableProperty . KEY ) . setValue ( key ) ; String translation = localization . getProperty ( key ) ; item . getItemProperty ( TableProperty . TRANSLATION ) . setValue ( null == translation ? "" : translation ) ; descValue = m_descContent . getValue ( prefix + Descriptor . N_DESCRIPTION , Descriptor . LOCALE ) . getStringValue ( m_cms ) ; item . getItemProperty ( TableProperty . DESCRIPTION ) . setValue ( descValue ) ; hasDescription = hasDescription || ! descValue . isEmpty ( ) ; defaultValue = m_descContent . getValue ( prefix + Descriptor . N_DEFAULT , Descriptor . LOCALE ) . getStringValue ( m_cms ) ; item . getItemProperty ( TableProperty . DEFAULT ) . setValue ( defaultValue ) ; hasDefault = hasDefault || ! defaultValue . isEmpty ( ) ; } m_hasDefault = hasDefault ; m_hasDescription = hasDescription ; return container ; }
Creates the container for a bundle with descriptor .
517
10
145,097
private IndexedContainer createContainerForBundleWithoutDescriptor ( ) throws IOException , CmsException { IndexedContainer container = new IndexedContainer ( ) ; // create properties container . addContainerProperty ( TableProperty . KEY , String . class , "" ) ; container . addContainerProperty ( TableProperty . TRANSLATION , String . class , "" ) ; // add entries SortedProperties localization = getLocalization ( m_locale ) ; Set < Object > keySet = m_keyset . getKeySet ( ) ; for ( Object key : keySet ) { Object itemId = container . addItem ( ) ; Item item = container . getItem ( itemId ) ; item . getItemProperty ( TableProperty . KEY ) . setValue ( key ) ; Object translation = localization . get ( key ) ; item . getItemProperty ( TableProperty . TRANSLATION ) . setValue ( null == translation ? "" : translation ) ; } return container ; }
Creates the container for a bundle without descriptor .
204
10
145,098
private IndexedContainer createContainerForDescriptorEditing ( ) { IndexedContainer container = new IndexedContainer ( ) ; // create properties container . addContainerProperty ( TableProperty . KEY , String . class , "" ) ; container . addContainerProperty ( TableProperty . DESCRIPTION , String . class , "" ) ; container . addContainerProperty ( TableProperty . DEFAULT , String . class , "" ) ; // add entries CmsXmlContentValueSequence messages = m_descContent . getValueSequence ( "/" + Descriptor . N_MESSAGE , Descriptor . LOCALE ) ; for ( int i = 0 ; i < messages . getElementCount ( ) ; i ++ ) { String prefix = messages . getValue ( i ) . getPath ( ) + "/" ; Object itemId = container . addItem ( ) ; Item item = container . getItem ( itemId ) ; String key = m_descContent . getValue ( prefix + Descriptor . N_KEY , Descriptor . LOCALE ) . getStringValue ( m_cms ) ; item . getItemProperty ( TableProperty . KEY ) . setValue ( key ) ; item . getItemProperty ( TableProperty . DESCRIPTION ) . setValue ( m_descContent . getValue ( prefix + Descriptor . N_DESCRIPTION , Descriptor . LOCALE ) . getStringValue ( m_cms ) ) ; item . getItemProperty ( TableProperty . DEFAULT ) . setValue ( m_descContent . getValue ( prefix + Descriptor . N_DEFAULT , Descriptor . LOCALE ) . getStringValue ( m_cms ) ) ; } return container ; }
Creates the container for a bundle descriptor .
361
9
145,099
private void createPropertyVfsBundleFiles ( ) throws CmsIllegalArgumentException , CmsLoaderException , CmsException { String bundleFileBasePath = m_sitepath + m_basename + "_" ; for ( Locale l : m_localizations . keySet ( ) ) { CmsResource res = m_cms . createResource ( bundleFileBasePath + l . toString ( ) , OpenCms . getResourceManager ( ) . getResourceType ( CmsMessageBundleEditorTypes . BundleType . PROPERTY . toString ( ) ) ) ; m_bundleFiles . put ( l , res ) ; LockedFile file = LockedFile . lockResource ( m_cms , res ) ; file . setCreated ( true ) ; m_lockedBundleFiles . put ( l , file ) ; m_changedTranslations . add ( l ) ; } }
Creates all propertyvfsbundle files for the currently loaded translations . The method is used to convert xmlvfsbundle files into propertyvfsbundle files .
191
35