mirror of https://github.com/apache/archiva.git
fixed formatting
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@951294 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
a82088bc3f
commit
652118afbd
|
@ -48,14 +48,14 @@ import java.util.HashMap;
|
||||||
import java.util.LinkedHashMap;
|
import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.TreeMap;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Browse the repository.
|
* Browse the repository.
|
||||||
*
|
*
|
||||||
* TODO change name to ShowVersionedAction to conform to terminology.
|
* TODO change name to ShowVersionedAction to conform to terminology.
|
||||||
*
|
*
|
||||||
* @plexus.component role="com.opensymphony.xwork2.Action" role-hint="showArtifactAction" instantiation-strategy="per-lookup"
|
* @plexus.component role="com.opensymphony.xwork2.Action" role-hint="showArtifactAction"
|
||||||
|
* instantiation-strategy="per-lookup"
|
||||||
*/
|
*/
|
||||||
public class ShowArtifactAction
|
public class ShowArtifactAction
|
||||||
extends AbstractRepositoryBasedAction
|
extends AbstractRepositoryBasedAction
|
||||||
|
@ -118,11 +118,9 @@ public class ShowArtifactAction
|
||||||
|
|
||||||
private String propertyValue;
|
private String propertyValue;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show the versioned project information tab.
|
* Show the versioned project information tab. TODO: Change name to 'project' - we are showing project versions
|
||||||
* TODO: Change name to 'project' - we are showing project versions here, not specific artifact information (though
|
* here, not specific artifact information (though that is rendered in the download box).
|
||||||
* that is rendered in the download box).
|
|
||||||
*/
|
*/
|
||||||
public String artifact()
|
public String artifact()
|
||||||
{
|
{
|
||||||
|
@ -177,17 +175,19 @@ public class ShowArtifactAction
|
||||||
{
|
{
|
||||||
repositoryId = repoId;
|
repositoryId = repoId;
|
||||||
|
|
||||||
List<ArtifactMetadata> artifacts = new ArrayList<ArtifactMetadata>(
|
List<ArtifactMetadata> artifacts =
|
||||||
metadataResolver.getArtifacts( repoId, groupId, artifactId, version ) );
|
new ArrayList<ArtifactMetadata>( metadataResolver.getArtifacts( repoId, groupId, artifactId,
|
||||||
|
version ) );
|
||||||
Collections.sort( artifacts, new Comparator<ArtifactMetadata>()
|
Collections.sort( artifacts, new Comparator<ArtifactMetadata>()
|
||||||
{
|
{
|
||||||
public int compare( ArtifactMetadata o1, ArtifactMetadata o2 )
|
public int compare( ArtifactMetadata o1, ArtifactMetadata o2 )
|
||||||
{
|
{
|
||||||
// sort by version (reverse), then ID
|
// sort by version (reverse), then ID
|
||||||
// TODO: move version sorting into repository handling (maven2 specific), and perhaps add a
|
// TODO: move version sorting into repository handling (maven2 specific), and perhaps add a
|
||||||
// way to get latest instead
|
// way to get latest instead
|
||||||
int result = new DefaultArtifactVersion( o2.getVersion() ).compareTo(
|
int result =
|
||||||
new DefaultArtifactVersion( o1.getVersion() ) );
|
new DefaultArtifactVersion( o2.getVersion() ).compareTo( new DefaultArtifactVersion(
|
||||||
|
o1.getVersion() ) );
|
||||||
return result != 0 ? result : o1.getId().compareTo( o2.getId() );
|
return result != 0 ? result : o1.getId().compareTo( o2.getId() );
|
||||||
}
|
}
|
||||||
} );
|
} );
|
||||||
|
@ -263,7 +263,8 @@ public class ShowArtifactAction
|
||||||
|
|
||||||
this.dependees = references;
|
this.dependees = references;
|
||||||
|
|
||||||
// TODO: may need to note on the page that references will be incomplete if the other artifacts are not yet stored in the content repository
|
// TODO: may need to note on the page that references will be incomplete if the other artifacts are not yet
|
||||||
|
// stored in the content repository
|
||||||
// (especially in the case of pre-population import)
|
// (especially in the case of pre-population import)
|
||||||
|
|
||||||
return artifact();
|
return artifact();
|
||||||
|
@ -277,7 +278,8 @@ public class ShowArtifactAction
|
||||||
// temporarily use this as we only need the model for the tag to perform, but we should be resolving the
|
// temporarily use this as we only need the model for the tag to perform, but we should be resolving the
|
||||||
// graph here instead
|
// graph here instead
|
||||||
|
|
||||||
// TODO: may need to note on the page that tree will be incomplete if the other artifacts are not yet stored in the content repository
|
// TODO: may need to note on the page that tree will be incomplete if the other artifacts are not yet stored in
|
||||||
|
// the content repository
|
||||||
// (especially in the case of pre-population import)
|
// (especially in the case of pre-population import)
|
||||||
|
|
||||||
// TODO: a bit ugly, should really be mapping all these results differently now
|
// TODO: a bit ugly, should really be mapping all these results differently now
|
||||||
|
@ -290,12 +292,12 @@ public class ShowArtifactAction
|
||||||
{
|
{
|
||||||
String result = artifact();
|
String result = artifact();
|
||||||
|
|
||||||
if( model.getFacet( GenericMetadataFacet.FACET_ID ) != null )
|
if ( model.getFacet( GenericMetadataFacet.FACET_ID ) != null )
|
||||||
{
|
{
|
||||||
genericMetadata = model.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
|
genericMetadata = model.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( genericMetadata == null )
|
if ( genericMetadata == null )
|
||||||
{
|
{
|
||||||
genericMetadata = new HashMap<String, String>();
|
genericMetadata = new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
|
@ -308,13 +310,13 @@ public class ShowArtifactAction
|
||||||
String errorMsg = null;
|
String errorMsg = null;
|
||||||
|
|
||||||
ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
|
ProjectVersionMetadata projectMetadata = getProjectVersionMetadata();
|
||||||
if( projectMetadata == null )
|
if ( projectMetadata == null )
|
||||||
{
|
{
|
||||||
addActionError( errorMsg != null ? errorMsg : "Artifact not found" );
|
addActionError( errorMsg != null ? errorMsg : "Artifact not found" );
|
||||||
return ERROR;
|
return ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ) == null )
|
if ( projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ) == null )
|
||||||
{
|
{
|
||||||
genericMetadata = new HashMap<String, String>();
|
genericMetadata = new HashMap<String, String>();
|
||||||
}
|
}
|
||||||
|
@ -323,7 +325,8 @@ public class ShowArtifactAction
|
||||||
genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
|
genericMetadata = projectMetadata.getFacet( GenericMetadataFacet.FACET_ID ).toProperties();
|
||||||
}
|
}
|
||||||
|
|
||||||
if( propertyName == null || "".equals( propertyName.trim() ) || propertyValue == null || "".equals( propertyValue.trim() ) )
|
if ( propertyName == null || "".equals( propertyName.trim() ) || propertyValue == null ||
|
||||||
|
"".equals( propertyValue.trim() ) )
|
||||||
{
|
{
|
||||||
model = projectMetadata;
|
model = projectMetadata;
|
||||||
addActionError( errorMsg != null ? errorMsg : "Property Name and Property Value are required." );
|
addActionError( errorMsg != null ? errorMsg : "Property Name and Property Value are required." );
|
||||||
|
@ -621,7 +624,7 @@ public class ShowArtifactAction
|
||||||
repositoryId = artifact.getRepositoryId();
|
repositoryId = artifact.getRepositoryId();
|
||||||
|
|
||||||
// TODO: use metadata resolver capability instead - maybe the storage path could be stored in the metadata
|
// TODO: use metadata resolver capability instead - maybe the storage path could be stored in the metadata
|
||||||
// though keep in mind the request may not necessarily need to reflect the storage
|
// though keep in mind the request may not necessarily need to reflect the storage
|
||||||
ManagedRepositoryContent repo;
|
ManagedRepositoryContent repo;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
@ -640,7 +643,7 @@ public class ShowArtifactAction
|
||||||
path = path.substring( 0, path.lastIndexOf( "/" ) + 1 ) + artifact.getId();
|
path = path.substring( 0, path.lastIndexOf( "/" ) + 1 ) + artifact.getId();
|
||||||
|
|
||||||
// TODO: need to accommodate Maven 1 layout too. Non-maven repository formats will need to generate this
|
// TODO: need to accommodate Maven 1 layout too. Non-maven repository formats will need to generate this
|
||||||
// facet (perhaps on the fly) if wanting to display the Maven 2 elements on the Archiva pages
|
// facet (perhaps on the fly) if wanting to display the Maven 2 elements on the Archiva pages
|
||||||
String type = null;
|
String type = null;
|
||||||
MavenArtifactFacet facet = (MavenArtifactFacet) artifact.getFacet( MavenArtifactFacet.FACET_ID );
|
MavenArtifactFacet facet = (MavenArtifactFacet) artifact.getFacet( MavenArtifactFacet.FACET_ID );
|
||||||
if ( facet != null )
|
if ( facet != null )
|
||||||
|
|
Loading…
Reference in New Issue