mirror of https://github.com/apache/archiva.git
[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:
parent
648794df0d
commit
3c92bc1b40
|
@ -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;
|
||||
|
||||
}
|
||||
|
|
|
@ -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 );
|
||||
}
|
||||
|
||||
//-------------------------
|
||||
//
|
||||
//-------------------------
|
||||
|
|
|
@ -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() );
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue