Skip to content

Commit

Permalink
#414: fix extensions and profiles
Browse files Browse the repository at this point in the history
  • Loading branch information
Christian Ohr committed Dec 20, 2023
1 parent 189d41e commit 347fa6b
Show file tree
Hide file tree
Showing 32 changed files with 640 additions and 321 deletions.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -27,155 +27,201 @@
import java.util.List;
import java.util.Optional;

public enum MhdProfile implements MhdConstants, Mhd421 {
public enum MhdProfile implements Mhd421 {

// Bundle Profiles V421

ITI65_MINIMAL_BUNDLE(
ITI65_MINIMAL_BUNDLE_PROFILE,
MhdProfile.ITI65_MINIMAL_BUNDLE_PROFILE,
MinimalProvideDocumentBundle.class,
"IHE.MHD.Minimal.ProvideBundle"),

ITI65_COMPREHENSIVE_BUNDLE(
ITI65_COMPREHENSIVE_BUNDLE_PROFILE,
MhdProfile.ITI65_COMPREHENSIVE_BUNDLE_PROFILE,
ComprehensiveProvideDocumentBundle.class,
"IHE.MHD.Comprehensive.ProvideBundle"),

ITI65_UNCONTAINED_COMPREHENSIVE_BUNDLE(
ITI65_UNCONTAINED_COMPREHENSIVE_BUNDLE_PROFILE,
MhdProfile.ITI65_UNCONTAINED_COMPREHENSIVE_BUNDLE_PROFILE,
UncontainedComprehensiveProvideDocumentBundle.class,
"IHE.MHD.UnContained.Comprehensive.ProvideBundle"),

ITI65_PROVIDE_DOCUMENT_BUNDLE_RESPONSE(
ITI65_PROVIDE_DOCUMENT_BUNDLE_RESPONSE_PROFILE,
MhdProfile.ITI65_PROVIDE_DOCUMENT_BUNDLE_RESPONSE_PROFILE,
ProvideDocumentBundleResponse.class,
"IHE.MHD.ProvideDocumentBundleResponse"),

ITI66_FIND_DOCUMENT_LISTS_RESPONSE_BUNDLE(
ITI66_FIND_DOCUMENT_LISTS_RESPONSE_BUNDLE_PROFILE,
MhdProfile.ITI66_FIND_DOCUMENT_LISTS_RESPONSE_BUNDLE_PROFILE,
FindDocumentListsResponseBundle.class,
"IHE.MHD.FindDocumentListsResponseMessage"),

ITI67_FIND_DOCUMENT_REFERENCES_RESPONSE_BUNDLE(
ITI67_FIND_DOCUMENT_REFERENCES_RESPONSE_BUNDLE_PROFILE,
MhdProfile.ITI67_FIND_DOCUMENT_REFERENCES_RESPONSE_BUNDLE_PROFILE,
FindMinimalDocumentReferencesResponseBundle.class,
"IHE.MHD.FindDocumentReferencesResponseMessage"
),

ITI67_FIND_DOCUMENT_REFERENCES_COMPREHENSIVE_RESPONSE_BUNDLE(
ITI67_FIND_DOCUMENT_REFERENCES_COMPREHENSIVE_RESPONSE_BUNDLE_PROFILE,
MhdProfile.ITI67_FIND_DOCUMENT_REFERENCES_COMPREHENSIVE_RESPONSE_BUNDLE_PROFILE,
FindComprehensiveDocumentReferencesResponseBundle.class,
"IHE.MHD.FindDocumentReferencesComprehensiveResponseMessage"),

// List profiles v421

MHD_LIST(
MHD_LIST_PROFILE,
MhdProfile.MHD_LIST_PROFILE,
MhdList.class,
"IHE.MHD.List"),

COMPREHENSIVE_SUBMISSIONSET_TYPE_LIST(
COMPREHENSIVE_SUBMISSIONSET_TYPE_LIST_PROFILE,
MhdProfile.COMPREHENSIVE_SUBMISSIONSET_TYPE_LIST_PROFILE,
ComprehensiveSubmissionSetList.class,
"IHE.MHD.Comprehensive.SubmissionSet"),

UNCONTAINED_COMPREHENSIVE_SUBMISSIONSET_TYPE_LIST(
UNCONTAINED_COMPREHENSIVE_SUBMISSIONSET_TYPE_LIST_PROFILE,
MhdProfile.UNCONTAINED_COMPREHENSIVE_SUBMISSIONSET_TYPE_LIST_PROFILE,
UncontainedComprehensiveProvideDocumentBundle.class,
"IHE.MHD.UnContained.Comprehensive.SubmissionSet"),

MINIMAL_SUBMISSIONSET_TYPE_LIST(
MINIMAL_SUBMISSIONSET_TYPE_LIST_PROFILE,
MhdProfile.MINIMAL_SUBMISSIONSET_TYPE_LIST_PROFILE,
MinimalSubmissionSetList.class,
"IHE.MHD.Minimal.SubmissionSet"),

MINIMAL_FOLDER_TYPE_LIST(
MINIMAL_FOLDER_TYPE_LIST_PROFILE,
MhdProfile.MINIMAL_FOLDER_TYPE_LIST_PROFILE,
MinimalFolderList.class,
"IHE.MHD.Minimal.Folder"),

COMPREHENSIVE_FOLDER_TYPE_LIST(
COMPREHENSIVE_FOLDER_TYPE_LIST_PROFILE,
MhdProfile.COMPREHENSIVE_FOLDER_TYPE_LIST_PROFILE,
ComprehensiveFolderList.class,
"IHE.MHD.Comprehensive.Folder"),

// DocumentReference profiles v421

COMPREHENSIVE_DOCUMENT_REFERENCE(
COMPREHENSIVE_DOCUMENT_REFERENCE_PROFILE,
MhdProfile.COMPREHENSIVE_DOCUMENT_REFERENCE_PROFILE,
ComprehensiveDocumentReference.class,
"IHE.MHD.Comprehensive.DocumentReference"),

UNCONTAINED_COMPREHENSIVE_DOCUMENT_REFERENCE(
UNCONTAINED_COMPREHENSIVE_DOCUMENT_REFERENCE_PROFILE,
MhdProfile.UNCONTAINED_COMPREHENSIVE_DOCUMENT_REFERENCE_PROFILE,
UncontainedComprehensiveDocumentReference.class,
"IHE.MHD.UnContained.Comprehensive.DocumentReference"),

MINIMAL_DOCUMENT_REFERENCE(
MINIMAL_DOCUMENT_REFERENCE_PROFILE,
MhdProfile.MINIMAL_DOCUMENT_REFERENCE_PROFILE,
MinimalDocumentReference.class,
"IHE.MHD.Minimal.DocumentReference"),

SIMPLIFIED_PUBLISH_DOCUMENT_REFERENCE(
SIMPLIFIED_PUBLISH_DOCUMENT_REFERENCE_PROFILE,
MhdProfile.SIMPLIFIED_PUBLISH_DOCUMENT_REFERENCE_PROFILE,
SimplifiedPublishDocumentReference.class,
"IHE.MHD.SimplifiedPublish.DocumentReference"),

// Parameters

DOCUMENT_REFERENCE_PATCH_PARAMETERS(
DOCUMENT_REFERENCE_PATCH_PARAMETERS_PROFILE,
MhdProfile.DOCUMENT_REFERENCE_PATCH_PARAMETERS_PROFILE,
DocumentReferencePatchParameters.class,
"IHE.MHD.Patch.Parameters"),

GENERATE_METADATA_PARAMETERS_IN(
GENERATE_METADATA_PARAMETERS_IN_PROFILE,
MhdProfile.GENERATE_METADATA_PARAMETERS_IN_PROFILE,
GenerateMetadataInParameters.class,
"IHE.MHD.GenerateMetadata.Parameters.In"),

GENERATE_METADATA_PARAMETERS_OUT(
GENERATE_METADATA_PARAMETERS_OUT_PROFILE,
MhdProfile.GENERATE_METADATA_PARAMETERS_OUT_PROFILE,
GenerateMetadataOutParameters.class,
"IHE.MHD.GenerateMetadata.Parameters.Out"),

// Datatypes etc.

DESIGNATION_TYPE(
DESIGNATION_TYPE_PROFILE,
MhdProfile.DESIGNATION_TYPE_PROFILE,
null,
"ihe-designationType"),

AUTHOR_ORG(
AUTHOR_ORG_PROFILE,
MhdProfile.AUTHOR_ORG_PROFILE,
null,
"ihe-authorOrg"),

INTENDED_RECIPIENT(
INTENDED_RECIPIENT_PROFILE,
MhdProfile.INTENDED_RECIPIENT_PROFILE,
null,
"ihe-intendedRecipient"),

SOURCE_ID(
SOURCE_ID_PROFILE,
MhdProfile.SOURCE_ID_PROFILE,
null,
"ihe-sourceId"),

SUBMISSIONSET_UNIQUE_IDENTIFIER(
SUBMISSIONSET_UNIQUE_IDENTIFIER_PROFILE,
MhdProfile.SUBMISSIONSET_UNIQUE_IDENTIFIER_PROFILE,
null,
"IHE.MHD.SubmissionSetUniqueIdIdentifier"),

UNIQUE_ID_IDENTIFIER(
UNIQUE_ID_IDENTIFIER_PROFILE,
MhdProfile.UNIQUE_ID_IDENTIFIER_PROFILE,
null,
"IHE.MHD.UniqueIdIdentifier"),

ENTRY_UUID_IDENTIFIER(
ENTRY_UUID_IDENTIFIER_PROFILE,
MhdProfile.ENTRY_UUID_IDENTIFIER_PROFILE,
null,
"IHE.MHD.EntryUUID.Identifier");


// Bundle Profiles V4

public static final String ITI65_MINIMAL_BUNDLE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.ProvideBundle";
public static final String ITI65_COMPREHENSIVE_BUNDLE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.ProvideBundle";
public static final String ITI65_UNCONTAINED_COMPREHENSIVE_BUNDLE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.UnContained.Comprehensive.ProvideBundle";
public static final String ITI65_PROVIDE_DOCUMENT_BUNDLE_RESPONSE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.ProvideDocumentBundleResponse";
public static final String ITI66_FIND_DOCUMENT_LISTS_RESPONSE_BUNDLE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.FindDocumentListsResponseMessage";
public static final String ITI67_FIND_DOCUMENT_REFERENCES_RESPONSE_BUNDLE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.FindDocumentReferencesResponseMessage";
public static final String ITI67_FIND_DOCUMENT_REFERENCES_COMPREHENSIVE_RESPONSE_BUNDLE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.FindDocumentReferencesComprehensiveResponseMessage";

// DocumentManifest/List profiles

public static final String MHD_LIST_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.List";
public static final String COMPREHENSIVE_SUBMISSIONSET_TYPE_LIST_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.SubmissionSet";
public static final String UNCONTAINED_COMPREHENSIVE_SUBMISSIONSET_TYPE_LIST_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.UnContained.Comprehensive.SubmissionSet";
public static final String MINIMAL_SUBMISSIONSET_TYPE_LIST_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.SubmissionSet";

// List Profile

public static final String MINIMAL_FOLDER_TYPE_LIST_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.Folder";
public static final String COMPREHENSIVE_FOLDER_TYPE_LIST_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.Folder";

// DocumentReference profiles

public static final String COMPREHENSIVE_DOCUMENT_REFERENCE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Comprehensive.DocumentReference";
public static final String UNCONTAINED_COMPREHENSIVE_DOCUMENT_REFERENCE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.UnContained.Comprehensive.DocumentReference";
public static final String MINIMAL_DOCUMENT_REFERENCE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Minimal.DocumentReference";
public static final String SIMPLIFIED_PUBLISH_DOCUMENT_REFERENCE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.SimplifiedPublish.DocumentReference";

// Parameters

public static final String DOCUMENT_REFERENCE_PATCH_PARAMETERS_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.Patch.Parameters";
public static final String GENERATE_METADATA_PARAMETERS_IN_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.GenerateMetadata.Parameters.In";
public static final String GENERATE_METADATA_PARAMETERS_OUT_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.GenerateMetadata.Parameters.Out";

// Datatypes

public static final String DESIGNATION_TYPE_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-designationType";
public static final String AUTHOR_ORG_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-authorOrg";
public static final String INTENDED_RECIPIENT_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-intendedRecipient";
public static final String SOURCE_ID_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/ihe-sourceId";
public static final String SUBMISSIONSET_UNIQUE_IDENTIFIER_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.SubmissionSetUniqueIdIdentifier";
public static final String UNIQUE_ID_IDENTIFIER_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.UniqueIdIdentifier";
public static final String ENTRY_UUID_IDENTIFIER_PROFILE = "https://profiles.ihe.net/ITI/MHD/StructureDefinition/IHE.MHD.EntryUUID.Identifier";


@Getter
private final String url;

Expand Down Expand Up @@ -218,7 +264,8 @@ public static void registerDefaultTypes(FhirContext fhirContext) {
.filter(profile -> profile.resourceClass != null)
.forEach(profile -> fhirContext.setDefaultTypeForProfile(profile.url, profile.resourceClass));
fhirContext.registerCustomTypes(Arrays.asList(
Source.class, EntryUuidIdentifier.class, SubmissionSetUniqueIdIdentifier.class, UniqueIdIdentifier.class
EntryUuidIdentifier.class, SubmissionSetUniqueIdIdentifier.class, UniqueIdIdentifier.class
// , Source.class
));
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
/*
* Copyright 2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openehealth.ipf.commons.ihe.fhir.mhd.model;

import org.hl7.fhir.r4.model.DocumentReference;
import org.openehealth.ipf.commons.ihe.fhir.mhd.Mhd421;

import java.util.UUID;

abstract class AbstractDocumentReference<T extends AbstractDocumentReference<T>>
extends DocumentReference
implements Mhd421 {

/**
* Sets the MasterIdentifier to be a Unique Id as required by the profile
*
* @param system system value
* @param value identifier value
* @return this object
*/
@SuppressWarnings("unchecked")
public T setUniqueIdIdentifier(String system, String value) {
setMasterIdentifier(new UniqueIdIdentifier()
.setSystem(system)
.setValue(value));
return (T)this;
}

/**
* Adds an identifier to be a EntryUuid as required by the profile
* @param uuid UUID
* @return this object
*/
@SuppressWarnings("unchecked")
public T setEntryUuidIdentifier(UUID uuid) {
getIdentifier().add(new EntryUuidIdentifier(uuid));
return (T)this;
}

}
Original file line number Diff line number Diff line change
@@ -1,10 +1,25 @@
/*
* Copyright 2023 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.openehealth.ipf.commons.ihe.fhir.mhd.model;

import org.hl7.fhir.r4.model.Binary;
import org.hl7.fhir.r4.model.Bundle;
import org.hl7.fhir.r4.model.Resource;

public class AbstractProvideDocumentBundle<T extends AbstractProvideDocumentBundle<T>> extends Bundle {
abstract class AbstractProvideDocumentBundle<T extends AbstractProvideDocumentBundle<T>> extends Bundle {

public T addEntry(String fullUrl, Resource resource) {
addEntry()
Expand All @@ -17,7 +32,7 @@ public T addEntry(String fullUrl, Resource resource) {
return (T)this;
}

public T addFolder(String fullUrl, FolderList<?> folderList) {
public T addFolderList(String fullUrl, FolderList<?> folderList) {
return addEntry(fullUrl, folderList);
}

Expand Down
Loading

0 comments on commit 347fa6b

Please sign in to comment.