idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
144,900
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 .
81
15
144,901
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 .
59
4
144,902
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 ( ) ) { // disable publishing in online project publishButton . setEnabled ( false ) ; publishButton . setDescription ( CmsVaadinUtils . getMessageText ( Messages . GUI_TOOLBAR_NOT_AVAILABLE_ONLINE_0 ) ) ; } publishButton . addClickListener ( new ClickListener ( ) { /** Serial version id. */ private static final long serialVersionUID = 1L ; public void buttonClick ( ClickEvent event ) { CmsAppWorkplaceUi . get ( ) . disableGlobalShortcuts ( ) ; CmsGwtDialogExtension extension = new CmsGwtDialogExtension ( A_CmsUI . get ( ) , updateListener ) ; extension . openPublishDialog ( ) ; } } ) ; return publishButton ; }
Creates the publish button .
254
6
144,903
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 . put ( TableProperty . DESCRIPTION , m_table . getFilterFieldValue ( TableProperty . DESCRIPTION ) ) ; result . put ( TableProperty . TRANSLATION , m_table . getFilterFieldValue ( TableProperty . TRANSLATION ) ) ; return result ; }
Returns the currently set filters in a map column - > filter .
144
13
144,904
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 . ERR_SAVING_CHANGES_0 ) , e ) ; } setFilters ( filters ) ; }
Save the changes .
130
4
144,905
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 , filterValue ) ; } } }
Sets the provided filters .
93
6
144,906
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 . isShowOptionsColumn ( newMode ) ) { // Don't know why exactly setting the filter field invisible is necessary here, // it should be already set invisible - but apparently not setting it invisible again // will result in the field being visible. m_table . setFilterFieldVisible ( TableProperty . OPTIONS , false ) ; m_table . addGeneratedColumn ( TableProperty . OPTIONS , m_optionsColumn ) ; } } }
Show or hide the options column dependent on the provided edit mode .
176
13
144,907
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 ( TableProperty . DEFAULT , true ) ; } if ( ( ( m_model . getEditMode ( ) . equals ( EditMode . MASTER ) || m_model . hasDescriptionValues ( ) ) ) || m_model . getBundleType ( ) . equals ( BundleType . DESCRIPTOR ) ) { m_table . setColumnCollapsed ( TableProperty . DESCRIPTION , false ) ; } else { m_table . setColumnCollapsed ( TableProperty . DESCRIPTION , true ) ; } } }
Adjust the visible columns .
202
5
144,908
private void cleanUpAction ( ) { try { m_model . deleteDescriptorIfNecessary ( ) ; } catch ( CmsException e ) { LOG . error ( m_messages . key ( Messages . ERR_DELETING_DESCRIPTOR_0 ) , e ) ; } // unlock resource m_model . unlock ( ) ; }
Unlock all edited resources .
78
6
144,909
@ 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 ClickListener ( ) { @ SuppressWarnings ( "synthetic-access" ) public void buttonClick ( ClickEvent event ) { Map < Object , Object > filters = getFilters ( ) ; m_table . clearFilters ( ) ; if ( ! m_model . addDescriptor ( ) ) { CmsVaadinUtils . showAlert ( m_messages . key ( Messages . ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_0 ) , m_messages . key ( Messages . ERR_BUNDLE_DESCRIPTOR_CREATION_FAILED_DESCRIPTION_0 ) , null ) ; } else { IndexedContainer newContainer = null ; try { newContainer = m_model . getContainerForCurrentLocale ( ) ; m_table . setContainerDataSource ( newContainer ) ; initFieldFactories ( ) ; initStyleGenerators ( ) ; setEditMode ( EditMode . MASTER ) ; m_table . setColumnCollapsingAllowed ( true ) ; adjustVisibleColumns ( ) ; m_options . updateShownOptions ( m_model . hasMasterMode ( ) , m_model . canAddKeys ( ) ) ; m_options . setEditMode ( m_model . getEditMode ( ) ) ; } catch ( IOException | CmsException e ) { // Can never appear here, since container is created by addDescriptor already. LOG . error ( e . getLocalizedMessage ( ) , e ) ; } } setFilters ( filters ) ; } } ) ; return addDescriptorButton ; }
Returns a button component . On click it triggers adding a bundle descriptor .
446
14
144,910
@ 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 ) { closeAction ( ) ; } } ) ; return closeBtn ; }
Create the close button UI Component .
109
7
144,911
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 ( ) { private static final long serialVersionUID = 1L ; public void buttonClick ( ClickEvent event ) { try { m_model . saveAsPropertyBundle ( ) ; Notification . show ( "Conversion successful." ) ; } catch ( CmsException | IOException e ) { CmsVaadinUtils . showAlert ( "Conversion failed" , e . getLocalizedMessage ( ) , null ) ; } } } ) ; addDescriptorButton . setDisableOnClick ( true ) ; return addDescriptorButton ; }
Creates the button for converting an XML bundle in a property bundle .
209
14
144,912
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 ( ) ; navigator . setContent ( m_table ) ; navigator . addActionHandler ( new CmsMessageBundleEditorTypes . TableKeyboardHandler ( m_table ) ) ; navigator . addStyleName ( "v-panel-borderless" ) ; mainComponent . addComponent ( m_options . getOptionsComponent ( ) ) ; mainComponent . addComponent ( navigator ) ; mainComponent . setExpandRatio ( navigator , 1f ) ; m_options . updateShownOptions ( m_model . hasMasterMode ( ) , m_model . canAddKeys ( ) ) ; return mainComponent ; }
Creates the main component of the editor with all sub - components .
214
14
144,913
@ 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 ) { saveAction ( ) ; closeAction ( ) ; } } ) ; saveExitBtn . setEnabled ( false ) ; return saveExitBtn ; }
Creates the save and exit button UI Component .
128
10
144,914
private void fillToolBar ( final I_CmsAppUIContext context ) { context . setAppTitle ( m_messages . key ( Messages . GUI_APP_TITLE_0 ) ) ; // create components Component publishBtn = createPublishButton ( ) ; m_saveBtn = createSaveButton ( ) ; m_saveExitBtn = createSaveExitButton ( ) ; Component closeBtn = createCloseButton ( ) ; context . enableDefaultToolbarButtons ( false ) ; context . addToolbarButtonRight ( closeBtn ) ; context . addToolbarButton ( publishBtn ) ; context . addToolbarButton ( m_saveExitBtn ) ; context . addToolbarButton ( m_saveBtn ) ; Component addDescriptorBtn = createAddDescriptorButton ( ) ; if ( m_model . hasDescriptor ( ) || m_model . getBundleType ( ) . equals ( BundleType . DESCRIPTOR ) ) { addDescriptorBtn . setEnabled ( false ) ; } context . addToolbarButton ( addDescriptorBtn ) ; if ( m_model . getBundleType ( ) . equals ( BundleType . XML ) ) { Component convertToPropertyBundleBtn = createConvertToPropertyBundleButton ( ) ; context . addToolbarButton ( convertToPropertyBundleBtn ) ; } }
Adds Editor specific UI components to the toolbar .
304
9
144,915
private void handleChange ( Object propertyId ) { if ( ! m_saveBtn . isEnabled ( ) ) { m_saveBtn . setEnabled ( true ) ; m_saveExitBtn . setEnabled ( true ) ; } m_model . handleChange ( propertyId ) ; }
Handle a value change .
62
5
144,916
private void initFieldFactories ( ) { if ( m_model . hasMasterMode ( ) ) { TranslateTableFieldFactory masterFieldFactory = new CmsMessageBundleEditorTypes . TranslateTableFieldFactory ( m_table , m_model . getEditableColumns ( CmsMessageBundleEditorTypes . EditMode . MASTER ) ) ; masterFieldFactory . registerKeyChangeListener ( this ) ; m_fieldFactories . put ( CmsMessageBundleEditorTypes . EditMode . MASTER , masterFieldFactory ) ; } TranslateTableFieldFactory defaultFieldFactory = new CmsMessageBundleEditorTypes . TranslateTableFieldFactory ( m_table , m_model . getEditableColumns ( CmsMessageBundleEditorTypes . EditMode . DEFAULT ) ) ; defaultFieldFactory . registerKeyChangeListener ( this ) ; m_fieldFactories . put ( CmsMessageBundleEditorTypes . EditMode . DEFAULT , defaultFieldFactory ) ; }
Initialize the field factories for the messages table .
210
10
144,917
private void initStyleGenerators ( ) { if ( m_model . hasMasterMode ( ) ) { m_styleGenerators . put ( CmsMessageBundleEditorTypes . EditMode . MASTER , new CmsMessageBundleEditorTypes . TranslateTableCellStyleGenerator ( m_model . getEditableColumns ( CmsMessageBundleEditorTypes . EditMode . MASTER ) ) ) ; } m_styleGenerators . put ( CmsMessageBundleEditorTypes . EditMode . DEFAULT , new CmsMessageBundleEditorTypes . TranslateTableCellStyleGenerator ( m_model . getEditableColumns ( CmsMessageBundleEditorTypes . EditMode . DEFAULT ) ) ) ; }
Initialize the style generators for the messages table .
156
10
144,918
private boolean keyAlreadyExists ( String newKey ) { Collection < ? > itemIds = m_table . getItemIds ( ) ; for ( Object itemId : itemIds ) { if ( m_table . getItem ( itemId ) . getItemProperty ( TableProperty . KEY ) . getValue ( ) . equals ( newKey ) ) { return true ; } } return false ; }
Checks if a key already exists .
86
8
144,919
public void uploadFields ( final Set < String > fields , final Function < Map < String , String > , Void > filenameCallback , final I_CmsErrorCallback errorCallback ) { disableAllFileFieldsExcept ( fields ) ; final String id = CmsJsUtils . generateRandomId ( ) ; updateFormAction ( id ) ; // Using an array here because we can only store the handler registration after it has been created , but final HandlerRegistration [ ] registration = { null } ; registration [ 0 ] = addSubmitCompleteHandler ( new SubmitCompleteHandler ( ) { @ SuppressWarnings ( "synthetic-access" ) public void onSubmitComplete ( SubmitCompleteEvent event ) { enableAllFileFields ( ) ; registration [ 0 ] . removeHandler ( ) ; CmsUUID sessionId = m_formSession . internalGetSessionId ( ) ; RequestBuilder requestBuilder = CmsXmlContentUgcApi . SERVICE . uploadFiles ( sessionId , fields , id , new AsyncCallback < Map < String , String > > ( ) { public void onFailure ( Throwable caught ) { m_formSession . getContentFormApi ( ) . handleError ( caught , errorCallback ) ; } public void onSuccess ( Map < String , String > fileNames ) { filenameCallback . apply ( fileNames ) ; } } ) ; m_formSession . getContentFormApi ( ) . getRpcHelper ( ) . executeRpc ( requestBuilder ) ; m_formSession . getContentFormApi ( ) . getRequestCounter ( ) . decrement ( ) ; } } ) ; m_formSession . getContentFormApi ( ) . getRequestCounter ( ) . increment ( ) ; submit ( ) ; }
Uploads files from the given file input fields . <p<
371
13
144,920
public static CmsJspResourceWrapper convertResource ( CmsObject cms , Object input ) throws CmsException { CmsJspResourceWrapper result ; if ( input instanceof CmsResource ) { result = CmsJspResourceWrapper . wrap ( cms , ( CmsResource ) input ) ; } else { result = CmsJspResourceWrapper . wrap ( cms , convertRawResource ( cms , input ) ) ; } return result ; }
Returns a resource wrapper created from the input .
102
9
144,921
public static List < CmsJspResourceWrapper > convertResourceList ( CmsObject cms , List < CmsResource > list ) { List < CmsJspResourceWrapper > result = new ArrayList < CmsJspResourceWrapper > ( list . size ( ) ) ; for ( CmsResource res : list ) { result . add ( CmsJspResourceWrapper . wrap ( cms , res ) ) ; } return result ; }
Returns a list of resource wrappers created from the input list of resources .
99
15
144,922
public static I_CmsSearchConfigurationPagination create ( String pageParam , List < Integer > pageSizes , Integer pageNavLength ) { return ( pageParam != null ) || ( pageSizes != null ) || ( pageNavLength != null ) ? new CmsSearchConfigurationPagination ( pageParam , pageSizes , pageNavLength ) : null ; }
Creates a new pagination configuration if at least one of the provided parameters is not null . Otherwise returns null .
79
23
144,923
public static String getDateCreatedTimeRangeFilterQuery ( String searchField , long startTime , long endTime ) { String sStartTime = null ; String sEndTime = null ; // Convert startTime to ISO 8601 format if ( ( startTime > Long . MIN_VALUE ) && ( startTime < Long . MAX_VALUE ) ) { sStartTime = CmsSearchUtil . getDateAsIso8601 ( new Date ( startTime ) ) ; } // Convert endTime to ISO 8601 format if ( ( endTime > Long . MIN_VALUE ) && ( endTime < Long . MAX_VALUE ) ) { sEndTime = CmsSearchUtil . getDateAsIso8601 ( new Date ( endTime ) ) ; } // Build Solr range string final String rangeString = CmsSearchUtil . getSolrRangeString ( sStartTime , sEndTime ) ; // Build Solr filter string return String . format ( "%s:%s" , searchField , rangeString ) ; }
Returns a time interval as Solr compatible query string .
218
11
144,924
public static String getSolrRangeString ( String from , String to ) { // If a parameter is not initialized, use the asterisk '*' operator if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( from ) ) { from = "*" ; } if ( CmsStringUtil . isEmptyOrWhitespaceOnly ( to ) ) { to = "*" ; } return String . format ( "[%s TO %s]" , from , to ) ; }
Returns a string that represents a valid Solr query range .
105
12
144,925
public static Collection < ContentStream > toContentStreams ( final String str , final String contentType ) { if ( str == null ) { return null ; } ArrayList < ContentStream > streams = new ArrayList <> ( 1 ) ; ContentStreamBase ccc = new ContentStreamBase . StringStream ( str ) ; ccc . setContentType ( contentType ) ; streams . add ( ccc ) ; return streams ; }
Take a string and make it an iterable ContentStream
90
11
144,926
public static String paramMapToString ( final Map < String , String [ ] > parameters ) { final StringBuffer result = new StringBuffer ( ) ; for ( final String key : parameters . keySet ( ) ) { String [ ] values = parameters . get ( key ) ; if ( null == values ) { result . append ( key ) . append ( ' ' ) ; } else { for ( final String value : parameters . get ( key ) ) { result . append ( key ) . append ( ' ' ) . append ( CmsEncoder . encode ( value ) ) . append ( ' ' ) ; } } } // remove last '&' if ( result . length ( ) > 0 ) { result . setLength ( result . length ( ) - 1 ) ; } return result . toString ( ) ; }
Converts a parameter map to the parameter string .
170
10
144,927
String getFacetParamKey ( String facet ) { I_CmsSearchControllerFacetField fieldFacet = m_result . getController ( ) . getFieldFacets ( ) . getFieldFacetController ( ) . get ( facet ) ; if ( fieldFacet != null ) { return fieldFacet . getConfig ( ) . getParamKey ( ) ; } I_CmsSearchControllerFacetRange rangeFacet = m_result . getController ( ) . getRangeFacets ( ) . getRangeFacetController ( ) . get ( facet ) ; if ( rangeFacet != null ) { return rangeFacet . getConfig ( ) . getParamKey ( ) ; } I_CmsSearchControllerFacetQuery queryFacet = m_result . getController ( ) . getQueryFacet ( ) ; if ( ( queryFacet != null ) && queryFacet . getConfig ( ) . getName ( ) . equals ( facet ) ) { return queryFacet . getConfig ( ) . getParamKey ( ) ; } // Facet did not exist LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_FACET_NOT_CONFIGURED_1 , facet ) , new Throwable ( ) ) ; return null ; }
Returns the parameter key of the facet with the given name .
278
12
144,928
public static void closeWindow ( Component component ) { Window window = getWindow ( component ) ; if ( window != null ) { window . close ( ) ; } }
Closes the window containing the given component .
34
9
144,929
@ SuppressWarnings ( "unchecked" ) public static < T > void defaultHandleContextMenuForMultiselect ( Table table , CmsContextMenu menu , ItemClickEvent event , List < I_CmsSimpleContextMenuEntry < Collection < T > > > entries ) { if ( ! event . isCtrlKey ( ) && ! event . isShiftKey ( ) ) { if ( event . getButton ( ) . equals ( MouseButton . RIGHT ) ) { Collection < T > oldValue = ( ( Collection < T > ) table . getValue ( ) ) ; if ( oldValue . isEmpty ( ) || ! oldValue . contains ( event . getItemId ( ) ) ) { table . setValue ( new HashSet < Object > ( Arrays . asList ( event . getItemId ( ) ) ) ) ; } Collection < T > selection = ( Collection < T > ) table . getValue ( ) ; menu . setEntries ( entries , selection ) ; menu . openForTable ( event , table ) ; } } }
Simple context menu handler for multi - select tables .
222
10
144,930
public static IndexedContainer getGroupsOfUser ( CmsObject cms , CmsUser user , String caption , String iconProp , String ou , String propStatus , Function < CmsGroup , CmsCssIcon > iconProvider ) { IndexedContainer container = new IndexedContainer ( ) ; container . addContainerProperty ( caption , String . class , "" ) ; container . addContainerProperty ( ou , String . class , "" ) ; container . addContainerProperty ( propStatus , Boolean . class , new Boolean ( true ) ) ; if ( iconProvider != null ) { container . addContainerProperty ( iconProp , CmsCssIcon . class , null ) ; } try { for ( CmsGroup group : cms . getGroupsOfUser ( user . getName ( ) , true ) ) { Item item = container . addItem ( group ) ; item . getItemProperty ( caption ) . setValue ( group . getSimpleName ( ) ) ; item . getItemProperty ( ou ) . setValue ( group . getOuFqn ( ) ) ; if ( iconProvider != null ) { item . getItemProperty ( iconProp ) . setValue ( iconProvider . apply ( group ) ) ; } } } catch ( CmsException e ) { LOG . error ( "Unable to read groups from user" , e ) ; } return container ; }
Gets container with alls groups of a certain user .
294
12
144,931
public static IndexedContainer getPrincipalContainer ( CmsObject cms , List < ? extends I_CmsPrincipal > list , String captionID , String descID , String iconID , String ouID , String icon , List < FontIcon > iconList ) { IndexedContainer res = new IndexedContainer ( ) ; res . addContainerProperty ( captionID , String . class , "" ) ; res . addContainerProperty ( ouID , String . class , "" ) ; res . addContainerProperty ( iconID , FontIcon . class , new CmsCssIcon ( icon ) ) ; if ( descID != null ) { res . addContainerProperty ( descID , String . class , "" ) ; } for ( I_CmsPrincipal group : list ) { Item item = res . addItem ( group ) ; item . getItemProperty ( captionID ) . setValue ( group . getSimpleName ( ) ) ; item . getItemProperty ( ouID ) . setValue ( group . getOuFqn ( ) ) ; if ( descID != null ) { item . getItemProperty ( descID ) . setValue ( group . getDescription ( A_CmsUI . get ( ) . getLocale ( ) ) ) ; } } for ( int i = 0 ; i < iconList . size ( ) ; i ++ ) { res . getItem ( res . getIdByIndex ( i ) ) . getItemProperty ( iconID ) . setValue ( iconList . get ( i ) ) ; } return res ; }
Get container for principal .
332
5
144,932
public static void setFilterBoxStyle ( TextField searchBox ) { searchBox . setIcon ( FontOpenCms . FILTER ) ; searchBox . setPlaceholder ( org . opencms . ui . apps . Messages . get ( ) . getBundle ( UI . getCurrent ( ) . getLocale ( ) ) . key ( org . opencms . ui . apps . Messages . GUI_EXPLORER_FILTER_0 ) ) ; searchBox . addStyleName ( ValoTheme . TEXTFIELD_INLINE_ICON ) ; }
Configures a text field to look like a filter box for a table .
122
15
144,933
protected ZipEntry getZipEntry ( String filename ) throws ZipException { // yes ZipEntry entry = getZipFile ( ) . getEntry ( filename ) ; // path to file might be relative, too if ( ( entry == null ) && filename . startsWith ( "/" ) ) { entry = m_zipFile . getEntry ( filename . substring ( 1 ) ) ; } if ( entry == null ) { throw new ZipException ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_IMPORTEXPORT_FILE_NOT_FOUND_IN_ZIP_1 , filename ) ) ; } return entry ; }
Returns the zip entry for a file in the archive .
137
11
144,934
protected void appenHtmlFooter ( StringBuffer buffer ) { if ( m_configuredFooter != null ) { buffer . append ( m_configuredFooter ) ; } else { buffer . append ( " </body>\r\n" + "</html>" ) ; } }
Append the html - code to finish a html mail message to the given buffer .
63
17
144,935
public void openReport ( String newState , A_CmsReportThread thread , String label ) { setReport ( newState , thread ) ; m_labels . put ( thread , label ) ; openSubView ( newState , true ) ; }
Changes to a new sub - view and stores a report to be displayed by that subview . <p<
53
22
144,936
public static CmsUUID readId ( JSONObject obj , String key ) { String strValue = obj . optString ( key ) ; if ( ! CmsUUID . isValidUUID ( strValue ) ) { return null ; } return new CmsUUID ( strValue ) ; }
Reads a UUID from a JSON object .
63
10
144,937
public void setSiteRoot ( String siteRoot ) { if ( siteRoot != null ) { siteRoot = siteRoot . replaceFirst ( "/$" , "" ) ; } m_siteRoot = siteRoot ; }
Sets the site root .
45
6
144,938
public JSONObject toJson ( ) throws JSONException { JSONObject result = new JSONObject ( ) ; if ( m_detailId != null ) { result . put ( JSON_DETAIL , "" + m_detailId ) ; } if ( m_siteRoot != null ) { result . put ( JSON_SITEROOT , m_siteRoot ) ; } if ( m_structureId != null ) { result . put ( JSON_STRUCTUREID , "" + m_structureId ) ; } if ( m_projectId != null ) { result . put ( JSON_PROJECT , "" + m_projectId ) ; } if ( m_type != null ) { result . put ( JSON_TYPE , "" + m_type . getJsonId ( ) ) ; } return result ; }
Converts this object to JSON .
174
7
144,939
public String updateContextAndGetFavoriteUrl ( CmsObject cms ) throws CmsException { CmsResourceFilter filter = CmsResourceFilter . IGNORE_EXPIRATION ; CmsProject project = null ; switch ( getType ( ) ) { case explorerFolder : CmsResource folder = cms . readResource ( getStructureId ( ) , filter ) ; project = cms . readProject ( getProjectId ( ) ) ; cms . getRequestContext ( ) . setSiteRoot ( getSiteRoot ( ) ) ; cms . getRequestContext ( ) . setCurrentProject ( project ) ; String explorerLink = CmsVaadinUtils . getWorkplaceLink ( ) + "#!" + CmsFileExplorerConfiguration . APP_ID + "/" + getProjectId ( ) + "!!" + getSiteRoot ( ) + "!!" + cms . getSitePath ( folder ) ; return explorerLink ; case page : project = cms . readProject ( getProjectId ( ) ) ; CmsResource target = cms . readResource ( getStructureId ( ) , filter ) ; CmsResource detailContent = null ; String link = null ; cms . getRequestContext ( ) . setCurrentProject ( project ) ; cms . getRequestContext ( ) . setSiteRoot ( getSiteRoot ( ) ) ; if ( getDetailId ( ) != null ) { detailContent = cms . readResource ( getDetailId ( ) ) ; link = OpenCms . getLinkManager ( ) . substituteLinkForUnknownTarget ( cms , cms . getSitePath ( detailContent ) , cms . getSitePath ( target ) , false ) ; } else { link = OpenCms . getLinkManager ( ) . substituteLink ( cms , target ) ; } return link ; default : return null ; } }
Prepares the CmsObject for jumping to this favorite location and returns the appropriate URL .
393
18
144,940
public static void openFavoriteDialog ( CmsFileExplorer explorer ) { try { CmsExplorerFavoriteContext context = new CmsExplorerFavoriteContext ( A_CmsUI . getCmsObject ( ) , explorer ) ; CmsFavoriteDialog dialog = new CmsFavoriteDialog ( context , new CmsFavoriteDAO ( A_CmsUI . getCmsObject ( ) ) ) ; Window window = CmsBasicDialog . prepareWindow ( DialogWidth . max ) ; window . setContent ( dialog ) ; window . setCaption ( CmsVaadinUtils . getMessageText ( org . opencms . ui . Messages . GUI_FAVORITES_DIALOG_TITLE_0 ) ) ; A_CmsUI . get ( ) . addWindow ( window ) ; window . center ( ) ; } catch ( CmsException e ) { CmsErrorDialog . showErrorDialog ( e ) ; } }
Opens the favorite dialog .
202
6
144,941
public static CmsResource getDescriptor ( CmsObject cms , String basename ) { CmsSolrQuery query = new CmsSolrQuery ( ) ; query . setResourceTypes ( CmsMessageBundleEditorTypes . BundleType . DESCRIPTOR . toString ( ) ) ; query . setFilterQueries ( "filename:\"" + basename + CmsMessageBundleEditorTypes . Descriptor . POSTFIX + "\"" ) ; query . add ( "fl" , "path" ) ; CmsSolrResultList results ; try { boolean isOnlineProject = cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) ; String indexName = isOnlineProject ? CmsSolrIndex . DEFAULT_INDEX_NAME_ONLINE : CmsSolrIndex . DEFAULT_INDEX_NAME_OFFLINE ; results = OpenCms . getSearchManager ( ) . getIndexSolr ( indexName ) . search ( cms , query , true , null , true , null ) ; } catch ( CmsSearchException e ) { LOG . error ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_BUNDLE_DESCRIPTOR_SEARCH_ERROR_0 ) , e ) ; return null ; } switch ( results . size ( ) ) { case 0 : return null ; case 1 : return results . get ( 0 ) ; default : String files = "" ; for ( CmsResource res : results ) { files += " " + res . getRootPath ( ) ; } LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . ERR_BUNDLE_DESCRIPTOR_NOT_UNIQUE_1 , files ) ) ; return results . get ( 0 ) ; } }
Returns the bundle descriptor for the bundle with the provided base name .
396
13
144,942
static void showWarning ( final String caption , final String description ) { Notification warning = new Notification ( caption , description , Type . WARNING_MESSAGE , true ) ; warning . setDelayMsec ( - 1 ) ; warning . show ( UI . getCurrent ( ) . getPage ( ) ) ; }
Displays a localized warning .
66
6
144,943
public void setDateOnly ( boolean dateOnly ) { if ( m_dateOnly != dateOnly ) { m_dateOnly = dateOnly ; if ( m_dateOnly ) { m_time . removeFromParent ( ) ; m_am . removeFromParent ( ) ; m_pm . removeFromParent ( ) ; } else { m_timeField . add ( m_time ) ; m_timeField . add ( m_am ) ; m_timeField . add ( m_pm ) ; } } }
Sets the value if the date only should be shown .
110
12
144,944
@ UiHandler ( "m_addButton" ) void addButtonClick ( ClickEvent e ) { if ( null != m_newDate . getValue ( ) ) { m_dateList . addDate ( m_newDate . getValue ( ) ) ; m_newDate . setValue ( null ) ; if ( handleChange ( ) ) { m_controller . setDates ( m_dateList . getDates ( ) ) ; } } }
Handle click on Add button .
98
6
144,945
@ UiHandler ( "m_dateList" ) void dateListValueChange ( ValueChangeEvent < SortedSet < Date > > event ) { if ( handleChange ( ) ) { m_controller . setDates ( event . getValue ( ) ) ; } }
Handle value change event on the individual dates list .
58
10
144,946
@ Override public String remove ( Object key ) { String result = m_configurationStrings . remove ( key ) ; m_configurationObjects . remove ( key ) ; return result ; }
Removes a parameter from this configuration .
42
8
144,947
private boolean loadCustomErrorPage ( CmsObject cms , HttpServletRequest req , HttpServletResponse res , String rootPath ) { try { // get the site of the error page resource CmsSite errorSite = OpenCms . getSiteManager ( ) . getSiteForRootPath ( rootPath ) ; cms . getRequestContext ( ) . setSiteRoot ( errorSite . getSiteRoot ( ) ) ; String relPath = cms . getRequestContext ( ) . removeSiteRoot ( rootPath ) ; if ( cms . existsResource ( relPath ) ) { cms . getRequestContext ( ) . setUri ( relPath ) ; OpenCms . getResourceManager ( ) . loadResource ( cms , cms . readResource ( relPath ) , req , res ) ; return true ; } else { return false ; } } catch ( Throwable e ) { // something went wrong log the exception and return false LOG . error ( e . getMessage ( ) , e ) ; return false ; } }
Tries to load the custom error page at the given rootPath .
221
14
144,948
private boolean tryCustomErrorPage ( CmsObject cms , HttpServletRequest req , HttpServletResponse res , int errorCode ) { String siteRoot = OpenCms . getSiteManager ( ) . matchRequest ( req ) . getSiteRoot ( ) ; CmsSite site = OpenCms . getSiteManager ( ) . getSiteForSiteRoot ( siteRoot ) ; if ( site != null ) { // store current site root and URI String currentSiteRoot = cms . getRequestContext ( ) . getSiteRoot ( ) ; String currentUri = cms . getRequestContext ( ) . getUri ( ) ; try { if ( site . getErrorPage ( ) != null ) { String rootPath = site . getErrorPage ( ) ; if ( loadCustomErrorPage ( cms , req , res , rootPath ) ) { return true ; } } String rootPath = CmsStringUtil . joinPaths ( siteRoot , "/.errorpages/handle" + errorCode + ".html" ) ; if ( loadCustomErrorPage ( cms , req , res , rootPath ) ) { return true ; } } finally { cms . getRequestContext ( ) . setSiteRoot ( currentSiteRoot ) ; cms . getRequestContext ( ) . setUri ( currentUri ) ; } } return false ; }
Tries to load a site specific error page . If
289
11
144,949
private CmsVfsEntryBean buildVfsEntryBeanForQuickSearch ( CmsResource resource , Multimap < CmsResource , CmsResource > childMap , Set < CmsResource > filterMatches , Set < String > parentPaths , boolean isRoot ) throws CmsException { CmsObject cms = getCmsObject ( ) ; String title = cms . readPropertyObject ( resource , CmsPropertyDefinition . PROPERTY_TITLE , false ) . getValue ( ) ; boolean isMatch = filterMatches . contains ( resource ) ; List < CmsVfsEntryBean > childBeans = Lists . newArrayList ( ) ; Collection < CmsResource > children = childMap . get ( resource ) ; if ( ! children . isEmpty ( ) ) { for ( CmsResource child : children ) { CmsVfsEntryBean childBean = buildVfsEntryBeanForQuickSearch ( child , childMap , filterMatches , parentPaths , false ) ; childBeans . add ( childBean ) ; } } else if ( filterMatches . contains ( resource ) ) { if ( parentPaths . contains ( resource . getRootPath ( ) ) ) { childBeans = null ; } // otherwise childBeans remains an empty list } String rootPath = resource . getRootPath ( ) ; CmsVfsEntryBean result = new CmsVfsEntryBean ( rootPath , resource . getStructureId ( ) , title , CmsIconUtil . getIconClasses ( CmsIconUtil . getDisplayType ( cms , resource ) , resource . getName ( ) , true ) , isRoot , isEditable ( cms , resource ) , childBeans , isMatch ) ; String siteRoot = null ; if ( OpenCms . getSiteManager ( ) . startsWithShared ( rootPath ) ) { siteRoot = OpenCms . getSiteManager ( ) . getSharedFolder ( ) ; } else { String tempSiteRoot = OpenCms . getSiteManager ( ) . getSiteRoot ( rootPath ) ; if ( tempSiteRoot != null ) { siteRoot = tempSiteRoot ; } else { siteRoot = "" ; } } result . setSiteRoot ( siteRoot ) ; return result ; }
Recursively builds the VFS entry bean for the quick filtering function in the folder tab . <p<
496
22
144,950
protected void doPurge ( Runnable afterPurgeAction ) { if ( LOG . isInfoEnabled ( ) ) { LOG . info ( org . opencms . flex . Messages . get ( ) . getBundle ( ) . key ( org . opencms . flex . Messages . LOG_FLEXCACHE_WILL_PURGE_JSP_REPOSITORY_0 ) ) ; } File d ; d = new File ( getJspRepository ( ) + CmsFlexCache . REPOSITORY_ONLINE + File . separator ) ; CmsFileUtil . purgeDirectory ( d ) ; d = new File ( getJspRepository ( ) + CmsFlexCache . REPOSITORY_OFFLINE + File . separator ) ; CmsFileUtil . purgeDirectory ( d ) ; if ( afterPurgeAction != null ) { afterPurgeAction . run ( ) ; } if ( LOG . isInfoEnabled ( ) ) { LOG . info ( org . opencms . flex . Messages . get ( ) . getBundle ( ) . key ( org . opencms . flex . Messages . LOG_FLEXCACHE_PURGED_JSP_REPOSITORY_0 ) ) ; } }
Purges the JSP repository . <p<
276
10
144,951
private void wrongUsage ( ) { String usage = "Usage: java -cp $PATH_TO_OPENCMS_JAR org.opencms.rmi.CmsRemoteShellClient\n" + " -script=[path to script] (optional) \n" + " -registryPort=[port of RMI registry] (optional, default is " + CmsRemoteShellConstants . DEFAULT_PORT + ")\n" + " -additional=[additional commands class name] (optional)" ; System . out . println ( usage ) ; System . exit ( 1 ) ; }
Displays text which shows the valid command line parameters and then exits .
127
14
144,952
public void setAddContentInfo ( final Boolean doAddInfo ) { if ( ( null != doAddInfo ) && doAddInfo . booleanValue ( ) && ( null != m_addContentInfoForEntries ) ) { m_addContentInfoForEntries = Integer . valueOf ( DEFAULT_CONTENTINFO_ROWS ) ; } }
Setter for addContentInfo indicating if content information should be added .
74
14
144,953
public void setFileFormat ( String fileFormat ) { if ( fileFormat . toUpperCase ( ) . equals ( FileFormat . JSON . toString ( ) ) ) { m_fileFormat = FileFormat . JSON ; } }
Setter for the file format .
49
7
144,954
private void addContentInfo ( ) { if ( ! m_cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) && ( null == m_searchController . getCommon ( ) . getConfig ( ) . getSolrIndex ( ) ) && ( null != m_addContentInfoForEntries ) ) { CmsSolrQuery query = new CmsSolrQuery ( ) ; m_searchController . addQueryParts ( query , m_cms ) ; query . setStart ( Integer . valueOf ( 0 ) ) ; query . setRows ( m_addContentInfoForEntries ) ; CmsContentLoadCollectorInfo info = new CmsContentLoadCollectorInfo ( ) ; info . setCollectorClass ( this . getClass ( ) . getName ( ) ) ; info . setCollectorParams ( query . getQuery ( ) ) ; info . setId ( ( new CmsUUID ( ) ) . getStringValue ( ) ) ; if ( CmsJspTagEditable . getDirectEditProvider ( pageContext ) != null ) { try { CmsJspTagEditable . getDirectEditProvider ( pageContext ) . insertDirectEditListMetadata ( pageContext , info ) ; } catch ( JspException e ) { LOG . error ( "Could not write content info." , e ) ; } } } }
Adds the content info for the collected resources used in the This page publish dialog .
295
16
144,955
private I_CmsSearchResultWrapper getSearchResults ( ) { // The second parameter is just ignored - so it does not matter m_searchController . updateFromRequestParameters ( pageContext . getRequest ( ) . getParameterMap ( ) , false ) ; I_CmsSearchControllerCommon common = m_searchController . getCommon ( ) ; // Do not search for empty query, if configured if ( common . getState ( ) . getQuery ( ) . isEmpty ( ) && ( ! common . getConfig ( ) . getIgnoreQueryParam ( ) && ! common . getConfig ( ) . getSearchForEmptyQueryParam ( ) ) ) { return new CmsSearchResultWrapper ( m_searchController , null , null , m_cms , null ) ; } Map < String , String [ ] > queryParams = null ; boolean isEditMode = CmsJspTagEditable . isEditableRequest ( pageContext . getRequest ( ) ) ; if ( isEditMode ) { String params = "" ; if ( common . getConfig ( ) . getIgnoreReleaseDate ( ) ) { params += "&fq=released:[* TO *]" ; } if ( common . getConfig ( ) . getIgnoreExpirationDate ( ) ) { params += "&fq=expired:[* TO *]" ; } if ( ! params . isEmpty ( ) ) { queryParams = CmsRequestUtil . createParameterMap ( params . substring ( 1 ) ) ; } } CmsSolrQuery query = new CmsSolrQuery ( null , queryParams ) ; m_searchController . addQueryParts ( query , m_cms ) ; try { // use "complicated" constructor to allow more than 50 results -> set ignoreMaxResults to true // also set resource filter to allow for returning unreleased/expired resources if necessary. CmsSolrResultList solrResultList = m_index . search ( m_cms , query . clone ( ) , // use a clone of the query, since the search function manipulates the query (removes highlighting parts), but we want to keep the original one. true , isEditMode ? CmsResourceFilter . IGNORE_EXPIRATION : null ) ; return new CmsSearchResultWrapper ( m_searchController , solrResultList , query , m_cms , null ) ; } catch ( CmsSearchException e ) { LOG . warn ( Messages . get ( ) . getBundle ( ) . key ( Messages . LOG_TAG_SEARCH_SEARCH_FAILED_0 ) , e ) ; return new CmsSearchResultWrapper ( m_searchController , null , query , m_cms , e ) ; } }
Here the search query is composed and executed . The result is wrapped in an easily usable form . It is exposed to the JSP via the tag s var attribute .
583
33
144,956
public Date toDate ( Object date ) { Date d = null ; if ( null != date ) { if ( date instanceof Date ) { d = ( Date ) date ; } else if ( date instanceof Long ) { d = new Date ( ( ( Long ) date ) . longValue ( ) ) ; } else { try { long l = Long . parseLong ( date . toString ( ) ) ; d = new Date ( l ) ; } catch ( Exception e ) { // do nothing, just let d remain null } } } return d ; }
Converts the provided object to a date if possible .
116
11
144,957
public synchronized void stop ( ) { if ( m_thread != null ) { long timeBeforeShutdownWasCalled = System . currentTimeMillis ( ) ; JLANServer . shutdownServer ( new String [ ] { } ) ; while ( m_thread . isAlive ( ) && ( ( System . currentTimeMillis ( ) - timeBeforeShutdownWasCalled ) < MAX_SHUTDOWN_WAIT_MILLIS ) ) { try { Thread . sleep ( 500 ) ; } catch ( InterruptedException e ) { // ignore } } } }
Tries to stop the JLAN server and return after it is stopped but will also return if the thread hasn t stopped after MAX_SHUTDOWN_WAIT_MILLIS .
120
38
144,958
public boolean needToSetCategoryFolder ( ) { if ( m_adeModuleVersion == null ) { return true ; } CmsModuleVersion categoryFolderUpdateVersion = new CmsModuleVersion ( "9.0.0" ) ; return ( m_adeModuleVersion . compareTo ( categoryFolderUpdateVersion ) == - 1 ) ; }
Checks if the categoryfolder setting needs to be updated .
71
12
144,959
public void setWeekDays ( SortedSet < WeekDay > weekDays ) { final SortedSet < WeekDay > newWeekDays = null == weekDays ? new TreeSet < WeekDay > ( ) : weekDays ; SortedSet < WeekDay > currentWeekDays = m_model . getWeekDays ( ) ; if ( ! currentWeekDays . equals ( newWeekDays ) ) { conditionallyRemoveExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setWeekDays ( newWeekDays ) ; onValueChange ( ) ; } } , ! newWeekDays . containsAll ( m_model . getWeekDays ( ) ) ) ; } }
Set the weekdays at which the event should take place .
146
12
144,960
protected void switchTab ( ) { Component tab = m_tab . getSelectedTab ( ) ; int pos = m_tab . getTabPosition ( m_tab . getTab ( tab ) ) ; if ( m_isWebOU ) { if ( pos == 0 ) { pos = 1 ; } } m_tab . setSelectedTab ( pos + 1 ) ; }
Switches to the next tab .
80
7
144,961
protected void onEditTitleTextBox ( TextBox box ) { if ( m_titleEditHandler != null ) { m_titleEditHandler . handleEdit ( m_title , box ) ; return ; } String text = box . getText ( ) ; box . removeFromParent ( ) ; m_title . setText ( text ) ; m_title . setVisible ( true ) ; }
Internal method which is called when the user has finished editing the title .
83
14
144,962
public void setPatternScheme ( final boolean isByWeekDay , final boolean fireChange ) { if ( isByWeekDay ^ ( null != m_model . getWeekDay ( ) ) ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { if ( isByWeekDay ) { m_model . setWeekOfMonth ( getPatternDefaultValues ( ) . getWeekOfMonth ( ) ) ; m_model . setWeekDay ( getPatternDefaultValues ( ) . getWeekDay ( ) ) ; } else { m_model . clearWeekDays ( ) ; m_model . clearWeeksOfMonth ( ) ; m_model . setDayOfMonth ( getPatternDefaultValues ( ) . getDayOfMonth ( ) ) ; } m_model . setInterval ( getPatternDefaultValues ( ) . getInterval ( ) ) ; if ( fireChange ) { onValueChange ( ) ; } } } ) ; } }
Set the pattern scheme to either by weekday or by day of month .
204
14
144,963
public void setWeekDay ( String dayString ) { final WeekDay day = WeekDay . valueOf ( dayString ) ; if ( m_model . getWeekDay ( ) != day ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setWeekDay ( day ) ; onValueChange ( ) ; } } ) ; } }
Set the week day the event should take place .
81
10
144,964
public void weeksChange ( String week , Boolean value ) { final WeekOfMonth changedWeek = WeekOfMonth . valueOf ( week ) ; boolean newValue = ( null != value ) && value . booleanValue ( ) ; boolean currentValue = m_model . getWeeksOfMonth ( ) . contains ( changedWeek ) ; if ( newValue != currentValue ) { if ( newValue ) { setPatternScheme ( true , false ) ; m_model . addWeekOfMonth ( changedWeek ) ; onValueChange ( ) ; } else { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . removeWeekOfMonth ( changedWeek ) ; onValueChange ( ) ; } } ) ; } } }
Handle a change in the weeks of month .
158
9
144,965
public void validateAliases ( final CmsUUID uuid , final Map < String , String > aliasPaths , final AsyncCallback < Map < String , String > > callback ) { CmsRpcAction < Map < String , String > > action = new CmsRpcAction < Map < String , String > > ( ) { /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#execute() */ @ Override public void execute ( ) { start ( 200 , true ) ; CmsCoreProvider . getVfsService ( ) . validateAliases ( uuid , aliasPaths , this ) ; } /** * @see org.opencms.gwt.client.rpc.CmsRpcAction#onResponse(java.lang.Object) */ @ Override protected void onResponse ( Map < String , String > result ) { stop ( false ) ; callback . onSuccess ( result ) ; } } ; action . execute ( ) ; }
Validates aliases .
214
4
144,966
void setDayOfMonth ( String day ) { final int i = CmsSerialDateUtil . toIntWithDefault ( day , - 1 ) ; if ( m_model . getDayOfMonth ( ) != i ) { removeExceptionsOnChange ( new Command ( ) { public void execute ( ) { m_model . setDayOfMonth ( i ) ; onValueChange ( ) ; } } ) ; } }
Sets the day of the month .
89
8
144,967
private String convertOutputToHtml ( String content ) { if ( content . length ( ) == 0 ) { return "" ; } StringBuilder buffer = new StringBuilder ( ) ; for ( String line : content . split ( "\n" ) ) { buffer . append ( CmsEncoder . escapeXml ( line ) + "<br>" ) ; } return buffer . toString ( ) ; }
Converts the text stream data to HTML form .
83
10
144,968
private void writeToDelegate ( byte [ ] data ) { if ( m_delegateStream != null ) { try { m_delegateStream . write ( data ) ; } catch ( IOException e ) { throw new RuntimeException ( e ) ; } } }
Writes data to delegate stream if it has been set .
56
12
144,969
public static String getStatusForItem ( Long lastActivity ) { if ( lastActivity . longValue ( ) < CmsSessionsTable . INACTIVE_LIMIT ) { return CmsVaadinUtils . getMessageText ( Messages . GUI_MESSAGES_BROADCAST_COLS_STATUS_ACTIVE_0 ) ; } return CmsVaadinUtils . getMessageText ( Messages . GUI_MESSAGES_BROADCAST_COLS_STATUS_INACTIVE_0 ) ; }
Gets the status text from given session .
115
9
144,970
public static void showUserInfo ( CmsSessionInfo session ) { final Window window = CmsBasicDialog . prepareWindow ( DialogWidth . wide ) ; CmsUserInfoDialog dialog = new CmsUserInfoDialog ( session , new Runnable ( ) { public void run ( ) { window . close ( ) ; } } ) ; window . setCaption ( CmsVaadinUtils . getMessageText ( Messages . GUI_MESSAGES_SHOW_USER_0 ) ) ; window . setContent ( dialog ) ; A_CmsUI . get ( ) . addWindow ( window ) ; }
Shows a dialog with user information for given session .
132
11
144,971
@ Override public void onBrowserEvent ( Event event ) { super . onBrowserEvent ( event ) ; switch ( DOM . eventGetType ( event ) ) { case Event . ONMOUSEUP : Event . releaseCapture ( m_slider . getElement ( ) ) ; m_capturedMouse = false ; break ; case Event . ONMOUSEDOWN : Event . setCapture ( m_slider . getElement ( ) ) ; m_capturedMouse = true ; //$FALL-THROUGH$ case Event . ONMOUSEMOVE : if ( m_capturedMouse ) { event . preventDefault ( ) ; float x = ( ( event . getClientX ( ) - ( m_colorUnderlay . getAbsoluteLeft ( ) ) ) + Window . getScrollLeft ( ) ) ; float y = ( ( event . getClientY ( ) - ( m_colorUnderlay . getAbsoluteTop ( ) ) ) + Window . getScrollTop ( ) ) ; if ( m_parent != null ) { m_parent . onMapSelected ( x , y ) ; } setSliderPosition ( x , y ) ; } //$FALL-THROUGH$ default : } }
Fired whenever a browser event is received .
261
9
144,972
private void addChildrenForGroupsNode ( I_CmsOuTreeType type , String ouItem ) { try { // Cut of type-specific prefix from ouItem with substring() List < CmsGroup > groups = m_app . readGroupsForOu ( m_cms , ouItem . substring ( 1 ) , type , false ) ; for ( CmsGroup group : groups ) { Pair < String , CmsUUID > key = Pair . of ( type . getId ( ) , group . getId ( ) ) ; Item groupItem = m_treeContainer . addItem ( key ) ; if ( groupItem == null ) { groupItem = getItem ( key ) ; } groupItem . getItemProperty ( PROP_SID ) . setValue ( group . getId ( ) ) ; groupItem . getItemProperty ( PROP_NAME ) . setValue ( getIconCaptionHTML ( group , CmsOuTreeType . GROUP ) ) ; groupItem . getItemProperty ( PROP_TYPE ) . setValue ( type ) ; setChildrenAllowed ( key , false ) ; m_treeContainer . setParent ( key , ouItem ) ; } } catch ( CmsException e ) { LOG . error ( "Can not read group" , e ) ; } }
Add groups for given group parent item .
283
8
144,973
private void addChildrenForRolesNode ( String ouItem ) { try { List < CmsRole > roles = OpenCms . getRoleManager ( ) . getRoles ( m_cms , ouItem . substring ( 1 ) , false ) ; CmsRole . applySystemRoleOrder ( roles ) ; for ( CmsRole role : roles ) { String roleId = ouItem + "/" + role . getId ( ) ; Item roleItem = m_treeContainer . addItem ( roleId ) ; if ( roleItem == null ) { roleItem = getItem ( roleId ) ; } roleItem . getItemProperty ( PROP_NAME ) . setValue ( getIconCaptionHTML ( role , CmsOuTreeType . ROLE ) ) ; roleItem . getItemProperty ( PROP_TYPE ) . setValue ( CmsOuTreeType . ROLE ) ; setChildrenAllowed ( roleId , false ) ; m_treeContainer . setParent ( roleId , ouItem ) ; } } catch ( CmsException e ) { LOG . error ( "Can not read group" , e ) ; } }
Add roles for given role parent item .
247
8
144,974
public static boolean checkConfiguredInModules ( ) { Boolean result = m_moduleCheckCache . get ( ) ; if ( result == null ) { result = Boolean . valueOf ( getConfiguredTemplateMapping ( ) != null ) ; m_moduleCheckCache . set ( result ) ; } return result . booleanValue ( ) ; }
Checks if template mapper is configured in modules .
72
11
144,975
@ SuppressWarnings ( "unused" ) public static void addTo ( AbstractSingleComponentContainer componentContainer , int scrollBarrier , int barrierMargin , String styleName ) { new CmsScrollPositionCss ( componentContainer , scrollBarrier , barrierMargin , styleName ) ; }
Adds the scroll position CSS extension to the given component
64
10
144,976
protected boolean checkvalue ( String colorvalue ) { boolean valid = validateColorValue ( colorvalue ) ; if ( valid ) { if ( colorvalue . length ( ) == 4 ) { char [ ] chr = colorvalue . toCharArray ( ) ; for ( int i = 1 ; i < 4 ; i ++ ) { String foo = String . valueOf ( chr [ i ] ) ; colorvalue = colorvalue . replaceFirst ( foo , foo + foo ) ; } } m_textboxColorValue . setValue ( colorvalue , true ) ; m_colorField . getElement ( ) . getStyle ( ) . setBackgroundColor ( colorvalue ) ; m_colorValue = colorvalue ; } return valid ; }
Validates the inputed color value .
153
8
144,977
protected AllowableActions collectAllowableActions ( CmsObject cms , CmsResource file ) { try { if ( file == null ) { throw new IllegalArgumentException ( "File must not be null!" ) ; } CmsLock lock = cms . getLock ( file ) ; CmsUser user = cms . getRequestContext ( ) . getCurrentUser ( ) ; boolean canWrite = ! cms . getRequestContext ( ) . getCurrentProject ( ) . isOnlineProject ( ) && ( lock . isOwnedBy ( user ) || lock . isLockableBy ( user ) ) && cms . hasPermissions ( file , CmsPermissionSet . ACCESS_WRITE , false , CmsResourceFilter . DEFAULT ) ; boolean isReadOnly = ! canWrite ; boolean isFolder = file . isFolder ( ) ; boolean isRoot = file . getRootPath ( ) . length ( ) <= 1 ; Set < Action > aas = new LinkedHashSet < Action > ( ) ; addAction ( aas , Action . CAN_GET_OBJECT_PARENTS , ! isRoot ) ; addAction ( aas , Action . CAN_GET_PROPERTIES , true ) ; addAction ( aas , Action . CAN_UPDATE_PROPERTIES , ! isReadOnly ) ; addAction ( aas , Action . CAN_MOVE_OBJECT , ! isReadOnly && ! isRoot ) ; addAction ( aas , Action . CAN_DELETE_OBJECT , ! isReadOnly && ! isRoot ) ; if ( isFolder ) { addAction ( aas , Action . CAN_GET_DESCENDANTS , true ) ; addAction ( aas , Action . CAN_GET_CHILDREN , true ) ; addAction ( aas , Action . CAN_GET_FOLDER_PARENT , ! isRoot ) ; addAction ( aas , Action . CAN_GET_FOLDER_TREE , true ) ; addAction ( aas , Action . CAN_CREATE_DOCUMENT , ! isReadOnly ) ; addAction ( aas , Action . CAN_CREATE_FOLDER , ! isReadOnly ) ; addAction ( aas , Action . CAN_DELETE_TREE , ! isReadOnly ) ; } else { addAction ( aas , Action . CAN_GET_CONTENT_STREAM , true ) ; addAction ( aas , Action . CAN_SET_CONTENT_STREAM , ! isReadOnly ) ; addAction ( aas , Action . CAN_GET_ALL_VERSIONS , true ) ; } AllowableActionsImpl result = new AllowableActionsImpl ( ) ; result . setAllowableActions ( aas ) ; return result ; } catch ( CmsException e ) { handleCmsException ( e ) ; return null ; } }
Compiles the allowable actions for a file or folder .
622
11
144,978
public static String getStatusText ( int nHttpStatusCode ) { Integer intKey = new Integer ( nHttpStatusCode ) ; if ( ! mapStatusCodes . containsKey ( intKey ) ) { return "" ; } else { return mapStatusCodes . get ( intKey ) ; } }
Returns the HTTP status text for the HTTP or WebDav status code specified by looking it up in the static mapping . This is a static function .
63
30
144,979
private boolean addType ( TypeDefinition type ) { if ( type == null ) { return false ; } if ( type . getBaseTypeId ( ) == null ) { return false ; } // find base type TypeDefinition baseType = null ; if ( type . getBaseTypeId ( ) == BaseTypeId . CMIS_DOCUMENT ) { baseType = copyTypeDefintion ( m_types . get ( DOCUMENT_TYPE_ID ) . getTypeDefinition ( ) ) ; } else if ( type . getBaseTypeId ( ) == BaseTypeId . CMIS_FOLDER ) { baseType = copyTypeDefintion ( m_types . get ( FOLDER_TYPE_ID ) . getTypeDefinition ( ) ) ; } else if ( type . getBaseTypeId ( ) == BaseTypeId . CMIS_RELATIONSHIP ) { baseType = copyTypeDefintion ( m_types . get ( RELATIONSHIP_TYPE_ID ) . getTypeDefinition ( ) ) ; } else if ( type . getBaseTypeId ( ) == BaseTypeId . CMIS_POLICY ) { baseType = copyTypeDefintion ( m_types . get ( POLICY_TYPE_ID ) . getTypeDefinition ( ) ) ; } else { return false ; } AbstractTypeDefinition newType = ( AbstractTypeDefinition ) copyTypeDefintion ( type ) ; // copy property definition for ( PropertyDefinition < ? > propDef : baseType . getPropertyDefinitions ( ) . values ( ) ) { ( ( AbstractPropertyDefinition < ? > ) propDef ) . setIsInherited ( Boolean . TRUE ) ; newType . addPropertyDefinition ( propDef ) ; } // add it addTypeInternal ( newType ) ; return true ; }
Adds a type to collection with inheriting base type properties .
375
12
144,980
public String buildRadio ( String propName ) throws CmsException { String propVal = readProperty ( propName ) ; StringBuffer result = new StringBuffer ( "<table border=\"0\"><tr>" ) ; result . append ( "<td><input type=\"radio\" value=\"true\" onClick=\"checkNoIntern()\" name=\"" ) . append ( propName ) . append ( "\" " ) . append ( Boolean . valueOf ( propVal ) . booleanValue ( ) ? "checked=\"checked\"" : "" ) . append ( "/></td><td id=\"tablelabel\">" ) . append ( key ( Messages . GUI_LABEL_TRUE_0 ) ) . append ( "</td>" ) ; result . append ( "<td><input type=\"radio\" value=\"false\" onClick=\"checkNoIntern()\" name=\"" ) . append ( propName ) . append ( "\" " ) . append ( Boolean . valueOf ( propVal ) . booleanValue ( ) ? "" : "checked=\"checked\"" ) . append ( "/></td><td id=\"tablelabel\">" ) . append ( key ( Messages . GUI_LABEL_FALSE_0 ) ) . append ( "</td>" ) ; result . append ( "<td><input type=\"radio\" value=\"\" onClick=\"checkNoIntern()\" name=\"" ) . append ( propName ) . append ( "\" " ) . append ( CmsStringUtil . isEmpty ( propVal ) ? "checked=\"checked\"" : "" ) . append ( "/></td><td id=\"tablelabel\">" ) . append ( getPropertyInheritanceInfo ( propName ) ) . append ( "</td></tr></table>" ) ; return result . toString ( ) ; }
Builds the radio input to set the export and secure property .
378
13
144,981
public void setCategoryDisplayOptions ( String displayCategoriesByRepository , String displayCategorySelectionCollapsed ) { m_displayCategoriesByRepository = Boolean . parseBoolean ( displayCategoriesByRepository ) ; m_displayCategorySelectionCollapsed = Boolean . parseBoolean ( displayCategorySelectionCollapsed ) ; }
Sets the category display options that affect how the category selection dialog is shown .
71
16
144,982
protected boolean showMoreEntries ( Calendar nextDate , int previousOccurrences ) { switch ( getSerialEndType ( ) ) { case DATE : boolean moreByDate = nextDate . getTimeInMillis ( ) < m_endMillis ; boolean moreByOccurrences = previousOccurrences < CmsSerialDateUtil . getMaxEvents ( ) ; if ( moreByDate && ! moreByOccurrences ) { m_hasTooManyOccurrences = Boolean . TRUE ; } return moreByDate && moreByOccurrences ; case TIMES : case SINGLE : return previousOccurrences < getOccurrences ( ) ; default : throw new IllegalArgumentException ( ) ; } }
Check if the provided date or any date after it are part of the series .
153
16
144,983
private SortedSet < Date > calculateDates ( ) { if ( null == m_allDates ) { SortedSet < Date > result = new TreeSet <> ( ) ; if ( isAnyDatePossible ( ) ) { Calendar date = getFirstDate ( ) ; int previousOccurrences = 0 ; while ( showMoreEntries ( date , previousOccurrences ) ) { result . add ( date . getTime ( ) ) ; toNextDate ( date ) ; previousOccurrences ++ ; } } m_allDates = result ; } return m_allDates ; }
Calculates all dates of the series .
128
9
144,984
private SortedSet < Date > filterExceptions ( SortedSet < Date > dates ) { SortedSet < Date > result = new TreeSet < Date > ( ) ; for ( Date d : dates ) { if ( ! m_exceptions . contains ( d ) ) { result . add ( d ) ; } } return result ; }
Filters all exceptions from the provided dates .
72
9
144,985
private void setHeaderList ( Map < String , List < String > > headers , String name , String value ) { List < String > values = new ArrayList < String > ( ) ; values . add ( SET_HEADER + value ) ; headers . put ( name , values ) ; }
Helper method to set a value in the internal header list .
61
12
144,986
public static String changeFileNameSuffixTo ( String filename , String suffix ) { int dotPos = filename . lastIndexOf ( ' ' ) ; if ( dotPos != - 1 ) { return filename . substring ( 0 , dotPos + 1 ) + suffix ; } else { // the string has no suffix return filename ; } }
Changes the given filenames suffix from the current suffix to the provided suffix .
71
16
144,987
public static final long parseDuration ( String durationStr , long defaultValue ) { durationStr = durationStr . toLowerCase ( ) . trim ( ) ; Matcher matcher = DURATION_NUMBER_AND_UNIT_PATTERN . matcher ( durationStr ) ; long millis = 0 ; boolean matched = false ; while ( matcher . find ( ) ) { long number = Long . valueOf ( matcher . group ( 1 ) ) . longValue ( ) ; String unit = matcher . group ( 2 ) ; long multiplier = 0 ; for ( int j = 0 ; j < DURATION_UNTIS . length ; j ++ ) { if ( unit . equals ( DURATION_UNTIS [ j ] ) ) { multiplier = DURATION_MULTIPLIERS [ j ] ; break ; } } if ( multiplier == 0 ) { LOG . warn ( "parseDuration: Unknown unit " + unit ) ; } else { matched = true ; } millis += number * multiplier ; } if ( ! matched ) { millis = defaultValue ; } return millis ; }
Parses a duration and returns the corresponding number of milliseconds .
236
13
144,988
public static StringTemplateGroup readStringTemplateGroup ( InputStream stream ) { try { return new StringTemplateGroup ( new InputStreamReader ( stream , "UTF-8" ) , DefaultTemplateLexer . class , new StringTemplateErrorListener ( ) { @ SuppressWarnings ( "synthetic-access" ) public void error ( String arg0 , Throwable arg1 ) { LOG . error ( arg0 + ": " + arg1 . getMessage ( ) , arg1 ) ; } @ SuppressWarnings ( "synthetic-access" ) public void warning ( String arg0 ) { LOG . warn ( arg0 ) ; } } ) ; } catch ( Exception e ) { LOG . error ( e . getLocalizedMessage ( ) , e ) ; return new StringTemplateGroup ( "dummy" ) ; } }
Reads a stringtemplate group from a stream .
178
10
144,989
public static void fire ( I_CmsHasDateBoxEventHandlers source , Date date , boolean isTyping ) { if ( TYPE != null ) { CmsDateBoxEvent event = new CmsDateBoxEvent ( date , isTyping ) ; source . fireEvent ( event ) ; } }
Fires the event .
64
5
144,990
protected CmsProject createAndSetModuleImportProject ( CmsObject cms , CmsModule module ) throws CmsException { CmsProject importProject = cms . createProject ( org . opencms . module . Messages . get ( ) . getBundle ( cms . getRequestContext ( ) . getLocale ( ) ) . key ( org . opencms . module . Messages . GUI_IMPORT_MODULE_PROJECT_NAME_1 , new Object [ ] { module . getName ( ) } ) , org . opencms . module . Messages . get ( ) . getBundle ( cms . getRequestContext ( ) . getLocale ( ) ) . key ( org . opencms . module . Messages . GUI_IMPORT_MODULE_PROJECT_DESC_1 , new Object [ ] { module . getName ( ) } ) , OpenCms . getDefaultUsers ( ) . getGroupAdministrators ( ) , OpenCms . getDefaultUsers ( ) . getGroupAdministrators ( ) , CmsProject . PROJECT_TYPE_TEMPORARY ) ; cms . getRequestContext ( ) . setCurrentProject ( importProject ) ; cms . copyResourceToProject ( "/" ) ; return importProject ; }
Creates the project used to import module resources and sets it on the CmsObject .
269
18
144,991
protected void deleteConflictingResources ( CmsObject cms , CmsModule module , Map < CmsUUID , CmsUUID > conflictingIds ) throws CmsException , Exception { CmsProject conflictProject = cms . createProject ( "Deletion of conflicting resources for " + module . getName ( ) , "Deletion of conflicting resources for " + module . getName ( ) , OpenCms . getDefaultUsers ( ) . getGroupAdministrators ( ) , OpenCms . getDefaultUsers ( ) . getGroupAdministrators ( ) , CmsProject . PROJECT_TYPE_TEMPORARY ) ; CmsObject deleteCms = OpenCms . initCmsObject ( cms ) ; deleteCms . getRequestContext ( ) . setCurrentProject ( conflictProject ) ; for ( CmsUUID vfsId : conflictingIds . values ( ) ) { CmsResource toDelete = deleteCms . readResource ( vfsId , CmsResourceFilter . ALL ) ; lock ( deleteCms , toDelete ) ; deleteCms . deleteResource ( toDelete , CmsResource . DELETE_PRESERVE_SIBLINGS ) ; } OpenCms . getPublishManager ( ) . publishProject ( deleteCms ) ; OpenCms . getPublishManager ( ) . waitWhileRunning ( ) ; }
Deletes and publishes resources with ID conflicts .
294
9
144,992
protected void parseLinks ( CmsObject cms ) throws CmsException { List < CmsResource > linkParseables = new ArrayList <> ( ) ; for ( CmsResourceImportData resData : m_moduleData . getResourceData ( ) ) { CmsResource importRes = resData . getImportResource ( ) ; if ( ( importRes != null ) && m_importIds . contains ( importRes . getStructureId ( ) ) && isLinkParsable ( importRes ) ) { linkParseables . add ( importRes ) ; } } m_report . println ( Messages . get ( ) . container ( Messages . RPT_START_PARSE_LINKS_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; CmsImportVersion10 . parseLinks ( cms , linkParseables , m_report ) ; m_report . println ( Messages . get ( ) . container ( Messages . RPT_END_PARSE_LINKS_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; }
Parses links for XMLContents etc .
236
9
144,993
protected void processDeletions ( CmsObject cms , List < CmsResource > toDelete ) throws CmsException { Collections . sort ( toDelete , ( a , b ) -> b . getRootPath ( ) . compareTo ( a . getRootPath ( ) ) ) ; for ( CmsResource deleteRes : toDelete ) { m_report . print ( org . opencms . importexport . Messages . get ( ) . container ( org . opencms . importexport . Messages . RPT_DELFOLDER_0 ) , I_CmsReport . FORMAT_NOTE ) ; m_report . print ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_ARGUMENT_1 , deleteRes . getRootPath ( ) ) ) ; CmsLock lock = cms . getLock ( deleteRes ) ; if ( lock . isUnlocked ( ) ) { lock ( cms , deleteRes ) ; } cms . deleteResource ( deleteRes , CmsResource . DELETE_PRESERVE_SIBLINGS ) ; m_report . println ( org . opencms . report . Messages . get ( ) . container ( org . opencms . report . Messages . RPT_OK_0 ) , I_CmsReport . FORMAT_OK ) ; } }
Handles the file deletions .
293
7
144,994
protected void runImportScript ( CmsObject cms , CmsModule module ) { LOG . info ( "Executing import script for module " + module . getName ( ) ) ; m_report . println ( org . opencms . module . Messages . get ( ) . container ( org . opencms . module . Messages . RPT_IMPORT_SCRIPT_HEADER_0 ) , I_CmsReport . FORMAT_HEADLINE ) ; String importScript = "echo on\n" + module . getImportScript ( ) ; ByteArrayOutputStream buffer = new ByteArrayOutputStream ( ) ; PrintStream out = new PrintStream ( buffer ) ; CmsShell shell = new CmsShell ( cms , "${user}@${project}:${siteroot}|${uri}>" , null , out , out ) ; shell . execute ( importScript ) ; String outputString = buffer . toString ( ) ; LOG . info ( "Shell output for import script was: \n" + outputString ) ; m_report . println ( org . opencms . module . Messages . get ( ) . container ( org . opencms . module . Messages . RPT_IMPORT_SCRIPT_OUTPUT_1 , outputString ) ) ; }
Runs the module import script .
270
7
144,995
public Map < String , List < Locale > > getAvailableLocales ( ) { if ( m_availableLocales == null ) { // create lazy map only on demand m_availableLocales = CmsCollectionsGenericWrapper . createLazyMap ( new CmsAvailableLocaleLoaderTransformer ( ) ) ; } return m_availableLocales ; }
Returns a lazily generated map from site paths of resources to the available locales for the resource .
77
20
144,996
private static CmsObject adjustSiteRootIfNecessary ( final CmsObject cms , final CmsModule module ) throws CmsException { CmsObject cmsClone ; if ( ( null == module . getSite ( ) ) || cms . getRequestContext ( ) . getSiteRoot ( ) . equals ( module . getSite ( ) ) ) { cmsClone = cms ; } else { cmsClone = OpenCms . initCmsObject ( cms ) ; cmsClone . getRequestContext ( ) . setSiteRoot ( module . getSite ( ) ) ; } return cmsClone ; }
Adjusts the site root and returns a cloned CmsObject iff the module has set an import site that differs from the site root of the CmsObject provided as argument . Otherwise returns the provided CmsObject unchanged .
139
46
144,997
public boolean shouldIncrementVersionBasedOnResources ( CmsObject cms ) throws CmsException { if ( m_checkpointTime == 0 ) { return true ; } // adjust the site root, if necessary CmsObject cmsClone = adjustSiteRootIfNecessary ( cms , this ) ; // calculate the module resources List < CmsResource > moduleResources = calculateModuleResources ( cmsClone , this ) ; for ( CmsResource resource : moduleResources ) { try { List < CmsResource > resourcesToCheck = Lists . newArrayList ( ) ; resourcesToCheck . add ( resource ) ; if ( resource . isFolder ( ) ) { resourcesToCheck . addAll ( cms . readResources ( resource , CmsResourceFilter . IGNORE_EXPIRATION , true ) ) ; } for ( CmsResource resourceToCheck : resourcesToCheck ) { if ( resourceToCheck . getDateLastModified ( ) > m_checkpointTime ) { return true ; } } } catch ( CmsException e ) { LOG . warn ( e . getLocalizedMessage ( ) , e ) ; continue ; } } return false ; }
Determines if the version should be incremented based on the module resources modification dates .
248
18
144,998
public Class < ? > getColumnType ( int c ) { for ( int r = 0 ; r < m_data . size ( ) ; r ++ ) { Object val = m_data . get ( r ) . get ( c ) ; if ( val != null ) { return val . getClass ( ) ; } } return Object . class ; }
Gets the type to use for the Vaadin table column corresponding to the c - th column in this result .
74
23
144,999
public String getCsv ( ) { StringWriter writer = new StringWriter ( ) ; try ( CSVWriter csv = new CSVWriter ( writer ) ) { List < String > headers = new ArrayList <> ( ) ; for ( String col : m_columns ) { headers . add ( col ) ; } csv . writeNext ( headers . toArray ( new String [ ] { } ) ) ; for ( List < Object > row : m_data ) { List < String > colCsv = new ArrayList <> ( ) ; for ( Object col : row ) { colCsv . add ( String . valueOf ( col ) ) ; } csv . writeNext ( colCsv . toArray ( new String [ ] { } ) ) ; } return writer . toString ( ) ; } catch ( IOException e ) { return null ; } }
Converts the results to CSV data .
183
8