comparison src/main/java/de/mpiwg/itgroup/annotations/Annotation.java @ 50:64aa756c60cc

annotations ui can show and delete annotations now.
author casties
date Thu, 27 Sep 2012 17:12:08 +0200
parents 0e00bf8e27fb
children 2b1e6df5e21a
comparison
equal deleted inserted replaced
49:f30f42080711 50:64aa756c60cc
1 /** 1 /**
2 * 2 *
3 */ 3 */
4 package de.mpiwg.itgroup.annotations; 4 package de.mpiwg.itgroup.annotations;
5 5
6 import java.io.UnsupportedEncodingException;
6 import java.util.Set; 7 import java.util.Set;
8
9 import org.apache.commons.codec.binary.Base64;
7 10
8 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore; 11 import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
9 12
10 /** 13 /**
11 * @author casties 14 * @author casties
158 public void setUri(String uri) { 161 public void setUri(String uri) {
159 this.uri = uri; 162 this.uri = uri;
160 } 163 }
161 164
162 /** 165 /**
166 * Returns an URL-compatible id.
167 * Currently the uri as base64 encoded string.
168 * @return
169 */
170 public String getUrlId() {
171 if (uri == null) return null;
172 try {
173 return Base64.encodeBase64URLSafeString(uri.getBytes("UTF-8"));
174 } catch (UnsupportedEncodingException e) {
175 return null;
176 }
177 }
178
179 public static String decodeId(String id) {
180 if (id == null) return null;
181 try {
182 return new String(Base64.decodeBase64(id), "UTF-8");
183 } catch (UnsupportedEncodingException e) {
184 return null;
185 }
186 }
187
188 /**
163 * @return the bodyText 189 * @return the bodyText
164 */ 190 */
165 public String getBodyText() { 191 public String getBodyText() {
166 return bodyText; 192 return bodyText;
167 } 193 }