Back to project page GeoTagger.
The source code is released under:
GNU General Public License
If you think the Android project GeoTagger listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package horizon.geotagger.model; /* www .j a v a 2s . com*/ import java.io.IOException; import javax.jdo.annotations.IdGeneratorStrategy; import javax.jdo.annotations.PersistenceCapable; import javax.jdo.annotations.Persistent; import javax.jdo.annotations.PrimaryKey; import org.codehaus.jackson.JsonGenerator; import org.codehaus.jackson.JsonProcessingException; import org.codehaus.jackson.annotate.JsonIgnoreProperties; import org.codehaus.jackson.map.JsonSerializableWithType; import org.codehaus.jackson.map.SerializerProvider; import org.codehaus.jackson.map.TypeSerializer; import com.google.appengine.api.datastore.Blob; import com.google.appengine.api.datastore.Key; @JsonIgnoreProperties({"key"}) @PersistenceCapable public class Attachment implements JsonSerializableWithType { public static enum Type { Text, Image; } @PrimaryKey @Persistent(valueStrategy = IdGeneratorStrategy.IDENTITY) private Key key; @Persistent private Type type; @Persistent private Blob data; public Key getKey() { return key; } public void setKey(Key key) { this.key = key; } public Type getType() { return type; } public void setType(Type type) { this.type = type; } public Blob getData() { return data; } public void setData(Blob data) { this.data = data; } @Override public void serialize(JsonGenerator gen, SerializerProvider prov) throws IOException, JsonProcessingException { gen.writeStartObject(); gen.writeStringField("type", type.name()); gen.writeBinaryField("data", data.getBytes()); gen.writeEndObject(); } @Override public void serializeWithType( JsonGenerator gen, SerializerProvider prov, TypeSerializer ser) throws IOException, JsonProcessingException { gen.writeStartObject(); gen.writeStringField("type", type.name()); gen.writeBinaryField("data", data.getBytes()); gen.writeEndObject(); } }