From 45c5e41898ea4660154d730cf863ee2886f71a03 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Thu, 19 Feb 2015 15:25:48 +0100 Subject: modify PVP attribute builder for MANDATE_PROF_REP_DESC --- .../MandateProfRepDescAttributeBuilder.java | 45 +++++++++++----------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/MandateProfRepDescAttributeBuilder.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/MandateProfRepDescAttributeBuilder.java index 1059e324e..e7ba26158 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/MandateProfRepDescAttributeBuilder.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/pvp2x/builder/attributes/MandateProfRepDescAttributeBuilder.java @@ -41,37 +41,36 @@ public class MandateProfRepDescAttributeBuilder implements IPVPAttributeBuilder public ATT build(OAAuthParameter oaParam, IAuthData authData, IAttributeGenerator g) throws AttributeException { - if(authData.isUseMandate()) { - Element mandate = authData.getMandate(); - if (mandate == null) { - throw new NoMandateDataAttributeException(); - } + if(authData.isUseMandate()) { + String text = null; + + MISMandate misMandate = authData.getMISMandate(); - Mandate mandateObject = MandateBuilder.buildMandate(authData.getMandate()); - if (mandateObject == null) { + if(misMandate == null) { throw new NoMandateDataAttributeException(); } - - String text = null; - if (MiscUtil.isNotEmpty(mandateObject.getAnnotation())) { - text = mandateObject.getAnnotation(); - - } else { - MISMandate misMandate = authData.getMISMandate(); + + text = misMandate.getTextualDescriptionOfOID(); - if(misMandate == null) { + if (MiscUtil.isEmpty(text)) { + Element mandate = authData.getMandate(); + if (mandate == null) { throw new NoMandateDataAttributeException(); } - text = misMandate.getTextualDescriptionOfOID(); - - if(MiscUtil.isEmpty(text)) { - return null; + Mandate mandateObject = MandateBuilder.buildMandate(authData.getMandate()); + if (mandateObject == null) { + throw new NoMandateDataAttributeException(); + } + + text = mandateObject.getAnnotation(); - } else - return g.buildStringAttribute(MANDATE_PROF_REP_DESC_FRIENDLY_NAME, - MANDATE_PROF_REP_DESC_NAME, text); - } + } + + if(MiscUtil.isNotEmpty(text)) + return g.buildStringAttribute(MANDATE_PROF_REP_DESC_FRIENDLY_NAME, + MANDATE_PROF_REP_DESC_NAME, text); + } return null; -- cgit v1.2.3