-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from ehrbase/feature/CDR-279
Feature/cdr 279
- Loading branch information
Showing
7 changed files
with
358 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
95 changes: 95 additions & 0 deletions
95
simple-plugin/src/main/java/org/ehrbase/example_plugin/CompositionListener4.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
package org.ehrbase.example_plugin; | ||
|
||
import com.nedap.archie.rm.composition.Composition; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
import java.util.function.Function; | ||
import org.ehrbase.plugin.dto.CompositionIdWithVersionAndEhrId; | ||
import org.ehrbase.plugin.dto.CompositionVersionIdWithEhrId; | ||
import org.ehrbase.plugin.dto.CompositionWithEhrId; | ||
import org.ehrbase.plugin.dto.CompositionWithEhrIdAndPreviousVersion; | ||
import org.ehrbase.plugin.extensionpoints.CompositionExtensionPoint; | ||
import org.ehrbase.plugin.extensionpoints.ExtensionPointHelper; | ||
import org.pf4j.Extension; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
import org.springframework.core.PriorityOrdered; | ||
|
||
/** | ||
* @author Stefan Spiska | ||
*/ | ||
|
||
@Extension | ||
public class CompositionListener4 implements CompositionExtensionPoint, PriorityOrdered { | ||
private static final Logger log = LoggerFactory.getLogger(CompositionListener4.class); | ||
|
||
@Override | ||
public int getOrder() { | ||
return 0; | ||
} | ||
|
||
public CompositionWithEhrId beforeCreation(CompositionWithEhrId input) { | ||
log.info("Before Creation CompositionListener4"); | ||
return input; | ||
} | ||
|
||
@Override | ||
public UUID aroundCreation(CompositionWithEhrId input, Function<CompositionWithEhrId, UUID> chain) { | ||
log.info("Around Creation start CompositionListener4"); | ||
UUID uuid = ExtensionPointHelper.before(input, chain, this::beforeCreation); | ||
log.info("Around Creation end CompositionListener4"); | ||
return uuid; | ||
} | ||
|
||
public UUID afterUpdate(UUID output) { | ||
log.info("After Update CompositionListener4"); | ||
return output; | ||
} | ||
|
||
@Override | ||
public UUID aroundUpdate(CompositionWithEhrIdAndPreviousVersion input, | ||
Function<CompositionWithEhrIdAndPreviousVersion, UUID> chain) { | ||
log.info("Around Update start CompositionListener4"); | ||
UUID uuid = ExtensionPointHelper.after(input, chain, this::afterUpdate); | ||
log.info("Around Update end CompositionListener4"); | ||
return uuid; | ||
} | ||
|
||
public CompositionVersionIdWithEhrId beforeDelete(CompositionVersionIdWithEhrId input) { | ||
log.info("Before Delete CompositionListener4"); | ||
return input; | ||
} | ||
|
||
public Void afterDelete(Void v) { | ||
log.info("After Delete CompositionListener4"); | ||
return v; | ||
} | ||
|
||
@Override | ||
public Void aroundDelete(CompositionVersionIdWithEhrId input, Function<CompositionVersionIdWithEhrId, Void> chain) { | ||
log.info("Around Delete start CompositionListener4"); | ||
Void unused = ExtensionPointHelper.beforeAndAfter(input, chain, this::beforeDelete, this::afterDelete); | ||
log.info("Around Delete end CompositionListener4"); | ||
return unused; | ||
} | ||
|
||
public CompositionIdWithVersionAndEhrId beforeRetrieve(CompositionIdWithVersionAndEhrId input) { | ||
log.info("Before Retrieve CompositionListener4"); | ||
return input; | ||
} | ||
|
||
public Optional<Composition> afterRetrieve(Optional<Composition> output) { | ||
log.info("After Retrieve CompositionListener4"); | ||
return output; | ||
} | ||
|
||
@Override | ||
public Optional<Composition> aroundRetrieve(CompositionIdWithVersionAndEhrId input, | ||
Function<CompositionIdWithVersionAndEhrId, Optional<Composition>> chain) { | ||
log.info("Around Retrieve start CompositionListener4"); | ||
Optional<Composition> composition = | ||
ExtensionPointHelper.beforeAndAfter(input, chain, this::beforeRetrieve, this::afterRetrieve); | ||
log.info("Around Retrieve end CompositionListener4"); | ||
return composition; | ||
} | ||
} |
81 changes: 81 additions & 0 deletions
81
simple-plugin/src/main/java/org/ehrbase/example_plugin/EhrListener1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
package org.ehrbase.example_plugin; | ||
|
||
import com.nedap.archie.rm.changecontrol.OriginalVersion; | ||
import com.nedap.archie.rm.ehr.EhrStatus; | ||
import java.util.Optional; | ||
import java.util.UUID; | ||
import java.util.function.Function; | ||
import org.ehrbase.plugin.dto.EhrStatusVersionRequestParameters; | ||
import org.ehrbase.plugin.dto.EhrStatusWithEhrId; | ||
import org.ehrbase.plugin.extensionpoints.EhrExtensionPoint; | ||
import org.ehrbase.plugin.extensionpoints.ExtensionPointHelper; | ||
import org.pf4j.Extension; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
/** | ||
* @author Stefan Spiska | ||
*/ | ||
@Extension | ||
public class EhrListener1 implements EhrExtensionPoint { | ||
private static final Logger log = LoggerFactory.getLogger(EhrListener1.class); | ||
|
||
public EhrStatusWithEhrId beforeCreation(EhrStatusWithEhrId input) { | ||
log.info("Before Creation EhrListener1"); | ||
return input; | ||
} | ||
|
||
public UUID afterCreation(UUID output) { | ||
log.info("After Creation EhrListener1"); | ||
return output; | ||
} | ||
|
||
@Override | ||
public UUID aroundCreation(EhrStatusWithEhrId input, Function<EhrStatusWithEhrId, UUID> chain) { | ||
log.info("Around Creation start EhrListener1"); | ||
UUID uuid = ExtensionPointHelper.beforeAndAfter(input, chain, this::beforeCreation, this::afterCreation); | ||
log.info("Around Creation end EhrListener1"); | ||
return uuid; | ||
} | ||
|
||
public EhrStatusWithEhrId beforeUpdate(EhrStatusWithEhrId input) { | ||
log.info("Before Update EhrListener1"); | ||
return input; | ||
} | ||
|
||
public UUID afterUpdate(UUID output) { | ||
log.info("After Update EhrListener1"); | ||
return output; | ||
} | ||
|
||
@Override | ||
public UUID aroundUpdate(EhrStatusWithEhrId input, | ||
Function<EhrStatusWithEhrId, UUID> chain) { | ||
log.info("Around Update start EhrListener1"); | ||
UUID uuid = ExtensionPointHelper.beforeAndAfter(input, chain, this::beforeUpdate, this::afterUpdate); | ||
log.info("Around Update end EhrListener1"); | ||
return uuid; | ||
} | ||
|
||
|
||
public EhrStatusVersionRequestParameters beforeRetrieveAtVersion(EhrStatusVersionRequestParameters input) { | ||
log.info("Before Retrieve EhrListener1"); | ||
return input; | ||
} | ||
|
||
public Optional<OriginalVersion<EhrStatus>> afterRetrieveAtVersion(Optional<OriginalVersion<EhrStatus>> output) { | ||
log.info("After Retrieve EhrListener1"); | ||
return output; | ||
} | ||
|
||
@Override | ||
public Optional<OriginalVersion<EhrStatus>> aroundRetrieveAtVersion(EhrStatusVersionRequestParameters input, | ||
Function<EhrStatusVersionRequestParameters, | ||
Optional<OriginalVersion<EhrStatus>>> chain) { | ||
log.info("Around Retrieve start EhrListener1"); | ||
Optional<OriginalVersion<EhrStatus>> ehrStatusVersion = | ||
ExtensionPointHelper.beforeAndAfter(input, chain, this::beforeRetrieveAtVersion, this::afterRetrieveAtVersion); | ||
log.info("Around Retrieve end EhrListener1"); | ||
return ehrStatusVersion; | ||
} | ||
} |
34 changes: 34 additions & 0 deletions
34
simple-plugin/src/main/java/org/ehrbase/example_plugin/QueryListener1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
package org.ehrbase.example_plugin; | ||
|
||
import java.util.function.Function; | ||
import org.ehrbase.plugin.dto.QueryWithParameters; | ||
import org.ehrbase.plugin.extensionpoints.ExtensionPointHelper; | ||
import org.ehrbase.plugin.extensionpoints.QueryExtensionPoint; | ||
import org.ehrbase.response.ehrscape.QueryResultDto; | ||
import org.pf4j.Extension; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@Extension | ||
public class QueryListener1 implements QueryExtensionPoint { | ||
private static final Logger log = LoggerFactory.getLogger(QueryListener1.class); | ||
|
||
public QueryWithParameters beforeQueryExecution(QueryWithParameters input) { | ||
log.info("Before Query Exec QueryListener1"); | ||
return input; | ||
} | ||
|
||
public QueryResultDto afterQueryExecution(QueryResultDto output) { | ||
log.info("After Query Exec QueryListener1"); | ||
return output; | ||
} | ||
|
||
@Override | ||
public QueryResultDto aroundQueryExecution(QueryWithParameters input, Function<QueryWithParameters, QueryResultDto> chain) { | ||
log.info("Around Query Exec start QueryListener1"); | ||
QueryResultDto queryResultDto = | ||
ExtensionPointHelper.beforeAndAfter(input, chain, this::beforeQueryExecution, this::afterQueryExecution); | ||
log.info("Around Query Exec end QueryListener1"); | ||
return queryResultDto; | ||
} | ||
} |
32 changes: 32 additions & 0 deletions
32
simple-plugin/src/main/java/org/ehrbase/example_plugin/TemplateListener1.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
package org.ehrbase.example_plugin; | ||
|
||
import java.util.function.Function; | ||
import org.ehrbase.plugin.extensionpoints.ExtensionPointHelper; | ||
import org.ehrbase.plugin.extensionpoints.TemplateExtensionPoint; | ||
import org.openehr.schemas.v1.OPERATIONALTEMPLATE; | ||
import org.pf4j.Extension; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
@Extension | ||
public class TemplateListener1 implements TemplateExtensionPoint { | ||
private static final Logger log = LoggerFactory.getLogger(TemplateListener1.class); | ||
|
||
public OPERATIONALTEMPLATE beforeCreation(OPERATIONALTEMPLATE input) { | ||
log.info("Before Template Creation TemplateListener1"); | ||
return input; | ||
} | ||
|
||
public String afterCreation(String output) { | ||
log.info("After Template Creation TemplateListener1"); | ||
return output; | ||
} | ||
|
||
@Override | ||
public String aroundCreation(OPERATIONALTEMPLATE input, Function<OPERATIONALTEMPLATE, String> chain) { | ||
log.info("Around Template Creation start TemplateListener1"); | ||
String s = ExtensionPointHelper.beforeAndAfter(input, chain, this::beforeCreation, this::afterCreation); | ||
log.info("Around Template Creation end TemplateListener1"); | ||
return s; | ||
} | ||
} |
Oops, something went wrong.