src/main/java/ch/bfh/ti/i4mi/mag/mhd/iti65/Iti65RequestConverter.java
/**
	 * ITI-65: process DocumentManifest resource from Bundle
	 * @param manifest
	 * @param submissionSet
	 */
ITI-65: process DocumentManifest resource from Bundle
@param manifest
@param submissionSet
ITI - 65 : process DocumentManifest resource from Bundle @param manifest @param submissionSet
private  void processDocumentManifest(DocumentManifest manifest, SubmissionSet submissionSet) {
		Identifier masterIdentifier = manifest.getMasterIdentifier();
		submissionSet.setUniqueId(noPrefix(masterIdentifier.getValue()));
		submissionSet.assignEntryUuid();
		manifest.setId(submissionSet.getEntryUuid());
		CodeableConcept type = manifest.getType();
		submissionSet.setContentTypeCode(transformCodeableConcept(type));
		DateTimeType created = manifest.getCreatedElement();
		submissionSet.setSubmissionTime(timestampFromDate(created));
		Reference ref = manifest.getSubject();
		submissionSet.setPatientId(transformReferenceToIdentifiable(ref, manifest));
        Extension authorRoleExt = manifest.getExtensionByUrl("http://fhir.ch/ig/ch-epr-mhealth/StructureDefinition/ch-ext-author-authorrole");
		if (manifest.hasAuthor() || (authorRoleExt!=null)) {
		    Identifiable identifiable = null;
			Reference author = manifest.getAuthorFirstRep();
            if (authorRoleExt!=null) {
                Coding coding = authorRoleExt.castToCoding(authorRoleExt.getValue());
                if (coding !=null) {
                    identifiable = new Identifiable(coding.getCode(), new AssigningAuthority(noPrefix(coding.getSystem())));
                }
            }
			submissionSet.setAuthor(transformAuthor(author, manifest.getContained(), identifiable));
		}
		for (Reference recipientRef : manifest.getRecipient()) {
			Resource res = findResource(recipientRef, manifest.getContained());
			if (res instanceof Practitioner) {
				Recipient recipient = new Recipient();
				recipient.setPerson(transform((Practitioner) res));
				recipient.setTelecom(transform(((Practitioner) res).getTelecomFirstRep()));
				submissionSet.getIntendedRecipients().add(recipient);
			} else if (res instanceof Organization) {
				Recipient recipient = new Recipient();
				recipient.setOrganization(transform((Organization) res));
				recipient.setTelecom(transform(((Organization) res).getTelecomFirstRep()));
				submissionSet.getIntendedRecipients().add(recipient);
			} else if (res instanceof PractitionerRole) {
				Recipient recipient = new Recipient();
				PractitionerRole role = (PractitionerRole) res;
				recipient.setOrganization(transform((Organization) findResource(role.getOrganization(), manifest.getContained())));
				recipient.setPerson(transform((Practitioner) findResource(role.getPractitioner(), manifest.getContained())));
				recipient.setTelecom(transform(role.getTelecomFirstRep()));
				submissionSet.getIntendedRecipients().add(recipient);
			} else if (res instanceof Patient) {
				Recipient recipient = new Recipient();
				recipient.setPerson(transform((Patient) res));
				recipient.setTelecom(transform(((Patient) res).getTelecomFirstRep()));
			} else if (res instanceof RelatedPerson) {
				Recipient recipient = new Recipient();
				recipient.setPerson(transform((RelatedPerson) res));
				recipient.setTelecom(transform(((RelatedPerson) res).getTelecomFirstRep()));
			}								
		}
		String source = noPrefix(manifest.getSource());		
		submissionSet.setSourceId(source);
		String description = manifest.getDescription();		
		if (description!=null) submissionSet.setTitle(localizedString(description));		  
	}
