-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Processing of modified DHIS2 tracked entity instances.
- Loading branch information
Showing
56 changed files
with
2,267 additions
and
861 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
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
43 changes: 43 additions & 0 deletions
43
common/src/main/java/org/dhis2/fhir/adapter/data/model/DataGroup.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,43 @@ | ||
package org.dhis2.fhir.adapter.data.model; | ||
|
||
/* | ||
* Copyright (c) 2004-2018, University of Oslo | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* Neither the name of the HISP project nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* Combines a group of data items that are processed together. A data group has | ||
* a unique ID that contains more or less primitive values which make it possible | ||
* to lookup the data group. | ||
* | ||
* @author volsch | ||
*/ | ||
public interface DataGroup extends Serializable | ||
{ | ||
DataGroupId getGroupId(); | ||
} |
41 changes: 41 additions & 0 deletions
41
common/src/main/java/org/dhis2/fhir/adapter/data/model/DataGroupId.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,41 @@ | ||
package org.dhis2.fhir.adapter.data.model; | ||
|
||
/* | ||
* Copyright (c) 2004-2018, University of Oslo | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* Neither the name of the HISP project nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
import java.io.Serializable; | ||
|
||
/** | ||
* The ID of a data group. The ID must contain only more or less primitive values | ||
* (strings and UUIDs are allowed). | ||
* | ||
* @author volsch | ||
*/ | ||
public interface DataGroupId extends Serializable | ||
{ | ||
} |
78 changes: 78 additions & 0 deletions
78
common/src/main/java/org/dhis2/fhir/adapter/data/model/DataGroupUpdate.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,78 @@ | ||
package org.dhis2.fhir.adapter.data.model; | ||
|
||
/* | ||
* Copyright (c) 2004-2018, University of Oslo | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* Neither the name of the HISP project nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.persistence.Basic; | ||
import javax.persistence.Column; | ||
import javax.persistence.MappedSuperclass; | ||
import javax.persistence.Transient; | ||
import java.io.Serializable; | ||
import java.time.Instant; | ||
|
||
/** | ||
* Contains the update status of a data group. | ||
* | ||
* @param <G> the group to which the update data belongs to. | ||
* @author volsch | ||
*/ | ||
@MappedSuperclass | ||
public abstract class DataGroupUpdate<G extends DataGroup> implements Serializable | ||
{ | ||
private static final long serialVersionUID = -2051276256396499975L; | ||
|
||
private Instant lastUpdated; | ||
|
||
public DataGroupUpdate() | ||
{ | ||
super(); | ||
} | ||
|
||
public DataGroupUpdate( @Nonnull Instant lastUpdated ) | ||
{ | ||
this.lastUpdated = lastUpdated; | ||
} | ||
|
||
@Transient | ||
public abstract G getGroup(); | ||
|
||
public abstract void setGroup( G group ); | ||
|
||
@Basic | ||
@Column( name = "last_updated", nullable = false ) | ||
public Instant getLastUpdated() | ||
{ | ||
return lastUpdated; | ||
} | ||
|
||
public void setLastUpdated( Instant remoteLastUpdate ) | ||
{ | ||
this.lastUpdated = remoteLastUpdate; | ||
} | ||
} |
78 changes: 78 additions & 0 deletions
78
common/src/main/java/org/dhis2/fhir/adapter/data/model/ProcessedItem.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,78 @@ | ||
package org.dhis2.fhir.adapter.data.model; | ||
|
||
/* | ||
* Copyright (c) 2004-2018, University of Oslo | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* Neither the name of the HISP project nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.persistence.Column; | ||
import javax.persistence.MappedSuperclass; | ||
import javax.persistence.Transient; | ||
import java.io.Serializable; | ||
import java.time.Instant; | ||
|
||
/** | ||
* Contains the reference of an item that has already been processed recently and | ||
* must not be processed again currently (e.g. overlapping polls). | ||
* | ||
* @param <I> the ID class of the processed items. | ||
* @param <G> the concrete type of the group of the ID. | ||
* @author volsch | ||
*/ | ||
@MappedSuperclass | ||
public abstract class ProcessedItem<I extends ProcessedItemId<G>, G extends DataGroup> implements Serializable | ||
{ | ||
private static final long serialVersionUID = -2744716962486660280L; | ||
|
||
private Instant processedAt; | ||
|
||
public ProcessedItem() | ||
{ | ||
super(); | ||
} | ||
|
||
public ProcessedItem( @Nonnull Instant processedAt ) | ||
{ | ||
this.processedAt = processedAt; | ||
} | ||
|
||
@Transient | ||
public abstract I getId(); | ||
|
||
public abstract void setId( I id ); | ||
|
||
@Column( name = "processed_at", nullable = false ) | ||
public Instant getProcessedAt() | ||
{ | ||
return processedAt; | ||
} | ||
|
||
public void setProcessedAt( Instant processedAt ) | ||
{ | ||
this.processedAt = processedAt; | ||
} | ||
} |
93 changes: 93 additions & 0 deletions
93
common/src/main/java/org/dhis2/fhir/adapter/data/model/ProcessedItemId.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,93 @@ | ||
package org.dhis2.fhir.adapter.data.model; | ||
|
||
/* | ||
* Copyright (c) 2004-2018, University of Oslo | ||
* All rights reserved. | ||
* | ||
* Redistribution and use in source and binary forms, with or without | ||
* modification, are permitted provided that the following conditions are met: | ||
* Redistributions of source code must retain the above copyright notice, this | ||
* list of conditions and the following disclaimer. | ||
* | ||
* Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* Neither the name of the HISP project nor the names of its contributors may | ||
* be used to endorse or promote products derived from this software without | ||
* specific prior written permission. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
*/ | ||
|
||
import javax.annotation.Nonnull; | ||
import javax.persistence.Column; | ||
import javax.persistence.MappedSuperclass; | ||
import javax.persistence.Transient; | ||
import java.io.Serializable; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Contains the reference (as an ID) of an item that has already been | ||
* processed recently and must not be processed again currently | ||
* (e.g. overlapping polls). | ||
* | ||
* @param <G> the concrete type of the group of the ID. | ||
* @author volsch | ||
*/ | ||
@MappedSuperclass | ||
public abstract class ProcessedItemId<G extends DataGroup> implements Serializable | ||
{ | ||
private static final long serialVersionUID = -2744716962486660280L; | ||
|
||
private String processedId; | ||
|
||
public ProcessedItemId() | ||
{ | ||
super(); | ||
} | ||
|
||
public ProcessedItemId( @Nonnull String processedId ) | ||
{ | ||
this.processedId = processedId; | ||
} | ||
|
||
@Transient | ||
public abstract G getGroup(); | ||
|
||
public abstract void setGroup( G group ); | ||
|
||
@Column( name = "processed_id", nullable = false ) | ||
public String getProcessedId() | ||
{ | ||
return processedId; | ||
} | ||
|
||
public void setProcessedId( String processedId ) | ||
{ | ||
this.processedId = processedId; | ||
} | ||
|
||
@Override | ||
public boolean equals( Object o ) | ||
{ | ||
if ( this == o ) return true; | ||
if ( o == null || getClass() != o.getClass() ) return false; | ||
ProcessedItemId that = (ProcessedItemId) o; | ||
return Objects.equals( processedId, that.processedId ); | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return Objects.hash( processedId ); | ||
} | ||
} |
Oops, something went wrong.