← Back to team overview

dhis2-devs team mailing list archive

[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14433: simplified authority format for schemas

 

------------------------------------------------------------
revno: 14433
committer: Morten Olav Hansen <mortenoh@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2014-03-26 14:27:43 +0100
message:
  simplified authority format for schemas
modified:
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authority.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AuthorityType.java
  dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/DataElementSchemaDescriptor.java


--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk

Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authority.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authority.java	2014-03-26 13:14:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/Authority.java	2014-03-26 13:27:43 +0000
@@ -44,29 +44,16 @@
 {
     private AuthorityType type;
 
-    private Boolean publicAuthority;
-
-    private Boolean privateAuthority;
-
-    private Boolean externalAuthority;
-
     private List<String> authorities;
 
-    public Authority()
+    public Authority( AuthorityType type )
     {
+        this.type = type;
     }
 
     public Authority( AuthorityType type, List<String> authorities )
     {
-        this.type = type;
-        this.authorities = authorities;
-    }
-
-    public Authority( AuthorityType type, boolean isPublic, List<String> authorities )
-    {
-        this.type = type;
-        this.publicAuthority = isPublic;
-        this.privateAuthority = !isPublic;
+        this( type );
         this.authorities = authorities;
     }
 
@@ -82,42 +69,6 @@
         this.type = type;
     }
 
-    @JsonProperty( "public" )
-    @JacksonXmlProperty( isAttribute = true )
-    public Boolean getPublicAuthority()
-    {
-        return publicAuthority;
-    }
-
-    public void setPublicAuthority( Boolean publicAuthority )
-    {
-        this.publicAuthority = publicAuthority;
-    }
-
-    @JsonProperty( "private" )
-    @JacksonXmlProperty( isAttribute = true )
-    public Boolean getPrivateAuthority()
-    {
-        return privateAuthority;
-    }
-
-    public void setPrivateAuthority( Boolean privateAuthority )
-    {
-        this.privateAuthority = privateAuthority;
-    }
-
-    @JsonProperty( "external" )
-    @JacksonXmlProperty( isAttribute = true )
-    public Boolean getExternalAuthority()
-    {
-        return externalAuthority;
-    }
-
-    public void setExternalAuthority( Boolean externalAuthority )
-    {
-        this.externalAuthority = externalAuthority;
-    }
-
     @JsonProperty
     @JacksonXmlElementWrapper( localName = "authorities", namespace = DxfNamespaces.DXF_2_0 )
     @JacksonXmlProperty( localName = "authority", namespace = DxfNamespaces.DXF_2_0 )

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AuthorityType.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AuthorityType.java	2014-03-26 13:14:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/AuthorityType.java	2014-03-26 13:27:43 +0000
@@ -33,5 +33,10 @@
  */
 public enum AuthorityType
 {
-    CREATE, READ, UPDATE, DELETE
+    CREATE_PUBLIC,
+    CREATE_PRIVATE,
+    EXTERNALIZE,
+    READ,
+    UPDATE,
+    DELETE
 }

=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/DataElementSchemaDescriptor.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/DataElementSchemaDescriptor.java	2014-03-26 13:14:42 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/schema/descriptors/DataElementSchemaDescriptor.java	2014-03-26 13:27:43 +0000
@@ -49,8 +49,8 @@
 
         schema.setShareable( true );
 
-        schema.getAuthorities().add( new Authority( AuthorityType.CREATE, true, Lists.newArrayList( "F_DATAELEMENT_PUBLIC_ADD" ) ) );
-        schema.getAuthorities().add( new Authority( AuthorityType.CREATE, false, Lists.newArrayList( "F_DATAELEMENT_PRIVATE_ADD" ) ) );
+        schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PUBLIC, Lists.newArrayList( "F_DATAELEMENT_PUBLIC_ADD" ) ) );
+        schema.getAuthorities().add( new Authority( AuthorityType.CREATE_PRIVATE, Lists.newArrayList( "F_DATAELEMENT_PRIVATE_ADD" ) ) );
         schema.getAuthorities().add( new Authority( AuthorityType.DELETE, Lists.newArrayList( "F_DATAELEMENT_DELETE" ) ) );
 
         return schema;