Android Open Source - GeoTagger Attachment






From Project

Back to project page GeoTagger.

License

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.

Java Source Code

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();    
  }
}




Java Source Code List

horizon.android.logging.Logger.java
horizon.geotagger.AlertService.java
horizon.geotagger.Base64.java
horizon.geotagger.GeoTagger.java
horizon.geotagger.GeoTagger.java
horizon.geotagger.GeoUtils.java
horizon.geotagger.GeoUtils.java
horizon.geotagger.JavaLoggingAppender.java
horizon.geotagger.JspUtils.java
horizon.geotagger.PMF.java
horizon.geotagger.PersconServiceConnection.java
horizon.geotagger.model.Attachment.java
horizon.geotagger.model.Attachment.java
horizon.geotagger.model.Place.java
horizon.geotagger.model.Place.java
horizon.geotagger.model.Tag.java
horizon.geotagger.model.Tag.java
horizon.geotagger.server.AddTagServlet.java
horizon.geotagger.server.CallbackServlet.java
horizon.geotagger.server.DataBinder.java
horizon.geotagger.server.ModelAndView.java
horizon.geotagger.server.ServletWithView.java
horizon.geotagger.server.TagsAtPointData.java
horizon.geotagger.server.TagsAtPointServlet.java
horizon.geotagger.server.TagsInBoxData.java
horizon.geotagger.server.TagsInBoxServlet.java
horizon.geotagger.view.CameraSurfaceView.java
horizon.geotagger.view.DoImageTagView.java
horizon.geotagger.view.DoTagView.java
horizon.geotagger.view.DoTextTagView.java
horizon.geotagger.view.MapView.java
horizon.geotagger.view.TagOverlay.java
horizon.geotagger.view.TagView.java