idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
145,300 | 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 CmsSho... | Import user from file . |
145,301 | 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 ( C... | 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 . |
145,302 | 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 ( )... | Calculates the next date starting from the provided date . |
145,303 | 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? |
145,304 | 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 . MO... | Returns the required gallery open parameters . |
145,305 | 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 ) ; C... | Adds search fields from elements on a container page to a container page s document . |
145,306 | 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_h... | Clears the handler hierarchy . |
145,307 | 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 . |
145,308 | 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 . ... | Set dates with the provided check states . |
145,309 | private void addCheckBox ( Date date , boolean checkState ) { CmsCheckBox cb = generateCheckBox ( date , checkState ) ; m_checkBoxes . add ( cb ) ; reInitLayoutElements ( ) ; } | Add a new check box . |
145,310 | 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 . |
145,311 | 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 . |
145,312 | 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 . |
145,313 | 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 . |
145,314 | 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 . |
145,315 | 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 ( ) ... | Reads the detail container resources which are connected by relations to the given resource . |
145,316 | private List < I_CmsSearchFieldMapping > getMappings ( ) { CmsSearchManager manager = OpenCms . getSearchManager ( ) ; I_CmsSearchFieldConfiguration fieldConfig = manager . getFieldConfiguration ( getParamFieldconfiguration ( ) ) ; CmsLuceneField field ; List < I_CmsSearchFieldMapping > result = null ; Iterator < CmsSe... | Returns the configured mappings of the current field . |
145,317 | 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 . |
145,318 | 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... | Returns the property value read from the given JavaBean . |
145,319 | public void setEndTime ( final Date date ) { if ( ! Objects . equals ( m_model . getEnd ( ) , date ) ) { m_model . setEnd ( date ) ; valueChanged ( ) ; } } | Set the end time . |
145,320 | 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 . setSeriesEnd... | Set the duration option . |
145,321 | 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 ) ; setP... | Toggle between single events and series . |
145,322 | 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 . |
145,323 | 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_mode... | Set the serial pattern type . |
145,324 | public void setSeriesEndDate ( Date date ) { if ( ! Objects . equals ( m_model . getSeriesEndDate ( ) , date ) ) { m_model . setSeriesEndDate ( date ) ; valueChanged ( ) ; } } | Set the serial end date . |
145,325 | 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 . |
145,326 | public void setWholeDay ( Boolean isWholeDay ) { if ( m_model . isWholeDay ( ) ^ ( ( null != isWholeDay ) && isWholeDay . booleanValue ( ) ) ) { m_model . setWholeDay ( isWholeDay ) ; valueChanged ( ) ; } } | Sets the whole day flag . |
145,327 | 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 . |
145,328 | 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 ) ; }... | Returns the RPC service for serial dates . |
145,329 | 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 . |
145,330 | 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 CmsPatternPanelWeekly... | Initialize the pattern controllers . |
145,331 | public void begin ( String namespace , String name , Attributes attributes ) throws Exception { 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 . |
145,332 | 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 . |
145,333 | @ PrefMetadata ( type = CmsElementViewPreference . class ) public String getElementView ( ) { return m_settings . getAdditionalPreference ( CmsElementViewPreference . PREFERENCE_NAME , false ) ; } | Gets the element view . |
145,334 | @ PrefMetadata ( type = CmsHiddenBuiltinPreference . class ) public String getExplorerFileEntryOptions ( ) { if ( m_settings . getExplorerFileEntryOptions ( ) == null ) { return "" ; } else { return "" + m_settings . getExplorerFileEntryOptions ( ) ; } } | Gets the explorer file entry options . |
145,335 | @ PrefMetadata ( type = CmsTimeWarpPreference . class ) public String getTimeWarp ( ) { long warp = m_settings . getTimeWarp ( ) ; return warp < 0 ? "" : "" + warp ; } | Gets the time warp . |
145,336 | public void setTimeWarp ( String l ) { long warp = CmsContextInfo . CURRENT_TIME ; try { warp = Long . parseLong ( l ) ; } catch ( NumberFormatException e ) { } m_settings . setTimeWarp ( warp ) ; } | Sets the time warp . |
145,337 | 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 . |
145,338 | 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 . |
145,339 | 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 . |
145,340 | 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 . |
145,341 | 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 . |
145,342 | 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 . |
145,343 | 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 ; }... | Checks if the duration option is valid . |
145,344 | protected final boolean isPatternValid ( ) { switch ( getPatternType ( ) ) { case DAILY : return isEveryWorkingDay ( ) || isIntervalValid ( ) ; case WEEKLY : return isIntervalValid ( ) && isWeekDaySet ( ) ; case MONTHLY : return isIntervalValid ( ) && isWeekDaySet ( ) ? isWeekOfMonthSet ( ) : isDayOfMonthValid ( ) ; ca... | Checks if all values necessary for a specific pattern are valid . |
145,345 | 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 NO... | Checks if the end type is valid for the set pattern type . |
145,346 | 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_serie... | Sets the value to a default . |
145,347 | 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 . |
145,348 | public static String defaultHtml ( HttpServletRequest request ) { CmsObject cms = CmsFlexController . getController ( request ) . getCmsObject ( ) ; if ( cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ) { return "<div><!--Dynamic function not configured ; } else { Locale locale = OpenCms . ge... | Returns the default output for functions without configured JSPs . |
145,349 | 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 . |
145,350 | 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 ( )... | Performs a remote service method invocation . This method is called by generated proxy classes . |
145,351 | protected < T > RequestBuilder doPrepareRequestBuilder ( ResponseReader responseReader , String methodName , RpcStatsContext statsContext , String requestData , AsyncCallback < T > callback ) { RequestBuilder rb = doPrepareRequestBuilderImpl ( responseReader , methodName , statsContext , requestData , callback ) ; retu... | Configures a RequestBuilder to send an RPC request when the RequestBuilder is intended to be returned through the asynchronous proxy interface . |
145,352 | private < T > RequestBuilder doPrepareRequestBuilderImpl ( ResponseReader responseReader , String methodName , RpcStatsContext statsContext , String requestData , AsyncCallback < T > callback ) { if ( getServiceEntryPoint ( ) == null ) { throw new NoServiceEntryPointSpecifiedException ( ) ; } RequestCallback responseHa... | Configures a RequestBuilder to send an RPC request . |
145,353 | 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_selectedCategor... | Deselects all child items of the provided item . |
145,354 | 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_select... | Normalize the list of selected categories to fit for the ids of the tree items . |
145,355 | 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 . |
145,356 | 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 . |
145,357 | public boolean addDescriptor ( ) { saveLocalization ( ) ; IndexedContainer oldContainer = m_container ; try { createAndLockDescriptorFile ( ) ; unmarshalDescriptor ( ) ; updateBundleDescriptorContent ( ) ; m_hasMasterMode = true ; m_container = createContainer ( ) ; m_editorState . put ( EditMode . DEFAULT , getDefault... | Creates a descriptor for the currently edited message bundle . |
145,358 | 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 . |
145,359 | public ConfigurableMessages getConfigurableMessages ( CmsMessages defaultMessages , Locale locale ) { return new ConfigurableMessages ( defaultMessages , locale , m_configuredBundle ) ; } | Returns the configured bundle or the provided default bundle . |
145,360 | 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 ( )... | Returns the context menu for the table item . |
145,361 | public List < TableProperty > getEditableColumns ( CmsMessageBundleEditorTypes . EditMode mode ) { return m_editorState . get ( mode ) . getEditableColumns ( ) ; } | Returns the editable columns for the provided edit mode . |
145,362 | 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... | Returns the site path for the edited bundle file . |
145,363 | 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 . |
145,364 | 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 . ... | Handles a key change . |
145,365 | 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 . |
145,366 | 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 ) { } public List <... | Publish the bundle resources directly . |
145,367 | 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 (... | Saves the messages for all languages that were opened in the editor . |
145,368 | public void saveAsPropertyBundle ( ) throws UnsupportedEncodingException , CmsException , IOException { switch ( m_bundleType ) { case XML : saveLocalization ( ) ; loadAllRemainingLocalizations ( ) ; createPropertyVfsBundleFiles ( ) ; saveToPropertyVfsBundle ( ) ; m_bundleType = BundleType . PROPERTY ; removeXmlBundleF... | Saves the loaded XML bundle as property bundle . |
145,369 | 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 . |
145,370 | 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 . |
145,371 | 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 . to... | Creates a descriptor for the bundle in the same folder where the bundle files are located . |
145,372 | private IndexedContainer createContainerForBundleWithDescriptor ( ) throws IOException , CmsException { IndexedContainer container = new IndexedContainer ( ) ; container . addContainerProperty ( TableProperty . KEY , String . class , "" ) ; container . addContainerProperty ( TableProperty . DESCRIPTION , String . class... | Creates the container for a bundle with descriptor . |
145,373 | private IndexedContainer createContainerForBundleWithoutDescriptor ( ) throws IOException , CmsException { IndexedContainer container = new IndexedContainer ( ) ; container . addContainerProperty ( TableProperty . KEY , String . class , "" ) ; container . addContainerProperty ( TableProperty . TRANSLATION , String . cl... | Creates the container for a bundle without descriptor . |
145,374 | private IndexedContainer createContainerForDescriptorEditing ( ) { IndexedContainer container = new IndexedContainer ( ) ; container . addContainerProperty ( TableProperty . KEY , String . class , "" ) ; container . addContainerProperty ( TableProperty . DESCRIPTION , String . class , "" ) ; container . addContainerPro... | Creates the container for a bundle descriptor . |
145,375 | 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 ... | Creates all propertyvfsbundle files for the currently loaded translations . The method is used to convert xmlvfsbundle files into propertyvfsbundle files . |
145,376 | private EditorState getDefaultState ( ) { List < TableProperty > cols = new ArrayList < TableProperty > ( 1 ) ; cols . add ( TableProperty . TRANSLATION ) ; return new EditorState ( cols , false ) ; } | Creates the default editor state for editing a bundle with descriptor . |
145,377 | private SortedProperties getLocalization ( Locale locale ) throws IOException , CmsException { if ( null == m_localizations . get ( locale ) ) { switch ( m_bundleType ) { case PROPERTY : loadLocalizationFromPropertyBundle ( locale ) ; break ; case XML : loadLocalizationFromXmlBundle ( locale ) ; break ; case DESCRIPTOR... | Reads the current properties for a language . If not already done the properties are read from the respective file . |
145,378 | private EditorState getMasterState ( ) { List < TableProperty > cols = new ArrayList < TableProperty > ( 4 ) ; cols . add ( TableProperty . KEY ) ; cols . add ( TableProperty . DESCRIPTION ) ; cols . add ( TableProperty . DEFAULT ) ; cols . add ( TableProperty . TRANSLATION ) ; return new EditorState ( cols , true ) ; ... | Returns the master mode s editor state for editing a bundle with descriptor . |
145,379 | private CmsMessageBundleEditorTypes . BundleType initBundleType ( ) { String resourceTypeName = OpenCms . getResourceManager ( ) . getResourceType ( m_resource ) . getTypeName ( ) ; return CmsMessageBundleEditorTypes . BundleType . toBundleType ( resourceTypeName ) ; } | Init the bundle type member variable . |
145,380 | private void initDescriptor ( ) throws CmsXmlException , CmsException { if ( m_bundleType . equals ( CmsMessageBundleEditorTypes . BundleType . DESCRIPTOR ) ) { m_desc = m_resource ; } else { try { m_desc = m_cms . readResource ( m_sitepath + m_basename + CmsMessageBundleEditorTypes . Descriptor . POSTFIX ) ; } catch (... | Reads the bundle descriptor sets m_desc and m_descContent . |
145,381 | private void initEditorStates ( ) { m_editorState = new HashMap < CmsMessageBundleEditorTypes . EditMode , EditorState > ( ) ; List < TableProperty > cols = null ; switch ( m_bundleType ) { case PROPERTY : case XML : if ( hasDescriptor ( ) ) { m_editorState . put ( CmsMessageBundleEditorTypes . EditMode . DEFAULT , get... | Initializes the editor states for the different modes depending on the type of the opened file . |
145,382 | private void initHasMasterMode ( ) throws CmsException { if ( hasDescriptor ( ) && m_cms . hasPermissions ( m_desc , CmsPermissionSet . ACCESS_WRITE , false , CmsResourceFilter . ALL ) ) { m_hasMasterMode = true ; } else { m_hasMasterMode = false ; } } | Initializes the information on an available master mode . |
145,383 | private void initKeySetForXmlBundle ( ) { for ( Locale l : m_locales ) { if ( m_xmlBundle . hasLocale ( l ) ) { Set < Object > keys = new HashSet < Object > ( ) ; for ( I_CmsXmlContentValue msg : m_xmlBundle . getValueSequence ( "Message" , l ) . getValues ( ) ) { String msgpath = msg . getPath ( ) ; keys . add ( m_xml... | Initialize the key set for an xml bundle . |
145,384 | private Collection < Locale > initLocales ( ) { Collection < Locale > locales = null ; switch ( m_bundleType ) { case DESCRIPTOR : locales = new ArrayList < Locale > ( 1 ) ; locales . add ( Descriptor . LOCALE ) ; break ; case XML : case PROPERTY : locales = OpenCms . getLocaleManager ( ) . getAvailableLocales ( m_cms ... | Initializes the locales that can be selected via the language switcher in the bundle editor . |
145,385 | private void initPropertyBundle ( ) throws CmsLoaderException , CmsException , IOException { for ( Locale l : m_locales ) { String filePath = m_sitepath + m_basename + "_" + l . toString ( ) ; CmsResource resource = null ; if ( m_cms . existsResource ( filePath , CmsResourceFilter . requireType ( OpenCms . getResourceM... | Initialization necessary for editing a property bundle . |
145,386 | private void initXmlBundle ( ) throws CmsException { CmsFile file = m_cms . readFile ( m_resource ) ; m_bundleFiles . put ( null , m_resource ) ; m_xmlBundle = CmsXmlContentFactory . unmarshal ( m_cms , file ) ; initKeySetForXmlBundle ( ) ; } | Unmarshals the XML content and adds the file to the bundle files . |
145,387 | private boolean isBundleProperty ( Object property ) { return ( property . equals ( TableProperty . KEY ) || property . equals ( TableProperty . TRANSLATION ) ) ; } | Check if values in the column property are written to the bundle files . |
145,388 | private boolean isDescriptorProperty ( Object property ) { return ( getBundleType ( ) . equals ( BundleType . DESCRIPTOR ) || ( hasDescriptor ( ) && ( property . equals ( TableProperty . KEY ) || property . equals ( TableProperty . DEFAULT ) || property . equals ( TableProperty . DESCRIPTION ) ) ) ) ; } | Check if values in the column property are written to the bundle descriptor . |
145,389 | private void loadAllRemainingLocalizations ( ) throws CmsException , UnsupportedEncodingException , IOException { if ( ! m_alreadyLoadedAllLocalizations ) { if ( m_bundleType . equals ( BundleType . PROPERTY ) ) { for ( Locale l : m_locales ) { if ( null == m_localizations . get ( l ) ) { CmsResource resource = m_bundl... | Loads all localizations not already loaded . |
145,390 | 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 . |
145,391 | private void lockDescriptor ( ) throws CmsException { if ( ( null == m_descFile ) && ( null != m_desc ) ) { m_descFile = LockedFile . lockResource ( m_cms , m_desc ) ; } } | Locks the bundle descriptor . |
145,392 | 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 . |
145,393 | 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 . |
145,394 | 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 . |
145,395 | 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 . |
145,396 | 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 . |
145,397 | 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 . |
145,398 | 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 . |
145,399 | 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 . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.