Commits

Jan Brohl committed acc3d66

event kann jetzt auch laden wenn die daten korrekt und !=null sind

Comments (0)

Files changed (3)

 
 import de.scoutnet.api.API;
 
-
 public class Example {
 
 	/**
 	 * @param args
-	 * @throws ParseException 
-	 * @throws IOException 
-	 * @throws JSONException 
+	 * @throws ParseException
+	 * @throws IOException
+	 * @throws JSONException
 	 */
-	public static void main(String[] args) throws JSONException, IOException, ParseException {
+	public static void main(String[] args) throws JSONException, IOException,
+			ParseException {
 		System.out.println(API.group(1460).name);
-
+		System.out.println(API.group(1460).parent().name);
 	}
 
 }

src/de/scoutnet/api/Event.java

 
 import java.text.DateFormat;
 import java.text.ParseException;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.HashMap;
 import java.util.Iterator;
 	public int group_id, id, uid;
 	public Date end_date, end_time, last_modified_on, start_date, start_time;
 	public HashMap<Integer, String> keywords;
+	private static DateFormat d = new SimpleDateFormat("yyyy-MM-dd"),
+			t = new SimpleDateFormat("HH:mm:ss"), dt = new SimpleDateFormat(
+					"yyyy-MM-dd HH:mm:ss");
 
 	// TODO: unvollst�ndig
 	public Event(JSONObject jso) throws JSONException, ParseException {
 		group_id = jso.getInt("group_id");
 		id = jso.getInt("id");
 		uid = jso.getInt("uid");
-		DateFormat d = DateFormat.getDateInstance();
-		DateFormat t = DateFormat.getDateTimeInstance();
-		DateFormat dt = DateFormat.getDateTimeInstance();
 		end_date = d.parse(jso.getString("end_date"));
 		end_time = t.parse(jso.getString("end_time"));
 		last_modified_on = dt.parse(jso.getString("last_modified_on"));

src/de/scoutnet/api/ScoutnetCollection.java

 		this.element_kind = element_kind;
 	}
 
+	@Override
+	public String toString() {
+		String out = "ScoutnetCollection(\"" + kind + "\", \"" + element_kind
+				+ "\", new " + element_kind.charAt(0)
+				+ element_kind.substring(1) + "[]{";
+		for (T e : elements) {
+			out = out + ", " + e;
+		}
+		return out + "})";
+	}
 }