use of org.openntf.domino.big.NoteCoordinate in project org.openntf.domino by OpenNTF.
the class DElementStore method getElement.
@Override
public Element getElement(final Object id) throws IllegalStateException {
try {
// if (isProxied()) {
// System.out.println("Getting a proxied element for id: " + String.valueOf(id));
// }
NoteCoordinate nc = normalizeId((Serializable) id);
Element result = null;
// if (nc.getReplicaId().equalsIgnoreCase("852582F7007073B5")) {
// System.out.println("Getting a demo document " + nc + " from the element cache");
// result = getElementCache().get(nc);
// if (result != null) {
// System.out.println(
// "Result was loaded from cache with id " + nc + " and cache now has " + getElementCache().size() + " elements");
//
// }
// } else {
result = getElementCache().get(nc);
// + System.identityHashCode(result));
return result;
} catch (InvalidCacheLoadException icle) {
// "TEMP DEBUG invalidCacheLoad for id " + String.valueOf(id) + " from element store " + System.identityHashCode(this));
return null;
} catch (UncheckedExecutionException uee) {
Throwable cause = uee.getCause();
if (cause != null && cause instanceof UserAccessException) {
throw new UserAccessException(cause.getMessage(), cause);
} else {
throw uee;
}
} catch (UserAccessException uae) {
throw uae;
} catch (Throwable t) {
throw new IllegalStateException("Unable to retrieve id " + String.valueOf(id), t);
}
}
use of org.openntf.domino.big.NoteCoordinate in project org.openntf.domino by OpenNTF.
the class DElementStore method flushCache.
@Override
public void flushCache(final String id) {
// }
try {
if (keyMap_ != null && keyMap_.containsKey(id)) {
keyMap_.remove(id);
}
} catch (Throwable t) {
t.printStackTrace();
}
try {
if (this.getElementCache() != null) {
NoteCoordinate nc = NoteCoordinate.Utils.getNoteCoordinate(id);
Object chk = getElementCache().getIfPresent(nc);
if (chk != null) {
// getElementCache().refresh(nc);
getElementCache().invalidate(nc);
// System.out.println("TEMP DEBUG Invalidated id " + nc + " in Element Store");
} else {
// if (id.startsWith("852582F7007073B5".toLowerCase())) {
// System.out.println("TEMP DEBUG id " + nc + " not found in cache");
// System.out.println("TEMP DEBUG cache has " + getElementCache().size() + " elements");
// if (getElementCache().size() < 6) {
// // getElementCache().asMap()
// }
// }
}
} else {
System.out.println("Element Cache not available!");
}
} catch (Throwable t) {
t.printStackTrace();
}
}
use of org.openntf.domino.big.NoteCoordinate in project org.openntf.domino by OpenNTF.
the class DElementStore method getVertexIds.
protected List<NoteCoordinate> getVertexIds(final String formulaFilter) {
FastTable<NoteCoordinate> result = new FastTable<NoteCoordinate>();
Object raw = getStoreDelegate();
if (raw instanceof Database) {
Database db = (Database) raw;
NoteCollection nc = db.createNoteCollection(false);
nc.setSelectDocuments(true);
nc.setSelectionFormula(formulaFilter);
nc.buildCollection();
for (String noteid : nc) {
result.add(NoteCoordinate.Utils.getNoteCoordinate(nc, noteid));
}
} else {
// TODO NTF implement alternative
throw new IllegalStateException("Non-Domino implementations not yet available");
}
return result;
}
use of org.openntf.domino.big.NoteCoordinate in project org.openntf.domino by OpenNTF.
the class DFastEdgeList method findEdge.
@SuppressWarnings("unlikely-arg-type")
@Override
public Edge findEdge(final Vertex toVertex) {
Edge result = null;
Object toId = toVertex.getId();
Object fromId = sourceVertex_.getId();
if (isUnique() && !isEmpty()) {
if (toId instanceof NoteCoordinate && fromId instanceof NoteCoordinate) {
String toString = ((NoteCoordinate) toId).toString();
String fromString = ((NoteCoordinate) fromId).toString();
String testString1 = DominoUtils.toUnid(toString + getLabel() + fromString);
String testString2 = DominoUtils.toUnid(toString + getLabel() + fromString);
NoteCoordinate nc1 = NoteCoordinate.Utils.getNoteCoordinate(storeid_, testString1);
NoteCoordinate nc2 = NoteCoordinate.Utils.getNoteCoordinate(storeid_, testString2);
if (contains(nc1)) {
result = parentGraph_.getEdge(nc1);
} else if (contains(nc2)) {
result = parentGraph_.getEdge(nc2);
}
} else {
// NTF then we go back to the old way...
}
}
if (result == null && this.size() > 0 && !isUnique()) {
for (Edge edge : this) {
if (edge instanceof DEdge) {
DEdge dedge = (DEdge) edge;
if (toId.equals(dedge.getOtherVertexId(sourceVertex_))) {
result = dedge;
break;
}
} else {
if (edge != null) {
Vertex inVertex = edge.getVertex(Direction.IN);
if (fromId.equals(inVertex.getId())) {
if (toId.equals(edge.getVertex(Direction.OUT))) {
result = edge;
break;
}
} else if (toId.equals(inVertex.getId())) {
result = edge;
break;
}
}
}
}
} else {
// System.out.println("DEBUG: No edges defined in EdgeList");
}
return result;
}
use of org.openntf.domino.big.NoteCoordinate in project org.openntf.domino by OpenNTF.
the class DFastEdgeList method add.
@Override
public void add(final int arg0, final Edge arg1) {
NoteCoordinate nc = getNC(arg1);
if (storeid_ == null) {
storeid_ = nc.getReplicaId();
}
delegate_.add(arg0, nc);
}
Aggregations