Search in sources :

Example 11 with MalformedLSIDException

use of com.ibm.lsid.MalformedLSIDException in project cdmlib by cybertaxonomy.

the class FullCoverageDataGenerator method createSupplemental.

private void createSupplemental(List<CdmBase> cdmBases) {
    Reference ref = ReferenceFactory.newBook();
    Annotation annotation = Annotation.NewDefaultLanguageInstance("annotation");
    ref.addAnnotation(annotation);
    handleAnnotatableEntity(annotation);
    Credit credit = Credit.NewInstance(Person.NewInstance(), "refCredit", "rc", Language.DEFAULT());
    ref.addCredit(credit);
    handleAnnotatableEntity(credit);
    Rights rights = Rights.NewInstance("My rights", Language.GERMAN());
    ref.addRights(rights);
    handleAnnotatableEntity(rights);
    // Others
    try {
        LSIDAuthority lsidAuthority = new LSIDAuthority("My authority");
        lsidAuthority.addNamespace("lsidNamespace", TaxonName.class);
        cdmBases.add(lsidAuthority);
    } catch (MalformedLSIDException e) {
        e.printStackTrace();
    }
    User user = User.NewInstance("myUser", "12345");
    Group group = Group.NewInstance("MyGroup");
    group.addMember(user);
    CdmAuthority authority = CdmAuthority.NewInstance(PermissionClass.TAXONNAME, "a property", Operation.CREATE, UUID.fromString("f1653cb8-5956-429e-852a-4a3b57893f49"));
    group.addAuthority(authority);
    Role role = Role.NewInstance("my role");
    user.addAuthority(role);
    cdmBases.add(user);
    cdmBases.add(group);
    cdmBases.add(authority);
    cdmBases.add(ref);
}
Also used : Role(eu.etaxonomy.cdm.model.permission.Role) Group(eu.etaxonomy.cdm.model.permission.Group) Rights(eu.etaxonomy.cdm.model.media.Rights) Credit(eu.etaxonomy.cdm.model.common.Credit) User(eu.etaxonomy.cdm.model.permission.User) MalformedLSIDException(com.ibm.lsid.MalformedLSIDException) Reference(eu.etaxonomy.cdm.model.reference.Reference) IntextReference(eu.etaxonomy.cdm.model.common.IntextReference) CdmAuthority(eu.etaxonomy.cdm.model.permission.CdmAuthority) LSIDAuthority(eu.etaxonomy.cdm.model.common.LSIDAuthority) Annotation(eu.etaxonomy.cdm.model.common.Annotation)

Aggregations

MalformedLSIDException (com.ibm.lsid.MalformedLSIDException)11 LSID (eu.etaxonomy.cdm.model.common.LSID)10 Before (org.junit.Before)4 IdentifiableSource (eu.etaxonomy.cdm.model.common.IdentifiableSource)3 Rights (eu.etaxonomy.cdm.model.media.Rights)3 Reference (eu.etaxonomy.cdm.model.reference.Reference)3 Person (eu.etaxonomy.cdm.model.agent.Person)2 Annotation (eu.etaxonomy.cdm.model.common.Annotation)2 Credit (eu.etaxonomy.cdm.model.common.Credit)2 LSIDAuthority (eu.etaxonomy.cdm.model.common.LSIDAuthority)2 ExpiringResponse (com.ibm.lsid.ExpiringResponse)1 LSIDAuthorityService (eu.etaxonomy.cdm.api.service.lsid.LSIDAuthorityService)1 LSIDDataService (eu.etaxonomy.cdm.api.service.lsid.LSIDDataService)1 LSIDMetadataService (eu.etaxonomy.cdm.api.service.lsid.LSIDMetadataService)1 LsidRegistryImpl (eu.etaxonomy.cdm.api.service.lsid.impl.LsidRegistryImpl)1 URI (eu.etaxonomy.cdm.common.URI)1 Extension (eu.etaxonomy.cdm.model.common.Extension)1 Identifier (eu.etaxonomy.cdm.model.common.Identifier)1 IntextReference (eu.etaxonomy.cdm.model.common.IntextReference)1 Marker (eu.etaxonomy.cdm.model.common.Marker)1