예제 #1
0
  public void addPhoto(String imageName, String imageDescription, File f) throws Exception {

    byte[] imageBytes = ImageUtils.loadImageAsBytes(f.getAbsolutePath());
    // Note: only the castor Base64Encoder encodes
    // properly... the Sun one doesn't (corrupts image)
    String encoded = new String(Base64Encoder.encode(imageBytes));

    org.cagrid.demo.photosharing.domain.ImageDescription beanDesc =
        new org.cagrid.demo.photosharing.domain.ImageDescription();
    beanDesc.setId(Long.valueOf(0)); // doesn't matter what
    // this is set to
    beanDesc.setDescription(imageDescription);
    beanDesc.setName(imageName);
    beanDesc.setType(ImageFileFilter.getExtension(f));

    org.cagrid.demo.photosharing.domain.Image beanImage =
        new org.cagrid.demo.photosharing.domain.Image();
    beanImage.setId(Long.valueOf(0)); // doesn't matter what
    // this is set to

    beanImage.setImageDescription(beanDesc);
    beanImage.setData(encoded);
    getClient().addImage(beanImage);
  }
예제 #2
0
 public String getDescription() {
   return des.getDescription();
 }
예제 #3
0
 public String getType() {
   return des.getType();
 }
예제 #4
0
 public String getName() {
   return des.getName();
 }