From e30ae2b3d20f1f8a9a7ba38ae778c5cd044440a9 Mon Sep 17 00:00:00 2001
From: Florian Reimair <florian.reimair@iaik.tugraz.at>
Date: Wed, 18 Jun 2014 08:53:13 +0200
Subject: added new eHVD plugin

---
 .../protocols/stork2/AttributeProviderFactory.java |   4 +
 .../EHvdAttributeProviderPlugin.java               |  16 +-
 .../EHvdAttribute_deprecatedProviderPlugin.java    | 249 ++++++++++++++++
 .../IsHealthCareProfessionalDeprecatedType.java    | 145 ++++++++++
 .../attributes/IsHealthCareProfessionalType.java   | 313 +++++++++++----------
 .../src/main/resources/StorkcomplexAttributes.xsd  |  35 ++-
 6 files changed, 606 insertions(+), 156 deletions(-)
 create mode 100644 id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/EHvdAttribute_deprecatedProviderPlugin.java
 create mode 100644 id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/IsHealthCareProfessionalDeprecatedType.java

diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
index e4cc7346d..ec64f7eb1 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/AttributeProviderFactory.java
@@ -25,6 +25,7 @@ package at.gv.egovernment.moa.id.protocols.stork2;
 import at.gv.egovernment.moa.id.commons.db.dao.config.AttributeProviderPlugin;
 import at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.AttributeProvider;
 import at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.EHvdAttributeProviderPlugin;
+import at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.EHvdAttribute_deprecatedProviderPlugin;
 import at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.MandateAttributeRequestProvider;
 import at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.SignedDocAttributeRequestProvider;
 import at.gv.egovernment.moa.id.protocols.stork2.attributeproviders.StorkAttributeRequestProvider;
