Ignore:
Timestamp:
Sep 27, 2012, 3:12:08 PM (12 years ago)
Author:
casties
Branch:
default
Message:

annotations ui can show and delete annotations now.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • src/main/java/de/mpiwg/itgroup/annotations/Annotation.java

    r48 r50  
    44package de.mpiwg.itgroup.annotations;
    55
     6import java.io.UnsupportedEncodingException;
    67import java.util.Set;
     8
     9import org.apache.commons.codec.binary.Base64;
    710
    811import de.mpiwg.itgroup.annotations.neo4j.AnnotationStore;
     
    161164
    162165    /**
     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    /**
    163189     * @return the bodyText
    164190     */
Note: See TracChangeset for help on using the changeset viewer.