dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #12588
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 3908: Added DataEntry Status api
------------------------------------------------------------
revno: 3908
committer: Mithilesh Kumar Thakur<mithilesh.hisp@xxxxxxxxx>
branch nick: dhis2
timestamp: Wed 2011-06-15 11:19:35 +0530
message:
Added DataEntry Status api
added:
local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/
local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatus.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatusService.java
local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatusStore.java
--
lp:dhis2
https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk
Your team DHIS 2 developers is subscribed to branch lp:dhis2.
To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription
=== added directory 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus'
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatus.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatus.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatus.java 2011-06-15 05:49:35 +0000
@@ -0,0 +1,226 @@
+package org.hisp.dhis.dataentrystatus;
+
+import java.io.Serializable;
+import java.util.Date;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+
+
+@SuppressWarnings("serial")
+public class DataEntryStatus implements Serializable
+{
+ /**
+ * Determines if a de-serialized file is compatible with this class.
+ */
+ // private static final long serialVersionUID = 6269303850789110610L;
+
+ //public static final String TRUE = "true";
+ // public static final String FALSE = "false";
+
+ /**
+ * Part of the DataEntryStatus's composite ID
+ */
+ private String includeZero;
+
+ /**
+ * Part of the DataEntryStatus's composite ID
+ */
+ private DataSet dataset;
+
+ /**
+ * Part of the DataEntryStatus's composite ID
+ */
+ private OrganisationUnit organisationunit;
+
+ /**
+ * Part of the DataEntryStatus's composite ID
+ */
+ private Period period;
+
+ private String value;
+
+ private String storedBy;
+
+ private Date timestamp;
+
+ // -------------------------------------------------------------------------
+ // Constructors
+ // -------------------------------------------------------------------------
+
+ public DataEntryStatus()
+ {
+ }
+
+ public DataEntryStatus( DataSet dataset, OrganisationUnit organisationunit, Period period )
+ {
+ this.dataset = dataset;
+ this.organisationunit = organisationunit;
+ this.period = period;
+ }
+
+ public DataEntryStatus( DataSet dataset, OrganisationUnit organisationunit, Period period, String value )
+ {
+ this.dataset = dataset;
+ this.organisationunit = organisationunit;
+ this.period = period;
+ this.value = value;
+ }
+
+ public DataEntryStatus( DataSet dataset, OrganisationUnit organisationunit, Period period, String value, String storedBy, Date timestamp )
+ {
+ this.dataset = dataset;
+ this.organisationunit = organisationunit;
+ this.period = period;
+ this.value = value;
+ this.storedBy = storedBy;
+ this.timestamp = timestamp;
+ }
+
+ // -------------------------------------------------------------------------
+ // Dimension
+ // -------------------------------------------------------------------------
+/*
+ public String getMeasure()
+ {
+ return value;
+ }
+
+ public String getName()
+ {
+ throw new UnsupportedOperationException();
+ }
+*/
+ // -------------------------------------------------------------------------
+ // Logic
+ // -------------------------------------------------------------------------
+
+ // public boolean isIncludeZero()
+ //{
+ // return includeZero != null && includeZero;
+ //}
+
+ public boolean isZero()
+ {
+ return dataset != null && value != null && new Double( value ).intValue() == 0;
+ }
+
+ public boolean isNullValue()
+ {
+ return value == null;
+ }
+
+ // -------------------------------------------------------------------------
+ // hashCode and equals
+ // -------------------------------------------------------------------------
+
+ @Override
+ public boolean equals( Object o )
+ {
+ if ( this == o )
+ {
+ return true;
+ }
+
+ if ( o == null )
+ {
+ return false;
+ }
+
+ if ( !(o instanceof DataEntryStatus ) )
+ {
+ return false;
+ }
+
+ final DataEntryStatus other = (DataEntryStatus) o;
+
+ return dataset.equals( other.getDataset() ) && organisationunit.equals( other.getOrganisationunit()) && period.equals( other.getPeriod() );
+ }
+
+ @Override
+ public int hashCode()
+ {
+ final int prime = 31;
+ int result = 1;
+
+ result = result * prime + dataset.hashCode();
+ result = result * prime + organisationunit.hashCode();
+ result = result * prime + period.hashCode();
+ return result;
+ }
+
+ // -------------------------------------------------------------------------
+ // Getters and setters
+ // -------------------------------------------------------------------------
+
+ public DataSet getDataset()
+ {
+ return dataset;
+ }
+
+ public void setDataset( DataSet dataset )
+ {
+ this.dataset = dataset;
+ }
+
+ public OrganisationUnit getOrganisationunit()
+ {
+ return organisationunit;
+ }
+
+ public void setOrganisationunit( OrganisationUnit organisationunit )
+ {
+ this.organisationunit = organisationunit;
+ }
+
+ public Period getPeriod()
+ {
+ return period;
+ }
+
+ public void setPeriod( Period period )
+ {
+ this.period = period;
+ }
+
+ public String getValue()
+ {
+ return value;
+ }
+
+ public void setValue( String value )
+ {
+ this.value = value;
+ }
+
+ public String getStoredBy()
+ {
+ return storedBy;
+ }
+
+ public void setStoredBy( String storedBy )
+ {
+ this.storedBy = storedBy;
+ }
+
+ public Date getTimestamp()
+ {
+ return timestamp;
+ }
+
+ public void setTimestamp( Date timestamp )
+ {
+ this.timestamp = timestamp;
+ }
+
+ public String getIncludeZero()
+ {
+ return includeZero;
+ }
+
+ public void setIncludeZero( String includeZero )
+ {
+ this.includeZero = includeZero;
+ }
+}
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatusService.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatusService.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatusService.java 2011-06-15 05:49:35 +0000
@@ -0,0 +1,184 @@
+package org.hisp.dhis.dataentrystatus;
+
+import java.util.Collection;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+
+
+
+
+public interface DataEntryStatusService
+{
+ String ID = DataEntryStatusService.class.getName();
+
+ // -------------------------------------------------------------------------
+ // Basic DataValue
+ // -------------------------------------------------------------------------
+
+ /**
+ * Adds a DataEntryStatus If value specified DataEntryStatus object are null, then the object should not be
+ * persisted.
+ *
+ * @param dataEntryStatus the DataEntryStatus to add.
+ */
+
+ void addDataEntryStatus( DataEntryStatus dataEntryStatus );
+
+ /**
+ * Update a DataEntryStatus If value specified DataEntryStatus object are null, then the object should not be
+ * persisted.
+ *
+ * @param dataEntryStatus the DataEntryStatus to add.
+ */
+
+ void updateDataEntryStatus( DataEntryStatus dataEntryStatus );
+
+ /**
+ * Deletes a DataEntryStatus.
+ *
+ * @param dataEntryStatus the DataEntryStatus to delete.
+ */
+ void deleteDataEntryStatus( DataEntryStatus dataEntryStatus );
+
+ /**
+ * Deletes all DataEntryStatus connected to a Source.
+ *
+ * @param organisationUnit the OrganisationUnit for which the DataEntryStatus should be deleted.
+ * @return the number of deleted DataEntryStatus.
+ */
+ int deleteDataEntryStatusBySource( OrganisationUnit organisationUnit );
+
+ /**
+ * Deletes all DataEntryStatus registered for the given DataSet.
+ *
+ * @param dataSet the DataSet for which the DataEntryStatus should be deleted.
+ * @return the number of deleted DataValues.
+ */
+ int deleteDataEntryStatusByDataSet( DataSet dataSet );
+
+ /**
+ * Returns a DataEntryStatus.
+ *
+ * @param organisationUnit the organisationUnit of the DataValue.
+ * @param dataSet the DataSet of the DataEntryStatus.
+ * @param period the Period of the DataEntryStatus.
+ * @return the DataEntryStatus which corresponds to the given parameters, or null
+ * if no match.
+ */
+
+ DataEntryStatus getDataEntryStatusValue( DataSet dataSet, OrganisationUnit organisationUnit, Period period, String includeZero );
+
+ /**
+ * Returns a DataEntryStatus.
+ *
+ * @param dataSetId the DataElement identifier.
+ * @param organisationUnitId the Source identifier.
+ * @param periodId the Period identifier.
+ * @param includeZero the String identifier.
+
+ * @return the DataEntryStatus.
+ */
+ String getValue( int dataSetId, int organisationUnitId, int periodId , String includeZero );
+
+
+
+ // -------------------------------------------------------------------------
+ // Collections of DataEntryStatus
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns all DataEntryStatus.
+ *
+ * @return a collection of all DataValues.
+ */
+ Collection<DataEntryStatus> getAllDataEntryStatusValues();
+
+ /**
+ * Returns all DataEntryStatusValues for a given OrganisationUnit and Period.
+ *
+ * @param organisationUnit the OrganisationUnit of the DataEntryStatus.
+ * @param period the Period of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given OrganisationUnit and
+ * Period, or an empty collection if no values match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( OrganisationUnit organisationUnit, Period period );
+
+ /**
+ * Returns all DataEntryStatusValues for a given DataSet and OrganisationUnit
+ *
+ * @param organisationUnit the OrganisationUnit of the DataEntryStatus.
+ * @param dataSet the DataSet of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given OrganisationUnit and
+ * dataSet, or an empty collection if no values match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet, OrganisationUnit organisationUnit );
+
+ /**
+ * Returns all DataEntryStatus for a given DataSet.
+ *
+ * @param dataSet the DataSet of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which mach the given collection of DataSet.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet );
+
+
+ /**
+ * Returns all DataEntryStatus for a given collection of OrganisationUnits and a
+ * DataSet.
+ *
+ * @param organisationUnits the OrganisationUnits of the DataEntryStatus.
+ * @param dataSet the DataSet of the DataValues.
+ * @return a collection of all DataEntryStatusValues which match any of the given
+ * organisationUnits and the DataSet, or an empty collection if no values
+ * match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet, Collection<OrganisationUnit> organisationUnits );
+
+ /**
+ * Returns all DataEntryStatus for a given Source, Period, and collection of
+ * DataElements.
+ *
+ * @param organisationUnit the OrganisationUnit of the DataEntryStatus.
+ * @param period the Period of the DataEntryStatus.
+ * @param dataSets the DataSets of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given OrganisationUnit,
+ * Period, and any of the dataSets, or an empty collection if no
+ * values match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( Collection<DataSet> dataSets, OrganisationUnit organisationUnit, Period period );
+
+ /**
+ * Returns all DataEntryStatus for a given DataElement, Period, and collection of
+ * OrganisationUnits.
+ *
+ * @param organisationUnit the OrganisationUnit of the DataEntryStatus.
+ * @param period the Period of the DataEntryStatus.
+ * @param dataSets the DataSets of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given DataSet,
+ * Period, and any of the OrganisationUnit, or an empty collection if no
+ * values match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet, Collection<OrganisationUnit> organisationUnits, Period period );
+
+ /**
+ * Returns all DataEntryStatus for a given DataSet, collection of Periods, and
+ * collection of organisationUnits
+ * @param dataSet the dataSet of the DataEntryStatus.
+ * @param periods the periods of the DataEntryStatus.
+ * @param organisationUnits the organisationUnits of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given DataSet,
+ * Periods, and organisationUnits.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet, Collection<OrganisationUnit> organisationUnits, Collection<Period> periods );
+
+ /**
+ * Returns all DataEntryStatusValues for a given collection of dataSets.
+ *
+ * @param datasets the DataSet of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given collection of
+ * dataSets.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( Collection<DataSet> dataSets );
+}
=== added file 'local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatusStore.java'
--- local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatusStore.java 1970-01-01 00:00:00 +0000
+++ local/in/dhis-in-api/src/main/java/org/hisp/dhis/dataentrystatus/DataEntryStatusStore.java 2011-06-15 05:49:35 +0000
@@ -0,0 +1,178 @@
+package org.hisp.dhis.dataentrystatus;
+
+import java.util.Collection;
+
+import org.hisp.dhis.dataset.DataSet;
+import org.hisp.dhis.organisationunit.OrganisationUnit;
+import org.hisp.dhis.period.Period;
+
+public interface DataEntryStatusStore
+{
+ String ID = DataEntryStatusStore.class.getName();
+
+ // -------------------------------------------------------------------------
+ // Basic DataValue
+ // -------------------------------------------------------------------------
+
+ /**
+ * Adds a DataEntryStatus If value specified DataEntryStatus object are null, then the object should not be
+ * persisted.
+ *
+ * @param dataEntryStatus the DataEntryStatus to add.
+ */
+
+ void addDataEntryStatus( DataEntryStatus dataEntryStatus );
+
+ /**
+ * Update a DataEntryStatus If value specified DataEntryStatus object are null, then the object should not be
+ * persisted.
+ *
+ * @param dataEntryStatus the DataEntryStatus to add.
+ */
+
+ void updateDataEntryStatus( DataEntryStatus dataEntryStatus );
+
+ /**
+ * Deletes a DataEntryStatus.
+ *
+ * @param dataEntryStatus the DataEntryStatus to delete.
+ */
+ void deleteDataEntryStatus( DataEntryStatus dataEntryStatus );
+
+ /**
+ * Deletes all DataEntryStatus connected to a Source.
+ *
+ * @param organisationUnit the OrganisationUnit for which the DataEntryStatus should be deleted.
+ * @return the number of deleted DataEntryStatus.
+ */
+ int deleteDataEntryStatusBySource( OrganisationUnit organisationUnit );
+
+ /**
+ * Deletes all DataEntryStatus registered for the given DataSet.
+ *
+ * @param dataSet the DataSet for which the DataEntryStatus should be deleted.
+ * @return the number of deleted DataValues.
+ */
+ int deleteDataEntryStatusByDataSet( DataSet dataSet );
+
+ /**
+ * Returns a DataEntryStatus.
+ *
+ * @param organisationUnit the organisationUnit of the DataValue.
+ * @param dataSet the DataSet of the DataEntryStatus.
+ * @param period the Period of the DataEntryStatus.
+ * @return the DataEntryStatus which corresponds to the given parameters, or null
+ * if no match.
+ */
+
+ DataEntryStatus getDataEntryStatusValue( DataSet dataSet, OrganisationUnit organisationUnit, Period period, String includeZero);
+
+ /**
+ * Returns a DataEntryStatus.
+ *
+ * @param dataSetId the DataElement identifier.
+ * @param organisationUnitId the Source identifier.
+ * @param periodId the Period identifier.
+ * @param includeZero the String identifier
+
+ * @return the DataEntryStatus.
+ */
+ String getValue( int dataSetId, int organisationUnitId, int periodId, String includeZero );
+
+ // -------------------------------------------------------------------------
+ // Collections of DataEntryStatus
+ // -------------------------------------------------------------------------
+
+ /**
+ * Returns all DataEntryStatus.
+ *
+ * @return a collection of all DataEntryStatusValues.
+ */
+ Collection<DataEntryStatus> getAllDataEntryStatusValues();
+
+ /**
+ * Returns all getAllDataEntryStatusValues for a given OrganisationUnit and Period.
+ *
+ * @param organisationUnit the OrganisationUnit of the DataEntryStatus.
+ * @param period the Period of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given OrganisationUnit and
+ * Period, or an empty collection if no values match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( OrganisationUnit organisationUnit, Period period );
+
+ /**
+ * Returns all DataEntryStatusValues for a given DataSet and OrganisationUnit
+ *
+ * @param organisationUnit the OrganisationUnit of the DataEntryStatus.
+ * @param dataSet the DataSet of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given OrganisationUnit and
+ * dataSet, or an empty collection if no values match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet, OrganisationUnit organisationUnit );
+
+ /**
+ * Returns all DataEntryStatus for a given collection of DataElements.
+ *
+ * @param dataSet the DataSet of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which mach the given collection of DataSet.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet );
+
+ /**
+ * Returns all DataEntryStatus for a given collection of OrganisationUnits and a
+ * DataSet.
+ *
+ * @param organisationUnits the OrganisationUnits of the DataEntryStatus.
+ * @param dataSet the DataSet of the DataValues.
+ * @return a collection of all DataEntryStatusValues which match any of the given
+ * organisationUnits and the DataSet, or an empty collection if no values
+ * match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet, Collection<OrganisationUnit> organisationUnits );
+
+ /**
+ * Returns all DataEntryStatus for a given Source, Period, and collection of
+ * DataElements.
+ *
+ * @param organisationUnit the OrganisationUnit of the DataEntryStatus.
+ * @param period the Period of the DataEntryStatus.
+ * @param dataSets the DataSets of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given OrganisationUnit,
+ * Period, and any of the dataSets, or an empty collection if no
+ * values match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( Collection<DataSet> dataSets, OrganisationUnit organisationUnit, Period period );
+
+ /**
+ * Returns all DataEntryStatus for a given DataElement, Period, and collection of
+ * OrganisationUnits.
+ *
+ * @param organisationUnit the OrganisationUnit of the DataEntryStatus.
+ * @param period the Period of the DataEntryStatus.
+ * @param dataSets the DataSets of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given DataSet,
+ * Period, and any of the OrganisationUnit, or an empty collection if no
+ * values match.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet, Collection<OrganisationUnit> organisationUnits, Period period );
+
+ /**
+ * Returns all DataEntryStatus for a given DataSet, collection of Periods, and
+ * collection of organisationUnits
+ * @param dataSet the dataSet of the DataEntryStatus.
+ * @param periods the periods of the DataEntryStatus.
+ * @param organisationUnits the organisationUnits of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given DataSet,
+ * Periods, and organisationUnits.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( DataSet dataSet, Collection<OrganisationUnit> organisationUnits, Collection<Period> periods );
+
+ /**
+ * Returns all DataEntryStatusValues for a given collection of dataSets.
+ *
+ * @param datasets the DataSet of the DataEntryStatus.
+ * @return a collection of all DataEntryStatusValues which match the given collection of
+ * dataSets.
+ */
+ Collection<DataEntryStatus> getDataEntryStatusValues( Collection<DataSet> dataSets );
+}