Skip to content

Commit

Permalink
v0.3.0 Added Iteration Status to what to download / store.
Browse files Browse the repository at this point in the history
  • Loading branch information
PaitoAnderson committed Dec 4, 2013
1 parent 50390b7 commit 2373111
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Skrumaz/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.skrumaz.app"
android:versionCode="024"
android:versionName="0.2.4" >
android:versionCode="030"
android:versionName="0.3.0" >

<uses-sdk
android:minSdkVersion="15"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
* This data class is used for storing user stories and defects
*/
public class Artifact {

private String FormattedID;
private String Name;
private String Rank;
Expand Down
9 changes: 9 additions & 0 deletions Skrumaz/src/main/java/com/skrumaz/app/classes/Iteration.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
public class Iteration {
private Long Oid;
private String Name;
private IterationStatus IterationStatus;

public Long getOid() {
return Oid;
Expand All @@ -22,4 +23,12 @@ public String getName() {
public void setName(String name) {
this.Name = name;
}

public IterationStatus getIterationStatus() {
return IterationStatus;
}

public void setIterationStatus(IterationStatus iterationStatus) {
IterationStatus = iterationStatus;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package com.skrumaz.app.classes;

/**
* Created by Paito Anderson on 12/3/2013.
*/
public enum IterationStatus {
RD_PLANNED, RD_COMMITTED, RD_ACCEPTED
}
2 changes: 1 addition & 1 deletion Skrumaz/src/main/java/com/skrumaz/app/data/Database.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public class Database extends SQLiteOpenHelper {
"(" + Field.PROJECT_ID + " LONG PRIMARY KEY, " + Field.TITLE + " TEXT, " + Field.REFRESH_DATE + " LONG)";

private static final String CREATE_TABLE_ITERATIONS = "CREATE TABLE " + Table.ITERATIONS +
"(" + Field.ITERATION_ID + " LONG PRIMARY KEY, " + Field.PROJECT_ID + " LONG, " + Field.TITLE + " TEXT, " + Field.REFRESH_DATE + " LONG, " + Field.UPDATED + " CHAR(1))";
"(" + Field.ITERATION_ID + " LONG PRIMARY KEY, " + Field.PROJECT_ID + " LONG, " + Field.TITLE + " TEXT, " + Field.REFRESH_DATE + " LONG, " + Field.ITERATION_STATUS + " VARCHAR(12), " + Field.UPDATED + " CHAR(1))";

private static final String CREATE_TABLE_ARTIFACTS = "CREATE TABLE " + Table.ARTIFACTS +
"(" + Field.FORMATTED_ID + " VARCHAR(15) PRIMARY KEY, " + Field.ITERATION_ID + " LONG, " + Field.TITLE + " TEXT, " +
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.skrumaz.app.classes.Iteration;
import com.skrumaz.app.classes.Task;
import com.skrumaz.app.data.Database;
import com.skrumaz.app.utils.IterationStatusLookup;
import com.skrumaz.app.utils.StatusLookup;

import java.util.ArrayList;
Expand Down Expand Up @@ -53,7 +54,8 @@ public void storeArtifacts(List<Artifact> artifacts, Iteration iteration) {
// Insert record
iterationValues.put(Field.ITERATION_ID, iteration.getOid());
iterationValues.put(Field.TITLE, iteration.getName());
db.insert(Table.ITERATIONS, null, iterationValues);
iterationValues.put(Field.ITERATION_STATUS, IterationStatusLookup.iterationStatusToString(iteration.getIterationStatus()));
db.insert(Table.ITERATIONS, null, iterationValues);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ public class Field {
public static final String BLOCKED = "Blocked";
public static final String RANK = "Rank";
public static final String STATUS = "Status";
public static final String ITERATION_STATUS = "IterationStatus";
public static final String MODIFIED_DATE = "ModifiedDate";
public static final String REFRESH_DATE = "RefreshDate";
public static final String UPDATED = "Updated";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.skrumaz.app.classes.Iteration;
import com.skrumaz.app.classes.Project;
import com.skrumaz.app.data.Database;
import com.skrumaz.app.utils.IterationStatusLookup;

import java.util.ArrayList;
import java.util.Date;
Expand Down Expand Up @@ -55,6 +56,7 @@ public void storeIterations(List<Iteration> iterations, Project project) {

iterationValues.put(Field.TITLE, iteration.getName());
iterationValues.put(Field.PROJECT_ID, project.getOid());
iterationValues.put(Field.ITERATION_STATUS, IterationStatusLookup.iterationStatusToString(iteration.getIterationStatus()));
iterationValues.put(Field.UPDATED, "Y");

// Try Update then Insert
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
import com.skrumaz.app.classes.Task;
import com.skrumaz.app.data.Preferences;
import com.skrumaz.app.data.Store.Artifacts;
import com.skrumaz.app.utils.IterationStatusLookup;
import com.skrumaz.app.utils.StatusLookup;

import org.apache.http.HttpResponse;
Expand Down Expand Up @@ -60,9 +61,9 @@ public List<Artifact> FetchItems(Context context) {

// Setup HTTP Request
DefaultHttpClient httpClient = new DefaultHttpClient();
HttpGet get = new HttpGet("https://rally1.rallydev.com/slm/webservice/v2.0/iteration:current");
HttpGet get = new HttpGet("https://rally1.rallydev.com/slm/webservice/v2.0/iteration:current?fetch=Iteration,ObjectID,Name,State");

Log.d("GetArtifacts", "https://rally1.rallydev.com/slm/webservice/v2.0/iteration:current?pretty=true");
Log.d("GetArtifacts", "https://rally1.rallydev.com/slm/webservice/v2.0/iteration:current?fetch=Iteration,ObjectID,Name,State&pretty=true");

// Setup HTTP Headers / Authorization
get.setHeader("Accept", "application/json");
Expand All @@ -85,6 +86,7 @@ public List<Artifact> FetchItems(Context context) {
// Get Iteration Name and Reference
iteration.setOid(Long.parseLong(jsonIteration.getJSONObject("Iteration").getString("ObjectID")));
iteration.setName(jsonIteration.getJSONObject("Iteration").getString("Name").toString());
iteration.setIterationStatus(IterationStatusLookup.stringToIterationStatus(jsonIteration.getJSONObject("Iteration").getString("State")));

Log.i("GetArtifacts", "Iteration: " + iteration.getName());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
import com.skrumaz.app.classes.Project;
import com.skrumaz.app.data.Preferences;
import com.skrumaz.app.data.Store.Iterations;
import com.skrumaz.app.utils.IterationStatusLookup;

import org.apache.http.HttpResponse;
import org.apache.http.StatusLine;
Expand Down Expand Up @@ -121,9 +122,9 @@ private void GetProjectIterations(Context context) {
// Setup HTTP Request
DefaultHttpClient httpClient = new DefaultHttpClient();

HttpGet get = new HttpGet("https://rally1.rallydev.com/slm/webservice/v2.0/project/" + project.getOid() + "/Iterations?fetch=ObjectID,Name&order=ObjectID%20desc");
HttpGet get = new HttpGet("https://rally1.rallydev.com/slm/webservice/v2.0/project/" + project.getOid() + "/Iterations?fetch=ObjectID,Name,State&order=ObjectID%20desc");

Log.d("GetIterations","https://rally1.rallydev.com/slm/webservice/v2.0/project/" + project.getOid() + "/Iterations?fetch=ObjectID,Name&order=ObjectID%20desc&pretty=true");
Log.d("GetIterations","https://rally1.rallydev.com/slm/webservice/v2.0/project/" + project.getOid() + "/Iterations?fetch=ObjectID,Name,State&order=ObjectID%20desc&pretty=true");

// Setup HTTP Headers / Authorization
get.setHeader("Accept", "application/json");
Expand Down Expand Up @@ -151,6 +152,7 @@ private void GetProjectIterations(Context context) {
Iteration iteration = new Iteration();
iteration.setOid(Long.parseLong(iterationArray.getJSONObject(i).getString("ObjectID")));
iteration.setName(iterationArray.getJSONObject(i).getString("Name"));
iteration.setIterationStatus(IterationStatusLookup.stringToIterationStatus(iterationArray.getJSONObject(i).getString("State")));

// Add iteration to list
iterations.add(iteration);
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
package com.skrumaz.app.utils;

import com.skrumaz.app.classes.IterationStatus;

/**
* Created by Paito Anderson on 12/3/2013.
*/
public class IterationStatusLookup {

public static IterationStatus stringToIterationStatus(String status) {

// When we move to Java SE 7 we can have our String Switch case ;)
if (status.equalsIgnoreCase("Planning")) {
return IterationStatus.RD_PLANNED;
} else if (status.equalsIgnoreCase("Committed")) {
return IterationStatus.RD_COMMITTED;
} else if (status.equalsIgnoreCase("Accepted")) {
return IterationStatus.RD_ACCEPTED;
} else {
return IterationStatus.RD_PLANNED;
}
}

public static String iterationStatusToString(IterationStatus status) {
switch (status)
{
case RD_PLANNED:
return "Planning";
case RD_COMMITTED:
return "Committed";
case RD_ACCEPTED:
return "Accepted";
default:
return "Planning";
}
}
}

0 comments on commit 2373111

Please sign in to comment.