private static final String COMPLETE_QUERY_STRING_SEPARATOR = ";";
- private List<String> managedRepositoryList = new ArrayList<String>();
+ private List<String> managedRepositoryList = new ArrayList<String>( );
private String groupId;
private String className;
+ /**
+ * contains osgi metadata Bundle-Version if available
+ *
+ * @since 1.4
+ */
+ private String bundleVersion;
+
+ /**
+ * contains osgi metadata Bundle-SymbolicName if available
+ *
+ * @since 1.4
+ */
+ private String bundleSymbolicName;
+
+ /**
+ * contains osgi metadata Export-Package if available
+ *
+ * @since 1.4
+ */
+ private String bundleExportPackage;
+
+ /**
+ * contains osgi metadata import package if available
+ *
+ * @since 1.4
+ */
+ private String bundleImportPackage;
+
+ /**
+ * contains osgi metadata name if available
+ *
+ * @since 1.4
+ */
+ private String bundleName;
+
+ /**
+ * contains osgi metadata Export-Service if available
+ *
+ * @since 1.4
+ */
+ private String bundleExportService;
+
private int rowCount = 30;
private String repositoryId;
private String infoMessage;
- public boolean isFromResultsPage()
+ public boolean isFromResultsPage( )
{
return fromResultsPage;
}
this.fromResultsPage = fromResultsPage;
}
- public boolean isFromFilterSearch()
+ public boolean isFromFilterSearch( )
{
return fromFilterSearch;
}
this.fromFilterSearch = fromFilterSearch;
}
- public void prepare()
+ public void prepare( )
{
- managedRepositoryList = getObservableRepos();
+ managedRepositoryList = getObservableRepos( );
- if ( managedRepositoryList.size() > 0 )
+ if ( managedRepositoryList.size( ) > 0 )
{
managedRepositoryList.add( "all" );
}
- searchFields = new LinkedHashMap<String, String>();
+ searchFields = new LinkedHashMap<String, String>( );
searchFields.put( "groupId", "Group ID" );
searchFields.put( "artifactId", "Artifact ID" );
searchFields.put( "version", "Version" );
searchFields.put( "className", "Class/Package Name" );
searchFields.put( "rowCount", "Row Count" );
+ searchFields.put( "bundleVersion", "OSGI Bundle Version" );
+ searchFields.put( "bundleSymbolicName", "OSGI Bundle-SymbolicName" );
+ searchFields.put( "bundleExportPackage", "OSGI Export-Package" );
+ searchFields.put( "bundleImportPackage", "OSGI import package" );
+ searchFields.put( "bundleName", "OSGI name" );
+ searchFields.put( "bundleExportService", "OSGI Export-Service" );
- super.clearErrorsAndMessages();
- clearSearchFields();
+ super.clearErrorsAndMessages( );
+ clearSearchFields( );
}
- private void clearSearchFields()
+ private void clearSearchFields( )
{
repositoryId = "";
artifactId = "";
}
// advanced search MRM-90 -- filtered search
- public String filteredSearch()
+ public String filteredSearch( )
throws MalformedURLException
{
- if ( ( groupId == null || "".equals( groupId ) ) && ( artifactId == null || "".equals( artifactId ) )
- && ( className == null || "".equals( className ) ) && ( version == null || "".equals( version ) ) )
+ if ( StringUtils.isBlank( groupId ) && StringUtils.isBlank( artifactId ) && StringUtils.isBlank( className )
+ && StringUtils.isBlank( version ) && StringUtils.isBlank( bundleExportPackage ) && StringUtils.isBlank(
+ bundleExportService ) && StringUtils.isBlank( bundleImportPackage ) && StringUtils.isBlank( bundleName )
+ && StringUtils.isBlank( bundleSymbolicName ) && StringUtils.isBlank( bundleVersion ) )
{
addActionError( "Advanced Search - At least one search criteria must be provided." );
return INPUT;
SearchResultLimits limits = new SearchResultLimits( currentPage );
limits.setPageSize( rowCount );
- List<String> selectedRepos = new ArrayList<String>();
+ List<String> selectedRepos = new ArrayList<String>( );
if ( repositoryId == null || StringUtils.isBlank( repositoryId ) || "all".equals(
StringUtils.stripToEmpty( repositoryId ) ) )
{
- selectedRepos = getObservableRepos();
+ selectedRepos = getObservableRepos( );
}
else
{
SearchFields searchFields = new SearchFields( groupId, artifactId, version, null, className, selectedRepos );
+ if ( StringUtils.isNotBlank( this.bundleExportPackage ) )
+ {
+ searchFields.setBundleExportPackage( this.bundleExportPackage );
+ }
+
+ if ( StringUtils.isNotBlank( this.bundleExportService ) )
+ {
+ searchFields.setBundleExportService( this.bundleExportService );
+ }
+
+ if ( StringUtils.isNotBlank( this.bundleImportPackage ) )
+ {
+ searchFields.setBundleImportPackage( this.bundleImportPackage );
+ }
+
+ if ( StringUtils.isNotBlank( this.bundleSymbolicName ) )
+ {
+ searchFields.setBundleSymbolicName( this.bundleSymbolicName );
+ }
+
+ if ( StringUtils.isNotBlank( this.bundleName ) )
+ {
+ searchFields.setBundleName( this.bundleName );
+ }
+
+ if ( StringUtils.isNotBlank( this.bundleVersion ) )
+ {
+ searchFields.setBundleVersion( this.bundleVersion );
+ }
+
log.debug( "filteredSearch with searchFields {}", searchFields );
// TODO: add packaging in the list of fields for advanced search (UI)?
try
{
- results = getNexusSearch().search( getPrincipal(), searchFields, limits );
+ results = getNexusSearch( ).search( getPrincipal( ), searchFields, limits );
}
catch ( RepositorySearchException e )
{
- addActionError( e.getMessage() );
+ addActionError( e.getMessage( ) );
return ERROR;
}
- if ( results.isEmpty() )
+ if ( results.isEmpty( ) )
{
addActionError( "No results found" );
return INPUT;
}
- totalPages = results.getTotalHits() / limits.getPageSize();
+ totalPages = results.getTotalHits( ) / limits.getPageSize( );
- if ( ( results.getTotalHits() % limits.getPageSize() ) != 0 )
+ if ( ( results.getTotalHits( ) % limits.getPageSize( ) ) != 0 )
{
totalPages = totalPages + 1;
}
- for ( SearchResultHit hit : results.getHits() )
+ for ( SearchResultHit hit : results.getHits( ) )
{
// fix version ?
//hit.setVersion( VersionUtil.getBaseVersion( version ) );
}
@SuppressWarnings( "unchecked" )
- public String quickSearch()
+ public String quickSearch( )
throws MalformedURLException
{
/* TODO: give action message if indexing is in progress.
* present in the full text search.
*/
- assert q != null && q.length() != 0;
+ assert q != null && q.length( ) != 0;
fromFilterSearch = false;
SearchResultLimits limits = new SearchResultLimits( currentPage );
- List<String> selectedRepos = getObservableRepos();
+ List<String> selectedRepos = getObservableRepos( );
if ( CollectionUtils.isEmpty( selectedRepos ) )
{
return GlobalResults.ACCESS_TO_NO_REPOS;
if ( searchResultsOnly && !completeQueryString.equals( "" ) )
{
results =
- getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, parseCompleteQueryString() );
+ getNexusSearch( ).search( getPrincipal( ), selectedRepos, q, limits, parseCompleteQueryString( ) );
}
else
{
completeQueryString = "";
- results = getNexusSearch().search( getPrincipal(), selectedRepos, q, limits, null );
+ results = getNexusSearch( ).search( getPrincipal( ), selectedRepos, q, limits, null );
}
}
catch ( RepositorySearchException e )
{
- addActionError( e.getMessage() );
+ addActionError( e.getMessage( ) );
return ERROR;
}
- if ( results.isEmpty() )
+ if ( results.isEmpty( ) )
{
addActionError( "No results found" );
return INPUT;
}
- totalPages = results.getTotalHits() / limits.getPageSize();
+ totalPages = results.getTotalHits( ) / limits.getPageSize( );
- if ( ( results.getTotalHits() % limits.getPageSize() ) != 0 )
+ if ( ( results.getTotalHits( ) % limits.getPageSize( ) ) != 0 )
{
totalPages = totalPages + 1;
}
return SUCCESS;
}
- public String findArtifact()
+ public String findArtifact( )
throws Exception
{
// TODO: give action message if indexing is in progress
return INPUT;
}
- databaseResults = new ArrayList<ArtifactMetadata>();
- RepositorySession repositorySession = repositorySessionFactory.createSession();
+ databaseResults = new ArrayList<ArtifactMetadata>( );
+ RepositorySession repositorySession = repositorySessionFactory.createSession( );
try
{
- MetadataRepository metadataRepository = repositorySession.getRepository();
- for ( String repoId : getObservableRepos() )
+ MetadataRepository metadataRepository = repositorySession.getRepository( );
+ for ( String repoId : getObservableRepos( ) )
{
databaseResults.addAll( metadataRepository.getArtifactsByChecksum( repoId, q ) );
}
}
finally
{
- repositorySession.close();
+ repositorySession.close( );
}
- if ( databaseResults.isEmpty() )
+ if ( databaseResults.isEmpty( ) )
{
addActionError( "No results found" );
return INPUT;
}
- if ( databaseResults.size() == 1 )
+ if ( databaseResults.size( ) == 1 )
{
// 1 hit? return it's information directly!
return ARTIFACT;
return RESULTS;
}
- public String doInput()
+ public String doInput( )
{
return INPUT;
}
}
}
- private List<String> parseCompleteQueryString()
+ private List<String> parseCompleteQueryString( )
{
- List<String> parsedCompleteQueryString = new ArrayList<String>();
+ List<String> parsedCompleteQueryString = new ArrayList<String>( );
String[] parsed = StringUtils.split( completeQueryString, COMPLETE_QUERY_STRING_SEPARATOR );
CollectionUtils.addAll( parsedCompleteQueryString, parsed );
return false;
}
- public String getQ()
+ public String getQ( )
{
return q;
}
this.q = q;
}
- public SearchResults getResults()
+ public SearchResults getResults( )
{
return results;
}
- public List<ArtifactMetadata> getDatabaseResults()
+ public List<ArtifactMetadata> getDatabaseResults( )
{
return databaseResults;
}
this.currentPage = page;
}
- public int getCurrentPage()
+ public int getCurrentPage( )
{
return currentPage;
}
- public int getTotalPages()
+ public int getTotalPages( )
{
return totalPages;
}
this.totalPages = totalPages;
}
- public boolean isSearchResultsOnly()
+ public boolean isSearchResultsOnly( )
{
return searchResultsOnly;
}
this.searchResultsOnly = searchResultsOnly;
}
- public String getCompleteQueryString()
+ public String getCompleteQueryString( )
{
return completeQueryString;
}
this.completeQueryString = completeQueryString;
}
- public Map<String, ManagedRepository> getManagedRepositories() throws RepositoryAdminException
+ public Map<String, ManagedRepository> getManagedRepositories( )
+ throws RepositoryAdminException
{
- return managedRepositoryAdmin.getManagedRepositoriesAsMap();
+ return managedRepositoryAdmin.getManagedRepositoriesAsMap( );
}
// wtf : does nothing ??
{
}
- public String getGroupId()
+ public String getGroupId( )
{
return groupId;
}
this.groupId = groupId;
}
- public String getArtifactId()
+ public String getArtifactId( )
{
return artifactId;
}
this.artifactId = artifactId;
}
- public String getVersion()
+ public String getVersion( )
{
return version;
}
this.version = version;
}
- public int getRowCount()
+ public int getRowCount( )
{
return rowCount;
}
this.rowCount = rowCount;
}
- public boolean isFilterSearch()
+ public boolean isFilterSearch( )
{
return filterSearch;
}
this.filterSearch = filterSearch;
}
- public String getRepositoryId()
+ public String getRepositoryId( )
{
return repositoryId;
}
this.repositoryId = repositoryId;
}
- public List<String> getManagedRepositoryList()
+ public List<String> getManagedRepositoryList( )
{
return managedRepositoryList;
}
this.managedRepositoryList = managedRepositoryList;
}
- public String getClassName()
+ public String getClassName( )
{
return className;
}
this.className = className;
}
- public RepositorySearch getNexusSearch()
+ public RepositorySearch getNexusSearch( )
{
if ( nexusSearch == null )
{
- WebApplicationContext wac =
- WebApplicationContextUtils.getRequiredWebApplicationContext( ServletActionContext.getServletContext() );
+ WebApplicationContext wac = WebApplicationContextUtils.getRequiredWebApplicationContext(
+ ServletActionContext.getServletContext( ) );
nexusSearch = wac.getBean( "nexusSearch", RepositorySearch.class );
}
return nexusSearch;
this.nexusSearch = nexusSearch;
}
- public Map<String, String> getSearchFields()
+ public Map<String, String> getSearchFields( )
{
return searchFields;
}
this.searchFields = searchFields;
}
- public String getInfoMessage()
+ public String getInfoMessage( )
{
return infoMessage;
}
this.infoMessage = infoMessage;
}
- public ManagedRepositoryAdmin getManagedRepositoryAdmin()
+ public ManagedRepositoryAdmin getManagedRepositoryAdmin( )
{
return managedRepositoryAdmin;
}
{
this.managedRepositoryAdmin = managedRepositoryAdmin;
}
+
+ public String getBundleVersion( )
+ {
+ return bundleVersion;
+ }
+
+ public void setBundleVersion( String bundleVersion )
+ {
+ this.bundleVersion = bundleVersion;
+ }
+
+ public String getBundleSymbolicName( )
+ {
+ return bundleSymbolicName;
+ }
+
+ public void setBundleSymbolicName( String bundleSymbolicName )
+ {
+ this.bundleSymbolicName = bundleSymbolicName;
+ }
+
+ public String getBundleExportPackage( )
+ {
+ return bundleExportPackage;
+ }
+
+ public void setBundleExportPackage( String bundleExportPackage )
+ {
+ this.bundleExportPackage = bundleExportPackage;
+ }
+
+ public String getBundleImportPackage( )
+ {
+ return bundleImportPackage;
+ }
+
+ public void setBundleImportPackage( String bundleImportPackage )
+ {
+ this.bundleImportPackage = bundleImportPackage;
+ }
+
+ public String getBundleName( )
+ {
+ return bundleName;
+ }
+
+ public void setBundleName( String bundleName )
+ {
+ this.bundleName = bundleName;
+ }
+
+ public String getBundleExportService( )
+ {
+ return bundleExportService;
+ }
+
+ public void setBundleExportService( String bundleExportService )
+ {
+ this.bundleExportService = bundleExportService;
+ }
}