From bd7cfe95f4d15719f31e17d9aee6830066644948 Mon Sep 17 00:00:00 2001
From: Ugnich Anton
Date: Sun, 25 Dec 2011 00:05:24 +0700
Subject: Initial commit
---
.gitignore | 3 +
build.xml | 74 +++
lib/org.json.jar | Bin 0 -> 80177 bytes
nbproject/build-impl.xml | 1056 +++++++++++++++++++++++++++++++++++++++
nbproject/genfiles.properties | 8 +
nbproject/project.properties | 75 +++
nbproject/project.xml | 25 +
src/com/juick/json/Message.java | 70 +++
src/com/juick/json/Place.java | 58 +++
src/com/juick/json/User.java | 38 ++
10 files changed, 1407 insertions(+)
create mode 100644 .gitignore
create mode 100644 build.xml
create mode 100644 lib/org.json.jar
create mode 100644 nbproject/build-impl.xml
create mode 100644 nbproject/genfiles.properties
create mode 100644 nbproject/project.properties
create mode 100644 nbproject/project.xml
create mode 100644 src/com/juick/json/Message.java
create mode 100644 src/com/juick/json/Place.java
create mode 100644 src/com/juick/json/User.java
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 00000000..d3bae3d4
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+/build/
+/dist/
+/nbproject/private/
\ No newline at end of file
diff --git a/build.xml b/build.xml
new file mode 100644
index 00000000..75e8988b
--- /dev/null
+++ b/build.xml
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+
+ Builds, tests, and runs the project com.juick.json.
+
+
+
diff --git a/lib/org.json.jar b/lib/org.json.jar
new file mode 100644
index 00000000..911ca8f1
Binary files /dev/null and b/lib/org.json.jar differ
diff --git a/nbproject/build-impl.xml b/nbproject/build-impl.xml
new file mode 100644
index 00000000..87d29507
--- /dev/null
+++ b/nbproject/build-impl.xml
@@ -0,0 +1,1056 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set src.dir
+ Must set test.src.dir
+ Must set build.dir
+ Must set dist.dir
+ Must set build.classes.dir
+ Must set dist.javadoc.dir
+ Must set build.test.classes.dir
+ Must set build.test.results.dir
+ Must set build.classes.excludes
+ Must set dist.jar
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must set JVM to use for profiling in profiler.info.jvm
+ Must set profiler agent JVM arguments in profiler.info.jvmargs.agent
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+
+
+
+
+
+ java -cp "${run.classpath.with.dist.jar}" ${main.class}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To run this application from the command line without Ant, try:
+
+ java -jar "${dist.jar.resolved}"
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+ Must select one file in the IDE or set run.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must select one file in the IDE or set debug.class
+
+
+
+
+ Must set fix.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set profile.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set javac.includes
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+
+
+
+
+ Must select some files in the IDE or set test.includes
+
+
+
+ Some tests failed; see details above.
+
+
+
+
+ Must select one file in the IDE or set test.class
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+ Must select one file in the IDE or set applet.url
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/nbproject/genfiles.properties b/nbproject/genfiles.properties
new file mode 100644
index 00000000..225dc8f1
--- /dev/null
+++ b/nbproject/genfiles.properties
@@ -0,0 +1,8 @@
+build.xml.data.CRC32=749f2a7f
+build.xml.script.CRC32=5813f931
+build.xml.stylesheet.CRC32=28e38971@1.44.1.45
+# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
+# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
+nbproject/build-impl.xml.data.CRC32=749f2a7f
+nbproject/build-impl.xml.script.CRC32=9781d004
+nbproject/build-impl.xml.stylesheet.CRC32=0ae3a408@1.44.1.45
diff --git a/nbproject/project.properties b/nbproject/project.properties
new file mode 100644
index 00000000..75ed7362
--- /dev/null
+++ b/nbproject/project.properties
@@ -0,0 +1,75 @@
+annotation.processing.enabled=true
+annotation.processing.enabled.in.editor=false
+annotation.processing.run.all.processors=true
+annotation.processing.source.output=${build.generated.sources.dir}/ap-source-output
+application.title=com.juick.json
+application.vendor=ugnich
+build.classes.dir=${build.dir}/classes
+build.classes.excludes=**/*.java,**/*.form
+# This directory is removed when the project is cleaned:
+build.dir=build
+build.generated.dir=${build.dir}/generated
+build.generated.sources.dir=${build.dir}/generated-sources
+# Only compile against the classpath explicitly listed here:
+build.sysclasspath=ignore
+build.test.classes.dir=${build.dir}/test/classes
+build.test.results.dir=${build.dir}/test/results
+# Uncomment to specify the preferred debugger connection transport:
+#debug.transport=dt_socket
+debug.classpath=\
+ ${run.classpath}
+debug.test.classpath=\
+ ${run.test.classpath}
+# This directory is removed when the project is cleaned:
+dist.dir=dist
+dist.jar=${dist.dir}/com.juick.json.jar
+dist.javadoc.dir=${dist.dir}/javadoc
+endorsed.classpath=
+excludes=
+file.reference.org.json.jar=lib/org.json.jar
+includes=**
+jar.compress=false
+javac.classpath=\
+ ${reference.com_juick.jar}:\
+ ${file.reference.org.json.jar}
+# Space-separated list of extra javac options
+javac.compilerargs=
+javac.deprecation=false
+javac.processorpath=\
+ ${javac.classpath}
+javac.source=1.6
+javac.target=1.6
+javac.test.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+javac.test.processorpath=\
+ ${javac.test.classpath}
+javadoc.additionalparam=
+javadoc.author=false
+javadoc.encoding=${source.encoding}
+javadoc.noindex=false
+javadoc.nonavbar=false
+javadoc.notree=false
+javadoc.private=false
+javadoc.splitindex=true
+javadoc.use=true
+javadoc.version=false
+javadoc.windowtitle=
+meta.inf.dir=${src.dir}/META-INF
+mkdist.disabled=true
+platform.active=default_platform
+project.com_juick=../com.juick
+reference.com_juick.jar=${project.com_juick}/dist/com.juick.jar
+run.classpath=\
+ ${javac.classpath}:\
+ ${build.classes.dir}
+# Space-separated list of JVM arguments used when running the project
+# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
+# or test-sys-prop.name=value to set system properties for unit tests):
+run.jvmargs=
+run.test.classpath=\
+ ${javac.test.classpath}:\
+ ${build.test.classes.dir}
+source.encoding=UTF-8
+src.dir=src
+test.src.dir=test
diff --git a/nbproject/project.xml b/nbproject/project.xml
new file mode 100644
index 00000000..e1aed871
--- /dev/null
+++ b/nbproject/project.xml
@@ -0,0 +1,25 @@
+
+
+ org.netbeans.modules.java.j2seproject
+
+
+ com.juick.json
+
+
+
+
+
+
+
+
+
+ com_juick
+ jar
+
+ jar
+ clean
+ jar
+
+
+
+
diff --git a/src/com/juick/json/Message.java b/src/com/juick/json/Message.java
new file mode 100644
index 00000000..83a8624f
--- /dev/null
+++ b/src/com/juick/json/Message.java
@@ -0,0 +1,70 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick.json;
+
+import java.text.DateFormat;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.*;
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Message extends com.juick.Message {
+
+ public static Message parseJSON(JSONObject json) throws JSONException {
+ Message jmsg = new Message();
+ jmsg.MID = json.getInt("mid");
+ if (json.has("rid")) {
+ jmsg.RID = json.getInt("rid");
+ }
+ jmsg.Text = json.getString("body").replace(""", "\"");
+ jmsg.User = com.juick.json.User.parseJSON(json.getJSONObject("user"));
+
+ try {
+ DateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+ df.setTimeZone(TimeZone.getTimeZone("UTC"));
+ jmsg.Timestamp = df.parse(json.getString("timestamp"));
+ } catch (ParseException e) {
+ }
+
+ if (json.has("tags")) {
+ JSONArray tags = json.getJSONArray("tags");
+ for (int n = 0; n < tags.length(); n++) {
+ jmsg.tags.add(tags.getString(n).replace(""", "\""));
+ }
+ }
+
+ if (json.has("replies")) {
+ jmsg.replies = json.getInt("replies");
+ }
+
+ if (json.has("photo")) {
+ jmsg.Photo = json.getJSONObject("photo").getString("small");
+ }
+ if (json.has("video")) {
+ jmsg.Video = json.getJSONObject("video").getString("mp4");
+ }
+
+ return jmsg;
+ }
+}
diff --git a/src/com/juick/json/Place.java b/src/com/juick/json/Place.java
new file mode 100644
index 00000000..63a5929c
--- /dev/null
+++ b/src/com/juick/json/Place.java
@@ -0,0 +1,58 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick.json;
+
+import org.json.JSONArray;
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class Place extends com.juick.Place {
+
+ public static Place parseJSON(JSONObject json) throws JSONException {
+ Place jplace = new Place();
+
+ jplace.pid = json.getInt("pid");
+ jplace.lat = json.getDouble("lat");
+ jplace.lon = json.getDouble("lon");
+ jplace.name = json.getString("name").replace(""", "\"");
+ if (json.has("description")) {
+ jplace.description = json.getString("description").replace(""", "\"");
+ }
+ if (json.has("users")) {
+ jplace.users = json.getInt("users");
+ }
+ if (json.has("messages")) {
+ jplace.messages = json.getInt("messages");
+ }
+ if (json.has("distance")) {
+ jplace.distance = json.getInt("distance");
+ }
+ if (json.has("tags")) {
+ JSONArray tags = json.getJSONArray("tags");
+ for (int n = 0; n < tags.length(); n++) {
+ jplace.tags.add(tags.getString(n).replace(""", "\""));
+ }
+ }
+
+ return jplace;
+ }
+}
diff --git a/src/com/juick/json/User.java b/src/com/juick/json/User.java
new file mode 100644
index 00000000..b4e0e7e8
--- /dev/null
+++ b/src/com/juick/json/User.java
@@ -0,0 +1,38 @@
+/*
+ * Juick
+ * Copyright (C) 2008-2011, Ugnich Anton
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+package com.juick.json;
+
+import org.json.JSONException;
+import org.json.JSONObject;
+
+/**
+ *
+ * @author Ugnich Anton
+ */
+public class User extends com.juick.User {
+
+ public static User parseJSON(JSONObject json) throws JSONException {
+ User juser = new User();
+ juser.UID = json.getInt("uid");
+ juser.UName = json.getString("uname");
+ if (json.has("fullname")) {
+ juser.FullName = json.getString("fullname");
+ }
+ return juser;
+ }
+}
--
cgit v1.2.3