private void processDocumentManifest ( DocumentManifest manifest , SubmissionSet submissionSet ) { Identifier masterIdentifier = manifest . getMasterIdentifier ( ) ; submissionSet . setUniqueId ( noPrefix ( masterIdentifier . getValue ( ) ) ) ; submissionSet . assignEntryUuid ( ) ; manifest . setId ( submissionSet . getEntryUuid ( ) ) ; CodeableConcept type = manifest . getType ( ) ; submissionSet . setContentTypeCode ( transformCodeableConcept ( type ) ) ; DateTimeType created = manifest . getCreatedElement ( ) ; submissionSet . setSubmissionTime ( timestampFromDate ( created ) ) ; Reference ref = manifest . getSubject ( ) ; submissionSet . setPatientId ( transformReferenceToIdentifiable ( ref , manifest ) ) ; Extension authorRoleExt = manifest . getExtensionByUrl ( "http://fhir.ch/ig/ch-epr-mhealth/StructureDefinition/ch-ext-author-authorrole" ) ; if ( manifest . hasAuthor ( ) || ( authorRoleExt != null ) ) { Identifiable identifiable = null ; Reference author = manifest . getAuthorFirstRep ( ) ; if ( authorRoleExt != null ) { Coding coding = authorRoleExt . castToCoding ( authorRoleExt . getValue ( ) ) ; if ( coding != null ) { identifiable = new Identifiable ( coding . getCode ( ) , new AssigningAuthority ( noPrefix ( coding . getSystem ( ) ) ) ) ; } } submissionSet . setAuthor ( transformAuthor ( author , manifest . getContained ( ) , identifiable ) ) ; } for ( Reference recipientRef : manifest . getRecipient ( ) ) { Resource res = findResource ( recipientRef , manifest . getContained ( ) ) ; if ( res instanceof Practitioner ) { Recipient recipient = new Recipient ( ) ; recipient . setPerson ( transform ( ( Practitioner ) res ) ) ; recipient . setTelecom ( transform ( ( ( Practitioner ) res ) . getTelecomFirstRep ( ) ) ) ; submissionSet . getIntendedRecipients ( ) . add ( recipient ) ; } else if ( res instanceof Organization ) { Recipient recipient = new Recipient ( ) ; recipient . setOrganization ( transform ( ( Organization ) res ) ) ; recipient . setTelecom ( transform ( ( ( Organization ) res ) . getTelecomFirstRep ( ) ) ) ; submissionSet . getIntendedRecipients ( ) . add ( recipient ) ; } else if ( res instanceof PractitionerRole ) { Recipient recipient = new Recipient ( ) ; PractitionerRole role = ( PractitionerRole ) res ; recipient . setOrganization ( transform ( ( Organization ) findResource ( role . getOrganization ( ) , manifest . getContained ( ) ) ) ) ; recipient . setPerson ( transform ( ( Practitioner ) findResource ( role . getPractitioner ( ) , manifest . getContained ( ) ) ) ) ; recipient . setTelecom ( transform ( role . getTelecomFirstRep ( ) ) ) ; submissionSet . getIntendedRecipients ( ) . add ( recipient ) ; } else if ( res instanceof Patient ) { Recipient recipient = new Recipient ( ) ; recipient . setPerson ( transform ( ( Patient ) res ) ) ; recipient . setTelecom ( transform ( ( ( Patient ) res ) . getTelecomFirstRep ( ) ) ) ; } else if ( res instanceof RelatedPerson ) { Recipient recipient = new Recipient ( ) ; recipient . setPerson ( transform ( ( RelatedPerson ) res ) ) ; recipient . setTelecom ( transform ( ( ( RelatedPerson ) res ) . getTelecomFirstRep ( ) ) ) ; } } String source = noPrefix ( manifest . getSource ( ) ) ; submissionSet . setSourceId ( source ) ; String description = manifest . getDescription ( ) ; if ( description != null ) submissionSet . setTitle ( localizedString ( description ) ) ; }
ITI-65: process DocumentManifest resource from Bundle
 @param manifest
 @param submissionSet
ITI - 65 : process DocumentManifest resource from Bundle @param manifest @param submissionSet
// masterIdentifier	SubmissionSet.uniqueId //  subject	SubmissionSet.patientId // Author // recipient	SubmissionSet.intendedRecipient		 // source	SubmissionSet.sourceId