]> source.dussan.org Git - archiva.git/commitdiff
[MRM-1514] api to configure OrganisationInfo
authorOlivier Lamy <olamy@apache.org>
Sat, 10 Sep 2011 07:33:38 +0000 (07:33 +0000)
committerOlivier Lamy <olamy@apache.org>
Sat, 10 Sep 2011 07:33:38 +0000 (07:33 +0000)
git-svn-id: https://svn.apache.org/repos/asf/archiva/trunk@1167472 13f79535-47bb-0310-9956-ffa450edef68

archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/ArchivaAdministration.java
archiva-modules/archiva-base/archiva-repository-admin/src/main/java/org/apache/archiva/admin/repository/admin/DefaultArchivaAdministration.java
archiva-modules/archiva-base/archiva-repository-admin/src/test/java/org/apache/archiva/admin/repository/admin/ArchivaAdministrationTest.java

index 3dbe0c28744ff2cf33d96207fc553d305a217a34..48a365faf9ad52c3753a24b3501c84531a012beb 100644 (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;
+
 }
index 4c60ffda754ba3d3c68cbfc5fd2e29011bd2245a..0848692149cb8158ec5f39f52f5bb45e61df8bb7 100644 (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 );
+    }
+
     //-------------------------
     //
     //-------------------------
index d9d1d03ba0f7f5081868e7b6cb52c70ef7b3d7c9..c51c12664e471f40f51db902fbd258ba1b8c3187 100644 (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() );
+
+    }
 }