@@ -46,6 +47,7 @@ public class AttributeProviderFactory {
     public static List<String> getAvailablePlugins() {
         List<String> result = new ArrayList<String>();
         result.add("StorkAttributeRequestProvider");
+        result.add("EHvdAttributeProvider_deprecated");
         result.add("EHvdAttributeProvider");
         result.add("SignedDocAttributeRequestProvider");
         result.add("MandateAttributeRequestProvider");
@@ -65,6 +67,8 @@ public class AttributeProviderFactory {
             return new StorkAttributeRequestProvider(url, attributes);
         } else if (shortname.equals("EHvdAttributeProvider")) {
             return new EHvdAttributeProviderPlugin(url, attributes);
+        } else if (shortname.equals("EHvdAttributeProvider_deprecated")) {
+            return new EHvdAttribute_deprecatedProviderPlugin(url, attributes);
         } else if (shortname.equals("SignedDocAttributeRequestProvider")) {
             return new SignedDocAttributeRequestProvider(url, attributes);
         } else if (shortname.equals("MandateAttributeRequestProvider")) {
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/EHvdAttributeProviderPlugin.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/EHvdAttributeProviderPlugin.java
index 2328391ec..8af35673f 100644
--- a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/EHvdAttributeProviderPlugin.java
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/EHvdAttributeProviderPlugin.java
@@ -180,23 +180,19 @@ public class EHvdAttributeProviderPlugin extends AttributeProvider {
 
 			PersonalAttribute acquiredAttribute = null;
 
-			if (collection.get("IsHealthcareProfessional").equals("false")) {
+			if (collection.get("IsHealthcareProfessional").equals("false") || !collection.get("Type").equals("Medical doctor")) {
 				// the citizen is no HCP
 				acquiredAttribute = new PersonalAttribute("isHealthCareProfessional", false, new ArrayList<String>(), "NotAvailable");
 			} else {
 				// go on and parse the data
 				IsHealthCareProfessionalType result = new IsHealthCareProfessionalType();
-				result.setNameOfOrganisation(collection.get("NameOfOrganisation"));
 
-				if (collection.get("Type").equals("Medical doctor"))
-					result.setHCPType("D");
-				else
-					result.setHCPType("?");
+				// TODO: we do not have any list of possible values yet. Fix as soon as we get some.
+//				if (collection.get("Type").equals("Medical doctor"))
+					result.setTypeOfHCP("physician");
 
-				if (collection.get("Specialization").contains("Arzt für Allgemeinmedizin"))
-					result.setSpecialisation("GP");
-				else
-					result.setSpecialisation("??");
+				result.setNameOfOrganisation(collection.get("NameOfOrganisation"));
+				result.setTypeOfOrganisation("Unknown");
 
 				result.setAQAA(4);
 
diff --git a/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/EHvdAttribute_deprecatedProviderPlugin.java b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/EHvdAttribute_deprecatedProviderPlugin.java
new file mode 100644
index 000000000..2cd2af121
--- /dev/null
+++ b/id/server/idserverlib/src/main/java/at/gv/egovernment/moa/id/protocols/stork2/attributeproviders/EHvdAttribute_deprecatedProviderPlugin.java
@@ -0,0 +1,249 @@
+/*******************************************************************************
+ * Copyright 2014 Federal Chancellery Austria
+ * MOA-ID has been developed in a cooperation between BRZ, the Federal
+ * Chancellery Austria - ICT staff unit, and Graz University of Technology.
+ *
+ * Licensed under the EUPL, Version 1.1 or - as soon they will be approved by
+ * the European Commission - subsequent versions of the EUPL (the "Licence");
+ * You may not use this work except in compliance with the Licence.
+ * You may obtain a copy of the Licence at:
+ * http://www.osor.eu/eupl/
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the Licence is distributed on an "AS IS" basis,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the Licence for the specific language governing permissions and
+ * limitations under the Licence.
+ *
+ * This product combines work with different licenses. See the "NOTICE" text
+ * file for details on the various modules and licenses.
+ * The "NOTICE" text file is part of the distribution. Any derivative works
+ * that you distribute must include a readable copy of the "NOTICE" text file.
+ *******************************************************************************/
+package at.gv.egovernment.moa.id.protocols.stork2.attributeproviders;
+
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.Map;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
+import javax.xml.bind.JAXBContext;
+import javax.xml.bind.Marshaller;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPBody;
+import javax.xml.soap.SOAPConnection;
+import javax.xml.soap.SOAPConnectionFactory;
+import javax.xml.soap.SOAPElement;
+import javax.xml.soap.SOAPEnvelope;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.soap.SOAPPart;
+
+import at.gv.egovernment.moa.id.auth.builder.BPKBuilder;
+import at.gv.egovernment.moa.id.auth.exception.MOAIDException;
+import at.gv.egovernment.moa.id.config.auth.OAAuthParameter;
+import at.gv.egovernment.moa.id.data.IAuthData;
+import at.gv.egovernment.moa.id.protocols.stork2.ExternalAttributeRequestRequiredException;
+import at.gv.egovernment.moa.id.protocols.stork2.UnsupportedAttributeException;
+import at.gv.egovernment.moa.logging.Logger;
+import eu.stork.peps.auth.commons.IPersonalAttributeList;
+import eu.stork.peps.auth.commons.PersonalAttribute;
+import eu.stork.peps.auth.commons.PersonalAttributeList;
+import eu.stork.peps.complex.attributes.IsHealthCareProfessionalType;
+import eu.stork.peps.complex.attributes.ObjectFactory;
+
+/**
+ * Fetches the attribute IsHealthcareProfessional from the BAGDAD SOAP service
+ */
+public class EHvdAttribute_deprecatedProviderPlugin extends AttributeProvider {
+	
+	/** The destination. */
+	private Object destination;
+	
+	/**
+	 * Instantiates a new e hvd attribute provider plugin.
+	 *
+	 * @param url the service url
+	 * @param attributes 
+	 */
+	public EHvdAttribute_deprecatedProviderPlugin(String url, String supportedAttributes) {
+		super(supportedAttributes);
+		destination = url;
+	}
+
+	/* (non-Javadoc)
+	 * @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#acquire(eu.stork.peps.auth.commons.PersonalAttribute)
+	 */
+	@Override
+	protected IPersonalAttributeList acquire(PersonalAttribute attribute, String spCountryCode, IAuthData authData)
+			throws UnsupportedAttributeException,
+			ExternalAttributeRequestRequiredException, MOAIDException {
+
+		// break when we cannot handle the requested attribute
+		if(!attributes.contains(attribute.getName()))
+			throw new UnsupportedAttributeException();
+		
+		try {
+	    	Logger.debug("initializing SOAP connections...");
+			// create SOAP connection
+			SOAPConnection soapConnection = SOAPConnectionFactory.newInstance().createConnection();
+			
+			// assemble SOAP request
+			MessageFactory messageFactory = MessageFactory.newInstance();
+			SOAPMessage requestMessage = messageFactory.createMessage();
+			SOAPPart requestPart = requestMessage.getSOAPPart();
+
+			// (soap 1.1 relevant part. could not find a solution to use soap 1.2 in time.
+			requestMessage.getMimeHeaders().setHeader("SOAPAction", "http://gesundheit.gv.at/BAGDAD/DataAccessService/IsHealthcareProfessional");
+
+            /*
+            Construct SOAP Request Message:
+			<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+			  <soap:Body>
+			    <IsHealthcareProfessional xmlns="http://gesundheit.gv.at/BAGDAD/DataAccessService">
+			      <bPK>string</bPK>
+			    </IsHealthcareProfessional>
+			  </soap:Body>
+			</soap:Envelope>
+
+			see https://stork.ehealth.gv.at/GDAService.asmx?op=IsHealthcareProfessional
+             */
+
+			// SOAP Envelope
+			SOAPEnvelope envelope = requestPart.getEnvelope();
+
+			// SOAP Body
+			SOAPBody requestBody = envelope.getBody();
+			SOAPElement requestBodyElem = requestBody.addChildElement("IsHealthcareProfessional");
+			requestBodyElem.addAttribute(envelope.createName("xmlns"), "http://gesundheit.gv.at/BAGDAD/DataAccessService");
+
+			SOAPElement requestBodyElem1 = requestBodyElem.addChildElement("bPK");
+			
+			//TODO: CHECK: IdentificationValue containts wbPK if MOA-ID is used as VIDP 
+			requestBodyElem1.addTextNode(new BPKBuilder().buildBPK(authData.getIdentificationValue(), "GH"));
+
+			requestMessage.saveChanges();
+
+			// perform SOAP call
+	    	Logger.debug("call...");
+			SOAPMessage responseMessage = soapConnection.call(requestMessage, destination);
+
+			// parse SOAP response
+
+            /*
+			<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
+			  <soap:Body>
+			    <IsHealthcareProfessionalResponse xmlns="http://gesundheit.gv.at/BAGDAD/DataAccessService">
+			      <IsHealthcareProfessionalResult>
+			        <RequestOK>boolean</RequestOK>
+			        <Message>string</Message>
+			        <IsHealthcareProfessional>boolean</IsHealthcareProfessional>
+			        <NameOfOrganisation>string</NameOfOrganisation>
+			        <Type>string</Type>
+			        <Specialization>string</Specialization>
+			      </IsHealthcareProfessionalResult>
+			    </IsHealthcareProfessionalResponse>
+			  </soap:Body>
+			</soap:Envelope>
+
+			see https://stork.ehealth.gv.at/GDAService.asmx?op=IsHealthcareProfessional
+             */
+	    	Logger.debug("call successful. Parse...");
+			SOAPBody responseBody = responseMessage.getSOAPBody();
+
+			// iterate through tree
+			SOAPElement responseElement = (SOAPElement) responseBody.getChildElements().next();
+			SOAPElement resultElement = (SOAPElement) responseElement.getChildElements().next();
+
+			// collect all info in a map
+			Iterator<?> it = resultElement.getChildElements();
+			Map<String, String> collection = new HashMap<String, String>();
+			while (it.hasNext()) {
+				SOAPElement current = (SOAPElement) it.next();
+
+				collection.put(current.getNodeName(), current.getTextContent());
+			}
+
+			// check if there is anything valid in the map
+			if (collection.isEmpty() || collection.size() != 6) {
+				Logger.warn("eHVD returned an unexpected count of values. Expected 6 got " + collection.size());
+				throw new IndexOutOfBoundsException("response attributes not like specified");
+			}
+
+			// - fetch request validity
+			if (collection.get("RequestOK").equals("false")) {
+				Logger.warn("eHVD reported an invalid request. The error message is: " + collection.get("Message"));
+				throw new Exception("eHVD reported an invalid request");
+			}
+
+			PersonalAttribute acquiredAttribute = null;
+
+			if (collection.get("IsHealthcareProfessional").equals("false")) {
+				// the citizen is no HCP
+				acquiredAttribute = new PersonalAttribute("isHealthCareProfessional", false, new ArrayList<String>(), "NotAvailable");
+			} else {
+				// go on and parse the data
+				IsHealthCareProfessionalType result = new IsHealthCareProfessionalType();
+				result.setNameOfOrganisation(collection.get("NameOfOrganisation"));
+
+				if (collection.get("Type").equals("Medical doctor"))
+					result.setHCPType("D");
+				else
+					result.setHCPType("?");
+
+				if (collection.get("Specialization").contains("Arzt für Allgemeinmedizin"))
+					result.setSpecialisation("GP");
+				else
+					result.setSpecialisation("??");
+
+				result.setAQAA(4);
+
+				final Marshaller m = JAXBContext.newInstance(IsHealthCareProfessionalType.class).createMarshaller();
+			    m.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
+			    
+			    StringWriter stringWriter = new StringWriter();
+			    m.marshal(new ObjectFactory().createIsHealthCareProfessional(result), stringWriter);		    
+				
+				ArrayList<String> value = new ArrayList<String>();
+				value.add(stringWriter.toString());
+
+				acquiredAttribute = new PersonalAttribute("isHealthCareProfessional", false, value, "Available");
+			}
+
+			// pack and return the result
+			PersonalAttributeList result = new PersonalAttributeList();
+			result.add(acquiredAttribute);
+
+			// add stork id for verification
+			ArrayList<String> value = new ArrayList<String>();
+			value.add(new BPKBuilder().buildStorkeIdentifier(authData.getIdentityLink(), spCountryCode));
+			result.add(new PersonalAttribute("eIdentifier", false, value, "Available"));
+
+			return result;
+		} catch (Exception e) {
+			throw new MOAIDException("stork.13", new Object[] { e });
+		}
+	}
+
+    /* (non-Javadoc)
+     * @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#performRedirect(java.lang.String, java.lang.String, javax.servlet.http.HttpServletRequest, javax.servlet.http.HttpServletResponse, at.gv.egovernment.moa.id.config.auth.OAAuthParameter)
+     */
+	public void performRedirect(String url,
+			HttpServletRequest req, HttpServletResponse resp,
+			OAAuthParameter oaParam) throws MOAIDException {
+		// there is no redirect required
+	}
+
+	/* (non-Javadoc)
+	 * @see at.gv.egovernment.moa.id.protocols.stork2.AttributeProvider#parse(javax.servlet.http.HttpServletRequest)
+	 */
+	public IPersonalAttributeList parse(HttpServletRequest httpReq)
+			throws UnsupportedAttributeException, MOAIDException {
+		// there is no redirect required, so we throw an exception when someone asks us to parse a response
+		throw new UnsupportedAttributeException();
+	}
+
+
+}
diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/IsHealthCareProfessionalDeprecatedType.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/IsHealthCareProfessionalDeprecatedType.java
new file mode 100644
index 000000000..e57769254
--- /dev/null
+++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/IsHealthCareProfessionalDeprecatedType.java
@@ -0,0 +1,145 @@
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2014.06.18 at 08:26:57 AM CEST 
+//
+
+
+package eu.stork.names.tc.stork._1_0.assertion;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for isHealthCareProfessional_deprecatedType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="isHealthCareProfessional_deprecatedType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="nameOfOrganisation" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         &lt;element ref="{urn:eu:stork:names:tc:STORK:1.0:assertion}HCPType"/>
+ *         &lt;element ref="{urn:eu:stork:names:tc:STORK:1.0:assertion}specialisation"/>
+ *         &lt;element name="AQAA" type="{urn:eu:stork:names:tc:STORK:1.0:assertion}QualityAuthenticationAssuranceLevelType"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "isHealthCareProfessional_deprecatedType", propOrder = {
+    "nameOfOrganisation",
+    "hcpType",
+    "specialisation",
+    "aqaa"
+})
+public class IsHealthCareProfessionalDeprecatedType {
+
+    @XmlElement(required = true)
+    protected String nameOfOrganisation;
+    @XmlElement(name = "HCPType", required = true)
+    protected String hcpType;
+    @XmlElement(required = true)
+    protected String specialisation;
+    @XmlElement(name = "AQAA")
+    protected int aqaa;
+
+    /**
+     * Gets the value of the nameOfOrganisation property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getNameOfOrganisation() {
+        return nameOfOrganisation;
+    }
+
+    /**
+     * Sets the value of the nameOfOrganisation property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setNameOfOrganisation(String value) {
+        this.nameOfOrganisation = value;
+    }
+
+    /**
+     * Gets the value of the hcpType property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getHCPType() {
+        return hcpType;
+    }
+
+    /**
+     * Sets the value of the hcpType property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setHCPType(String value) {
+        this.hcpType = value;
+    }
+
+    /**
+     * Gets the value of the specialisation property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getSpecialisation() {
+        return specialisation;
+    }
+
+    /**
+     * Sets the value of the specialisation property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setSpecialisation(String value) {
+        this.specialisation = value;
+    }
+
+    /**
+     * Gets the value of the aqaa property.
+     * 
+     */
+    public int getAQAA() {
+        return aqaa;
+    }
+
+    /**
+     * Sets the value of the aqaa property.
+     * 
+     */
+    public void setAQAA(int value) {
+        this.aqaa = value;
+    }
+
+}
diff --git a/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/IsHealthCareProfessionalType.java b/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/IsHealthCareProfessionalType.java
index de2003a3f..1e3b4fa78 100644
--- a/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/IsHealthCareProfessionalType.java
+++ b/id/server/stork2-commons/src/main/java/eu/stork/peps/complex/attributes/IsHealthCareProfessionalType.java
@@ -1,145 +1,168 @@
-//
-// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
-// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
-// Any modifications to this file will be lost upon recompilation of the source schema. 
-// Generated on: 2014.02.17 at 10:36:59 AM GMT 
-//
-
-
-package eu.stork.peps.complex.attributes;
-
-import javax.xml.bind.annotation.XmlAccessType;
-import javax.xml.bind.annotation.XmlAccessorType;
-import javax.xml.bind.annotation.XmlElement;
-import javax.xml.bind.annotation.XmlType;
-
-
-/**
- * <p>Java class for isHealthCareProfessionalType complex type.
- * 
- * <p>The following schema fragment specifies the expected content contained within this class.
- * 
- * <pre>
- * &lt;complexType name="isHealthCareProfessionalType">
- *   &lt;complexContent>
- *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
- *       &lt;sequence>
- *         &lt;element name="nameOfOrganisation" type="{http://www.w3.org/2001/XMLSchema}string"/>
- *         &lt;element ref="{urn:eu:stork:names:tc:STORK:1.0:assertion}HCPType"/>
- *         &lt;element ref="{urn:eu:stork:names:tc:STORK:1.0:assertion}specialisation"/>
- *         &lt;element name="AQAA" type="{urn:eu:stork:names:tc:STORK:1.0:assertion}QualityAuthenticationAssuranceLevelType"/>
- *       &lt;/sequence>
- *     &lt;/restriction>
- *   &lt;/complexContent>
- * &lt;/complexType>
- * </pre>
- * 
- * 
- */
-@XmlAccessorType(XmlAccessType.FIELD)
-@XmlType(name = "isHealthCareProfessionalType", propOrder = {
-    "nameOfOrganisation",
-    "hcpType",
-    "specialisation",
-    "aqaa"
-})
-public class IsHealthCareProfessionalType {
-
-    @XmlElement(required = true)
-    protected String nameOfOrganisation;
-    @XmlElement(name = "HCPType", required = true)
-    protected String hcpType;
-    @XmlElement(required = true)
-    protected String specialisation;
-    @XmlElement(name = "AQAA")
-    protected int aqaa;
-
-    /**
-     * Gets the value of the nameOfOrganisation property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
-     */
-    public String getNameOfOrganisation() {
-        return nameOfOrganisation;
-    }
-
-    /**
-     * Sets the value of the nameOfOrganisation property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
-     */
-    public void setNameOfOrganisation(String value) {
-        this.nameOfOrganisation = value;
-    }
-
-    /**
-     * Gets the value of the hcpType property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
-     */
-    public String getHCPType() {
-        return hcpType;
-    }
-
-    /**
-     * Sets the value of the hcpType property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
-     */
-    public void setHCPType(String value) {
-        this.hcpType = value;
-    }
-
-    /**
-     * Gets the value of the specialisation property.
-     * 
-     * @return
-     *     possible object is
-     *     {@link String }
-     *     
-     */
-    public String getSpecialisation() {
-        return specialisation;
-    }
-
-    /**
-     * Sets the value of the specialisation property.
-     * 
-     * @param value
-     *     allowed object is
-     *     {@link String }
-     *     
-     */
-    public void setSpecialisation(String value) {
-        this.specialisation = value;
-    }
-
-    /**
-     * Gets the value of the aqaa property.
-     * 
-     */
-    public int getAQAA() {
-        return aqaa;
-    }
-
-    /**
-     * Sets the value of the aqaa property.
-     * 
-     */
-    public void setAQAA(int value) {
-        this.aqaa = value;
-    }
-
-}
+//
+// This file was generated by the JavaTM Architecture for XML Binding(JAXB) Reference Implementation, v2.2.4-2 
+// See <a href="http://java.sun.com/xml/jaxb">http://java.sun.com/xml/jaxb</a> 
+// Any modifications to this file will be lost upon recompilation of the source schema. 
+// Generated on: 2014.06.18 at 08:26:57 AM CEST 
+//
+
+
+package eu.stork.peps.complex.attributes;
+
+import javax.xml.bind.annotation.XmlAccessType;
+import javax.xml.bind.annotation.XmlAccessorType;
+import javax.xml.bind.annotation.XmlElement;
+import javax.xml.bind.annotation.XmlType;
+
+
+/**
+ * <p>Java class for isHealthCareProfessionalType complex type.
+ * 
+ * <p>The following schema fragment specifies the expected content contained within this class.
+ * 
+ * <pre>
+ * &lt;complexType name="isHealthCareProfessionalType">
+ *   &lt;complexContent>
+ *     &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyType">
+ *       &lt;sequence>
+ *         &lt;element name="typeOfHCP">
+ *           &lt;simpleType>
+ *             &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyURI">
+ *               &lt;enumeration value="dentist"/>
+ *               &lt;enumeration value="nurse"/>
+ *               &lt;enumeration value="pharmacist"/>
+ *               &lt;enumeration value="physician"/>
+ *               &lt;enumeration value="nurse midwife"/>
+ *               &lt;enumeration value="admission clerk"/>
+ *               &lt;enumeration value="ancillary services"/>
+ *               &lt;enumeration value="clinical services"/>
+ *             &lt;/restriction>
+ *           &lt;/simpleType>
+ *         &lt;/element>
+ *         &lt;element name="nameOfOrganisation" type="{http://www.w3.org/2001/XMLSchema}string"/>
+ *         &lt;element name="typeOfOrganisation">
+ *           &lt;simpleType>
+ *             &lt;restriction base="{http://www.w3.org/2001/XMLSchema}anyURI">
+ *               &lt;enumeration value="Hospital"/>
+ *               &lt;enumeration value="Resident Physician"/>
+ *               &lt;enumeration value="Pharmacy"/>
+ *               &lt;enumeration value="Other"/>
+ *               &lt;enumeration value="Unknown"/>
+ *             &lt;/restriction>
+ *           &lt;/simpleType>
+ *         &lt;/element>
+ *         &lt;element name="AQAA" type="{urn:eu:stork:names:tc:STORK:1.0:assertion}QualityAuthenticationAssuranceLevelType"/>
+ *       &lt;/sequence>
+ *     &lt;/restriction>
+ *   &lt;/complexContent>
+ * &lt;/complexType>
+ * </pre>
+ * 
+ * 
+ */
+@XmlAccessorType(XmlAccessType.FIELD)
+@XmlType(name = "isHealthCareProfessionalType", propOrder = {
+    "typeOfHCP",
+    "nameOfOrganisation",
+    "typeOfOrganisation",
+    "aqaa"
+})
+public class IsHealthCareProfessionalType {
+
+    @XmlElement(required = true)
+    protected String typeOfHCP;
+    @XmlElement(required = true)
+    protected String nameOfOrganisation;
+    @XmlElement(required = true)
+    protected String typeOfOrganisation;
+    @XmlElement(name = "AQAA")
+    protected int aqaa;
+
+    /**
+     * Gets the value of the typeOfHCP property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getTypeOfHCP() {
+        return typeOfHCP;
+    }
+
+    /**
+     * Sets the value of the typeOfHCP property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setTypeOfHCP(String value) {
+        this.typeOfHCP = value;
+    }
+
+    /**
+     * Gets the value of the nameOfOrganisation property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getNameOfOrganisation() {
+        return nameOfOrganisation;
+    }
+
+    /**
+     * Sets the value of the nameOfOrganisation property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setNameOfOrganisation(String value) {
+        this.nameOfOrganisation = value;
+    }
+
+    /**
+     * Gets the value of the typeOfOrganisation property.
+     * 
+     * @return
+     *     possible object is
+     *     {@link String }
+     *     
+     */
+    public String getTypeOfOrganisation() {
+        return typeOfOrganisation;
+    }
+
+    /**
+     * Sets the value of the typeOfOrganisation property.
+     * 
+     * @param value
+     *     allowed object is
+     *     {@link String }
+     *     
+     */
+    public void setTypeOfOrganisation(String value) {
+        this.typeOfOrganisation = value;
+    }
+
+    /**
+     * Gets the value of the aqaa property.
+     * 
+     */
+    public int getAQAA() {
+        return aqaa;
+    }
+
+    /**
+     * Sets the value of the aqaa property.
+     * 
+     */
+    public void setAQAA(int value) {
+        this.aqaa = value;
+    }
+
+}
diff --git a/id/server/stork2-commons/src/main/resources/StorkcomplexAttributes.xsd b/id/server/stork2-commons/src/main/resources/StorkcomplexAttributes.xsd
index 3c56bd318..ab9e89712 100644
--- a/id/server/stork2-commons/src/main/resources/StorkcomplexAttributes.xsd
+++ b/id/server/stork2-commons/src/main/resources/StorkcomplexAttributes.xsd
@@ -32,6 +32,7 @@
 	<xs:element name="mandate" type="stork:mandateType" />
 	<xs:element name="study" type="stork:studyType" />
 	<xs:element name="HCPType" type="stork:HCPType" />
+	<xs:element name="isHealthCareProfessional_deprecated" type="stork:isHealthCareProfessional_deprecatedType" />
 
 	<xs:attribute name="AttributeStatus" type="stork:AttributeStatusType" />
 
@@ -284,7 +285,7 @@
 		</xs:sequence>
 	</xs:complexType>
 
-	<xs:complexType name="isHealthCareProfessionalType">
+	<xs:complexType name="isHealthCareProfessional_deprecatedType">
 		<xs:sequence>
 			<xs:element name="nameOfOrganisation" type="xs:string" />
 			<xs:element ref="stork:HCPType" />
@@ -302,4 +303,36 @@
 		</xs:restriction>
 	</xs:simpleType>
 
+	<xs:complexType name="isHealthCareProfessionalType">
+		<xs:sequence>
+			<xs:element name="typeOfHCP">
+				<xs:simpleType>
+					<xs:restriction base="xs:anyURI">
+						<xs:enumeration value="dentist" />
+						<xs:enumeration value="nurse" />
+						<xs:enumeration value="pharmacist" />
+						<xs:enumeration value="physician" />
+						<xs:enumeration value="nurse midwife" />
+						<xs:enumeration value="admission clerk" />
+						<xs:enumeration value="ancillary services" />
+						<xs:enumeration value="clinical services" />
+					</xs:restriction>
+				</xs:simpleType>
+			</xs:element>
+			<xs:element name="nameOfOrganisation" type="xs:string" />
+			<xs:element name="typeOfOrganisation">
+				<xs:simpleType>
+					<xs:restriction base="xs:anyURI">
+						<xs:enumeration value="Hospital" />
+						<xs:enumeration value="Resident Physician" />
+						<xs:enumeration value="Pharmacy" />
+						<xs:enumeration value="Other" />
+						<xs:enumeration value="Unknown" />
+					</xs:restriction>
+				</xs:simpleType>
+			</xs:element>
+			<xs:element name="AQAA" type="stork:QualityAuthenticationAssuranceLevelType" />
+		</xs:sequence>
+	</xs:complexType>
+
 </xs:schema>
-- 
cgit v1.2.3