[MRM-1514] api to configure OrganisationInfo

git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1167472 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Olivier Lamy 2011-09-10 07:33:38 +00:00
parent 648794df0d
commit 3c92bc1b40
3 changed files with 58 additions and 0 deletions

View File

@ -81,4 +81,10 @@ public interface ArchivaAdministration
void removeInvalidContentConsumer( String invalidContentConsumer, AuditInformation auditInformation )
throws RepositoryAdminException;
OrganisationInformation getOrganisationInformation()
throws RepositoryAdminException;
void setOrganisationInformation( OrganisationInformation organisationInformation )
throws RepositoryAdminException;
}

View File

@ -252,6 +252,36 @@ public class DefaultArchivaAdministration
getArchivaConfiguration().getConfiguration().getRepositoryScanning().getInvalidContentConsumers() );
}
public OrganisationInformation getOrganisationInformation()
throws RepositoryAdminException
{
org.apache.maven.archiva.configuration.OrganisationInformation organisationInformation =
getArchivaConfiguration().getConfiguration().getOrganisationInfo();
if ( organisationInformation == null )
{
return null;
}
return new BeanReplicator().replicateBean( organisationInformation, OrganisationInformation.class );
}
public void setOrganisationInformation( OrganisationInformation organisationInformation )
throws RepositoryAdminException
{
Configuration configuration = getArchivaConfiguration().getConfiguration();
if ( organisationInformation != null )
{
org.apache.maven.archiva.configuration.OrganisationInformation organisationInformationModel =
new BeanReplicator().replicateBean( organisationInformation,
org.apache.maven.archiva.configuration.OrganisationInformation.class );
configuration.setOrganisationInfo( organisationInformationModel );
}
else
{
configuration.setOrganisationInfo( null );
}
saveConfiguration( configuration );
}
//-------------------------
//
//-------------------------

View File

@ -165,4 +165,26 @@ public class ArchivaAdministrationTest
mockAuditListener.clearEvents();
}
public void organisationInfoUpdate()
throws Exception
{
OrganisationInformation organisationInformation = archivaAdministration.getOrganisationInformation();
assertNull( organisationInformation );
organisationInformation = new OrganisationInformation();
organisationInformation.setLogoLocation( "http://foo.com/bar.png" );
organisationInformation.setName( "foo org" );
organisationInformation.setUrl( "http:/foo.com" );
archivaAdministration.setOrganisationInformation( organisationInformation );
organisationInformation = archivaAdministration.getOrganisationInformation();
assertNotNull( organisationInformation );
assertEquals( "http://foo.com/bar.png", organisationInformation.getLogoLocation() );
assertEquals( "foo org", organisationInformation.getName() );
assertEquals( "http://foo.com", organisationInformation.getUrl() );
}
}