From bceb4fd58c7d17c4fdc6908f77f546c96c0920a4 Mon Sep 17 00:00:00 2001 From: Thomas Lenz Date: Wed, 18 Feb 2015 13:29:24 +0100 Subject: update PVP attribute builder --> use mandate annotation as MANDATOR-PROF-REP-DESCRIPTION --- .../MandateProfRepDescAttributeBuilder.java | 40 ++++++++++++++++------ .../moa/id/util/client/mis/simple/MISMandate.java | 8 ++++- 2 files changed, 36 insertions(+), 12 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 4c981cb24..1059e324e 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 @@ -22,10 +22,14 @@ *******************************************************************************/ package at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes; +import org.w3c.dom.Element; + +import at.gv.e_government.reference.namespace.mandates._20040701_.Mandate; import at.gv.egovernment.moa.id.config.auth.OAAuthParameter; import at.gv.egovernment.moa.id.data.IAuthData; import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.AttributeException; import at.gv.egovernment.moa.id.protocols.pvp2x.builder.attributes.exceptions.NoMandateDataAttributeException; +import at.gv.egovernment.moa.id.util.MandateBuilder; import at.gv.egovernment.moa.id.util.client.mis.simple.MISMandate; import at.gv.egovernment.moa.util.MiscUtil; @@ -37,23 +41,37 @@ public class MandateProfRepDescAttributeBuilder implements IPVPAttributeBuilder public ATT build(OAAuthParameter oaParam, IAuthData authData, IAttributeGenerator g) throws AttributeException { - if(authData.isUseMandate()) { - MISMandate mandate = authData.getMISMandate(); - + if(authData.isUseMandate()) { + Element mandate = authData.getMandate(); + if (mandate == null) { + throw new NoMandateDataAttributeException(); + } - if(mandate == null) { + Mandate mandateObject = MandateBuilder.buildMandate(authData.getMandate()); + if (mandateObject == null) { throw new NoMandateDataAttributeException(); } + + String text = null; + if (MiscUtil.isNotEmpty(mandateObject.getAnnotation())) { + text = mandateObject.getAnnotation(); + + } else { + MISMandate misMandate = authData.getMISMandate(); - String text = mandate.getTextualDescriptionOfOID(); + if(misMandate == null) { + throw new NoMandateDataAttributeException(); + } - if(MiscUtil.isEmpty(text)) { - return null; - - } else - return g.buildStringAttribute(MANDATE_PROF_REP_DESC_FRIENDLY_NAME, - MANDATE_PROF_REP_DESC_NAME, text); + text = misMandate.getTextualDescriptionOfOID(); + if(MiscUtil.isEmpty(text)) { + return null; + + } else + return g.buildStringAttribute(MANDATE_PROF_REP_DESC_FRIENDLY_NAME, + MANDATE_PROF_REP_DESC_NAME, text); + } } return null; diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/client/mis/simple/MISMandate.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/client/mis/simple/MISMandate.java index 20cabaf4d..1edb8d1f3 100644 --- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/client/mis/simple/MISMandate.java +++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/util/client/mis/simple/MISMandate.java @@ -66,6 +66,9 @@ public class MISMandate implements Serializable{ final static public String OID_ORGANWALTER = "1.2.40.0.10.3.4"; final static private String TEXT_ORGANWALTER = "Organwalter"; + final static public String OID_ELGA_OMBUTSSTELLE = "1.2.40.0.34.3.1.3"; + final static public String OID_ELGA_OMBUTSSTELLE_TEST = "1.2.40.0.34.3.1.2.99.9"; + final static private String TEXT_ELGA_OMBUTSSTELLE = "ELGA-Ombudsstelle"; private String oid = null; private byte[] mandate = null; @@ -102,7 +105,10 @@ public class MISMandate implements Serializable{ return TEXT_ZIVILTECHNIKER; if (this.oid.equalsIgnoreCase(OID_ORGANWALTER)) return TEXT_ORGANWALTER; - + if (this.oid.equalsIgnoreCase(OID_ELGA_OMBUTSSTELLE) + || this.oid.equalsIgnoreCase(OID_ELGA_OMBUTSSTELLE_TEST)) + return TEXT_ELGA_OMBUTSSTELLE; + return "Keine textuelle Beschreibung für OID " + oid; } else { -- cgit v1.2.3