1 package org.apache.maven.archiva.indexer.search;
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
22 import org.apache.commons.lang.StringUtils;
23 import org.apache.maven.archiva.model.ArchivaArtifact;
25 import java.util.ArrayList;
26 import java.util.List;
33 public class SearchResultHit
35 // The (optional) context for this result.
36 private String context;
38 // Basic hit, direct to non-artifact resource.
41 // Advanced hit, reference to groupId.
42 private String groupId;
44 // Advanced hit, reference to artifactId.
45 private String artifactId;
47 private String version = "";
49 private String repositoryId = "";
51 // Advanced hit, if artifact, all versions of artifact
52 private List artifacts = new ArrayList();
54 private List versions = new ArrayList();
56 public String getContext()
61 public void setContext( String context )
63 this.context = context;
66 public String getUrl()
71 public void setUrl( String url )
76 public String getUrlFilename()
78 return this.url.substring( this.url.lastIndexOf( '/' ) );
81 public String getArtifactId()
86 public void setArtifactId( String artifactId )
88 this.artifactId = artifactId;
91 public void addArtifact( ArchivaArtifact artifact )
93 this.artifacts.add( artifact );
95 String ver = artifact.getVersion();
97 if ( !this.versions.contains( ver ) )
99 this.versions.add( ver );
102 if ( StringUtils.isBlank( this.groupId ) )
104 this.groupId = artifact.getGroupId();
107 if ( StringUtils.isBlank( this.artifactId ) )
109 this.artifactId = artifact.getArtifactId();
112 if ( StringUtils.isBlank( this.version ) )
118 public List getArtifacts()
123 public String getGroupId()
128 public void setGroupId( String groupId )
130 this.groupId = groupId;
133 public String getVersion()
138 public List getVersions()
143 public String getRepositoryId()
148 public void setRepositoryId( String repositoryId )
150 this.repositoryId = repositoryId;