Search in sources :

Example 1 with EXistSchemaType

use of org.exist.security.EXistSchemaType in project exist by eXist-db.

the class GetPrincipalMetadataFunction method getPrincipalMetadata.

private Sequence getPrincipalMetadata(final Principal principal, final String metadataAttributeNamespace) {
    final AXSchemaType axSchemaType = AXSchemaType.valueOfNamespace(metadataAttributeNamespace);
    String metadataValue = null;
    if (axSchemaType != null) {
        metadataValue = principal.getMetadataValue(axSchemaType);
    } else {
        final EXistSchemaType exSchemaType = EXistSchemaType.valueOfNamespace(metadataAttributeNamespace);
        if (exSchemaType != null) {
            metadataValue = principal.getMetadataValue(exSchemaType);
        }
    }
    if (metadataValue == null || metadataValue.isEmpty()) {
        return Sequence.EMPTY_SEQUENCE;
    } else {
        return new StringValue(metadataValue);
    }
}
Also used : EXistSchemaType(org.exist.security.EXistSchemaType) StringValue(org.exist.xquery.value.StringValue) AXSchemaType(org.exist.security.AXSchemaType)

Aggregations

AXSchemaType (org.exist.security.AXSchemaType)1 EXistSchemaType (org.exist.security.EXistSchemaType)1 StringValue (org.exist.xquery.value.StringValue)1