X-Git-Url: https://code.wpia.club/?a=blobdiff_plain;f=src%2Fclub%2Fwpia%2Fgigi%2FdbObjects%2FOrganisation.java;h=c9754565744b0d107baee2515f802e2e2cae9fbe;hb=7108b955eb9f66e5b2c65f43cde31aa009d7b44a;hp=4ee25d0ede565e6a9187bddc71a63377462d9e95;hpb=628b0bb70786afe5de5ba28a8438261dc31e25a6;p=gigi.git diff --git a/src/club/wpia/gigi/dbObjects/Organisation.java b/src/club/wpia/gigi/dbObjects/Organisation.java index 4ee25d0e..c9754565 100644 --- a/src/club/wpia/gigi/dbObjects/Organisation.java +++ b/src/club/wpia/gigi/dbObjects/Organisation.java @@ -68,12 +68,7 @@ public class Organisation extends CertificateOwner { private String postalAddress; public Organisation(String name, Country country, String province, String city, String email, String optionalName, String postalAddress, User creator) throws GigiApiException { - if ( !creator.isInGroup(Group.ORG_AGENT)) { - throw new GigiApiException("Only Organisation RA Agents may create organisations."); - } - if (country == null) { - throw new GigiApiException("Got country code of illegal type."); - } + super(validate(creator, country)); this.name = name; this.country = country; this.province = province; @@ -98,6 +93,16 @@ public class Organisation extends CertificateOwner { } } + private static Void validate(User creator, Country country) throws GigiApiException { + if ( !creator.isInGroup(Group.ORG_AGENT)) { + throw new GigiApiException("Only Organisation RA Agents may create organisations."); + } + if (country == null) { + throw new GigiApiException("Got country code of illegal type."); + } + return null; + } + protected Organisation(GigiResultSet rs) throws GigiApiException { super(rs.getInt("id")); name = rs.getString("name");