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 .