dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #29402
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 14846: Removed deprecated constructor on period
------------------------------------------------------------
revno: 14846
committer: Lars Helge Øverland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2014-04-14 14:24:25 +0200
message:
Removed deprecated constructor on period
modified:
dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.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
=== modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java'
--- dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2014-03-18 08:10:10 +0000
+++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/period/Period.java 2014-04-14 12:24:25 +0000
@@ -28,12 +28,9 @@
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-import com.fasterxml.jackson.annotation.JsonProperty;
-import com.fasterxml.jackson.annotation.JsonView;
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.fasterxml.jackson.databind.annotation.JsonSerialize;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
-import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
import org.hisp.dhis.common.BaseNameableObject;
import org.hisp.dhis.common.DxfNamespaces;
import org.hisp.dhis.common.Weighted;
@@ -42,9 +39,12 @@
import org.hisp.dhis.common.view.DetailedView;
import org.hisp.dhis.common.view.ExportView;
-import java.text.ParseException;
-import java.text.SimpleDateFormat;
-import java.util.Date;
+import com.fasterxml.jackson.annotation.JsonProperty;
+import com.fasterxml.jackson.annotation.JsonView;
+import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
+import com.fasterxml.jackson.databind.annotation.JsonSerialize;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlProperty;
+import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
/**
* @author Kristian Nordal
@@ -61,8 +61,6 @@
public static final String DEFAULT_DATE_FORMAT = "yyyy-MM-dd";
- private static final String SEPARATOR = "_";
-
/**
* Required.
*/
@@ -102,16 +100,6 @@
this.endDate = endDate;
}
- @Deprecated
- public Period( String externalId )
- {
- final String[] id = externalId.split( SEPARATOR );
-
- this.periodType = PeriodType.getPeriodTypeByName( id[0] );
- this.startDate = getMediumDate( id[1] );
- this.endDate = getMediumDate( id[2] );
- }
-
// -------------------------------------------------------------------------
// Logic
// -------------------------------------------------------------------------
@@ -218,28 +206,6 @@
}
/**
- * Parses a date from a String on the format YYYY-MM-DD.
- *
- * @param dateString the String to parse.
- * @return a Date based on the given String.
- */
- private Date getMediumDate( String dateString )
- {
- try
- {
- final SimpleDateFormat format = new SimpleDateFormat();
-
- format.applyPattern( DEFAULT_DATE_FORMAT );
-
- return dateString != null ? format.parse( dateString ) : null;
- }
- catch ( ParseException ex )
- {
- throw new RuntimeException( "Failed to parse medium date", ex );
- }
- }
-
- /**
* Return the potential number of periods of the given period type which is
* spanned by this period.
*