001package org.kuali.ole.docstore.indexer.solr;
002
003/**
004 * Created with IntelliJ IDEA.
005 * User: jayabharathreddy
006 * Date: 7/24/13
007 * Time: 4:06 PM
008 * To change this template use File | Settings | File Templates.
009 */
010public class DocumentLocalId {
011
012    public static int getDocumentId(String uuid) {
013        if (hasPrefix(uuid)) {
014            String[] prefixes = uuid.split("-");
015            return Integer.valueOf(prefixes[1]).intValue();
016        }
017        return Integer.valueOf(uuid).intValue();
018    }
019
020    public static boolean hasPrefix(String uuid) {
021        String[] prefixes = uuid.split("-");
022        if (prefixes.length == 2) {
023            return true;
024        }
025        return false;
026    }
027
028    public static String getDocumentIdDisplay(String uuid) {
029        if (hasPrefix(uuid)) {
030            String[] prefixes = uuid.split("-");
031            return prefixes[1];
032        }
033        return uuid;
034    }
035
036
037}