Search in sources :

Example 31 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class IndexDatabase method restoreRichTextLocationMap.

@Override
public Map<CharSequence, CharSequence> restoreRichTextLocationMap(final CharSequence token, final Object mapKey) {
    Map result = null;
    Document doc = getValueDocument(token.toString());
    String itemName = VALUE_MAP_PREFIX + String.valueOf(mapKey);
    if (doc.hasItem(itemName)) {
        result = doc.getItemValue(itemName, Map.class);
    } else {
        result = new ConcurrentHashMap<CaseInsensitiveString, Set<String>>(8, 0.9f, 1);
    }
    return result;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) Document(org.openntf.domino.Document) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString)

Example 32 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class IndexDatabase method getTermUnidInDbsItems.

/* (non-Javadoc)
	 * @see org.openntf.domino.big.impl.IIndexDatabase#getTermUnidInDbsItems(java.lang.String, java.util.Collection, java.util.Collection)
	 */
@Override
public Set<CharSequence> getTermUnidInDbsItems(final String term, final Collection<String> dbids, final Collection<?> itemNames) {
    Set<CharSequence> unids = new HashSet<CharSequence>();
    Document doc = getTermDocument(term);
    for (String dbid : dbids) {
        String itemName = TERM_MAP_PREFIX + dbid;
        if (doc.hasItem(itemName)) {
            Map termMap = doc.getItemValue(itemName, Map.class);
            for (Object key : itemNames) {
                CaseInsensitiveString ciskey = null;
                if (key instanceof CaseInsensitiveString) {
                    ciskey = (CaseInsensitiveString) key;
                } else if (key instanceof String) {
                    ciskey = new CaseInsensitiveString((String) key);
                } else {
                    ciskey = new CaseInsensitiveString(String.valueOf(key));
                }
                Object termObj = termMap.get(ciskey);
                if (termObj != null) {
                    if (termObj instanceof Collection) {
                        unids.addAll((Collection) termObj);
                    } else if (termObj instanceof CharSequence) {
                        unids.add(((CharSequence) termObj).toString());
                    } else {
                        unids.add(String.valueOf(termObj));
                    }
                }
            }
        }
    }
    return unids;
}
Also used : Collection(java.util.Collection) DocumentCollection(org.openntf.domino.DocumentCollection) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) Document(org.openntf.domino.Document) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) HashSet(java.util.HashSet)

Example 33 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class IndexDatabase method restoreNameLocationMap.

/* (non-Javadoc)
	 * @see org.openntf.domino.big.impl.IIndexDatabase#restoreNameLocationMap(java.lang.CharSequence, java.lang.Object)
	 */
@Override
public Map<CharSequence, Set<CharSequence>> restoreNameLocationMap(final CharSequence name, final Object mapKey) {
    Map result = null;
    Document doc = getNameDocument(name.toString());
    String itemName = TERM_MAP_PREFIX + String.valueOf(mapKey);
    if (doc.hasItem(itemName)) {
        result = doc.getItemValue(itemName, Map.class);
    } else {
        result = new ConcurrentHashMap<CaseInsensitiveString, Set<String>>(8, 0.9f, 1);
    }
    return result;
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) Document(org.openntf.domino.Document) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString)

Example 34 with CaseInsensitiveString

use of org.openntf.domino.types.CaseInsensitiveString in project org.openntf.domino by OpenNTF.

the class IndexDatabase method getTermLinksInDbsItems.

/* (non-Javadoc)
	 * @see org.openntf.domino.big.impl.IIndexDatabase#getTermLinksInDbsItems(org.openntf.domino.Session, java.lang.String, java.lang.String, java.util.Collection, java.util.Collection)
	 */
@Override
public Set<String> getTermLinksInDbsItems(final Session session, final String serverName, final String term, final Collection<CharSequence> dbids, final Collection<?> itemNames) {
    Set<String> unids = new HashSet<String>();
    Document doc = getTermDocument(term);
    for (CharSequence dbid : dbids) {
        String itemName = TERM_MAP_PREFIX + dbid;
        if (doc.hasItem(itemName)) {
            Map termMap = doc.getItemValue(itemName, Map.class);
            // if (db != null) {
            for (Object key : itemNames) {
                CaseInsensitiveString ciskey = null;
                if (key instanceof CaseInsensitiveString) {
                    ciskey = (CaseInsensitiveString) key;
                } else if (key instanceof String) {
                    ciskey = new CaseInsensitiveString((String) key);
                } else {
                    ciskey = new CaseInsensitiveString(String.valueOf(key));
                }
                Object termObj = termMap.get(ciskey);
                if (termObj != null) {
                    if (termObj instanceof Collection) {
                        for (Object unid : (Collection) termObj) {
                            // Document curDoc = db.getDocumentByUNID((String) unid);
                            unids.add("http://localhost/__" + dbid + ".nsf/0/" + unid);
                        }
                    // unids.addAll((Collection) termObj);
                    } else if (termObj instanceof CharSequence) {
                        // Document curDoc = db.getDocumentByUNID((String) ((CharSequence) termObj).toString());
                        unids.add("http://localhost/__" + dbid + ".nsf/0/" + ((CharSequence) termObj).toString());
                    // unids.add(((CharSequence) termObj).toString());
                    } else {
                        unids.add(String.valueOf(termObj));
                    }
                }
            }
        // }
        }
    }
    return unids;
}
Also used : Collection(java.util.Collection) DocumentCollection(org.openntf.domino.DocumentCollection) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) Document(org.openntf.domino.Document) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap) CaseInsensitiveString(org.openntf.domino.types.CaseInsensitiveString) HashSet(java.util.HashSet)

Aggregations

CaseInsensitiveString (org.openntf.domino.types.CaseInsensitiveString)34 Map (java.util.Map)15 LinkedHashMap (java.util.LinkedHashMap)13 Document (org.openntf.domino.Document)13 Set (java.util.Set)12 JsonJavaObject (com.ibm.commons.util.io.json.JsonJavaObject)11 ArrayList (java.util.ArrayList)11 HashSet (java.util.HashSet)11 EdgeFrame (com.tinkerpop.frames.EdgeFrame)10 VertexFrame (com.tinkerpop.frames.VertexFrame)10 HashMap (java.util.HashMap)9 DVertexFrame (org.openntf.domino.graph2.builtin.DVertexFrame)9 Method (java.lang.reflect.Method)8 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)8 JsonObject (com.ibm.commons.util.io.json.JsonObject)7 UserAccessException (org.openntf.domino.exceptions.UserAccessException)7 List (java.util.List)6 DEdgeFrame (org.openntf.domino.graph2.builtin.DEdgeFrame)6 DbInfoVertex (org.openntf.domino.graph2.builtin.DbInfoVertex)5 ViewVertex (org.openntf.domino.graph2.builtin.ViewVertex)5