org.vertexium.Edge.getVisibility()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(12.5k)|赞(0)|评价(0)|浏览(167)

本文整理了Java中org.vertexium.Edge.getVisibility()方法的一些代码示例,展示了Edge.getVisibility()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Edge.getVisibility()方法的具体详情如下:
包路径:org.vertexium.Edge
类名称:Edge
方法名:getVisibility

Edge.getVisibility介绍

暂无

代码示例

代码示例来源:origin: visallo/vertexium

@Override
public Visibility getVisibility() {
  return getEdge().getVisibility();
}

代码示例来源:origin: org.vertexium/vertexium-core

@Override
public Visibility getVisibility() {
  return getEdge().getVisibility();
}

代码示例来源:origin: org.vertexium/vertexium-core

@Override
  protected boolean isIncluded(Edge edge) {
    if (filters.contains(ElementFilter.ELEMENT)) {
      if (edge.getVisibility().hasAuthorization(authorizationToMatch)) {
        return true;
      }
    }
    return isIncludedByAuthorizations(edge, filters, authorizationToMatch);
  }
};

代码示例来源:origin: visallo/vertexium

@Override
  protected boolean isIncluded(Edge edge) {
    if (filters.contains(ElementFilter.ELEMENT)) {
      if (edge.getVisibility().hasAuthorization(authorizationToMatch)) {
        return true;
      }
    }
    return isIncludedByAuthorizations(edge, filters, authorizationToMatch);
  }
};

代码示例来源:origin: visallo/vertexium

public EdgeBuilderByVertexId prepareEdge(Edge edge) {
  return prepareEdge(
      edge.getId(),
      edge.getVertexId(Direction.OUT),
      edge.getVertexId(Direction.IN),
      edge.getLabel(),
      edge.getTimestamp(),
      edge.getVisibility()
  );
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

public EdgeBuilderByVertexId prepareEdge(Edge edge) {
  return prepareEdge(
      edge.getId(),
      edge.getVertexId(Direction.OUT),
      edge.getVertexId(Direction.IN),
      edge.getLabel(),
      edge.getTimestamp(),
      edge.getVisibility()
  );
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

public boolean alterEdgeVertexOutVertex(Mutation vertexOutMutation, Edge edge, Visibility newVisibility) {
  ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
  if (currentColumnVisibility.equals(newColumnVisibility)) {
    return false;
  }
  EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.IN));
  vertexOutMutation.putDelete(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), currentColumnVisibility);
  vertexOutMutation.put(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
  return true;
}

代码示例来源:origin: visallo/vertexium

public boolean alterEdgeVertexInVertex(Mutation vertexInMutation, Edge edge, Visibility newVisibility) {
  ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
  if (currentColumnVisibility.equals(newColumnVisibility)) {
    return false;
  }
  EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.OUT));
  vertexInMutation.putDelete(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), currentColumnVisibility);
  vertexInMutation.put(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
  return true;
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

public boolean alterEdgeVertexInVertex(Mutation vertexInMutation, Edge edge, Visibility newVisibility) {
  ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
  if (currentColumnVisibility.equals(newColumnVisibility)) {
    return false;
  }
  EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.OUT));
  vertexInMutation.putDelete(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), currentColumnVisibility);
  vertexInMutation.put(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
  return true;
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

public void alterEdgeLabel(Edge edge, String newEdgeLabel) {
  ColumnVisibility edgeColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  Mutation m = createAlterEdgeLabelMutation(edge, newEdgeLabel, edgeColumnVisibility);
  saveEdgeMutation(m);
  saveEdgeInfoOnVertex(
      edge.getId(),
      edge.getVertexId(Direction.OUT),
      edge.getVertexId(Direction.IN),
      newEdgeLabel,
      edgeColumnVisibility
  );
}

代码示例来源:origin: visallo/vertexium

public void alterEdgeLabel(Edge edge, String newEdgeLabel) {
  ColumnVisibility edgeColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  Mutation m = createAlterEdgeLabelMutation(edge, newEdgeLabel, edgeColumnVisibility);
  saveEdgeMutation(m);
  saveEdgeInfoOnVertex(
      edge.getId(),
      edge.getVertexId(Direction.OUT),
      edge.getVertexId(Direction.IN),
      newEdgeLabel,
      edgeColumnVisibility
  );
}

代码示例来源:origin: visallo/vertexium

public boolean alterEdgeVertexOutVertex(Mutation vertexOutMutation, Edge edge, Visibility newVisibility) {
  ColumnVisibility currentColumnVisibility = visibilityToAccumuloVisibility(edge.getVisibility());
  ColumnVisibility newColumnVisibility = visibilityToAccumuloVisibility(newVisibility);
  if (currentColumnVisibility.equals(newColumnVisibility)) {
    return false;
  }
  EdgeInfo edgeInfo = new EdgeInfo(getNameSubstitutionStrategy().deflate(edge.getLabel()), edge.getVertexId(Direction.IN));
  vertexOutMutation.putDelete(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), currentColumnVisibility);
  vertexOutMutation.put(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), newColumnVisibility, edgeInfo.toValue());
  return true;
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

@Override
public void deleteEdge(Edge edge, Authorizations authorizations) {
  checkNotNull(edge);
  Span trace = Trace.start("deleteEdge");
  trace.data("edgeId", edge.getId());
  try {
    getSearchIndex().deleteElement(this, edge, authorizations);
    ColumnVisibility visibility = visibilityToAccumuloVisibility(edge.getVisibility());
    Mutation outMutation = new Mutation(edge.getVertexId(Direction.OUT));
    outMutation.putDelete(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), visibility);
    Mutation inMutation = new Mutation(edge.getVertexId(Direction.IN));
    inMutation.putDelete(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), visibility);
    addMutations(VertexiumObjectType.VERTEX, outMutation, inMutation);
    deleteAllExtendedDataForElement(edge, authorizations);
    // Deletes everything else related to edge.
    addMutations(VertexiumObjectType.EDGE, getDeleteRowMutation(edge.getId()));
    if (hasEventListeners()) {
      queueEvent(new DeleteEdgeEvent(this, edge));
    }
  } finally {
    trace.stop();
  }
}

代码示例来源:origin: visallo/vertexium

@Override
public void softDeleteEdge(Edge edge, Long timestamp, Authorizations authorizations) {
  checkNotNull(edge);
  Span trace = Trace.start("softDeleteEdge");
  trace.data("edgeId", edge.getId());
  try {
    if (timestamp == null) {
      timestamp = IncreasingTime.currentTimeMillis();
    }
    getSearchIndex().deleteElement(this, edge, authorizations);
    ColumnVisibility visibility = visibilityToAccumuloVisibility(edge.getVisibility());
    Mutation outMutation = new Mutation(edge.getVertexId(Direction.OUT));
    outMutation.put(AccumuloVertex.CF_OUT_EDGE_SOFT_DELETE, new Text(edge.getId()), visibility, timestamp, AccumuloElement.SOFT_DELETE_VALUE);
    Mutation inMutation = new Mutation(edge.getVertexId(Direction.IN));
    inMutation.put(AccumuloVertex.CF_IN_EDGE_SOFT_DELETE, new Text(edge.getId()), visibility, timestamp, AccumuloElement.SOFT_DELETE_VALUE);
    addMutations(VertexiumObjectType.VERTEX, outMutation, inMutation);
    // Soft deletes everything else related to edge.
    addMutations(VertexiumObjectType.EDGE, getSoftDeleteRowMutation(edge.getId(), timestamp));
    if (hasEventListeners()) {
      queueEvent(new SoftDeleteEdgeEvent(this, edge));
    }
  } finally {
    trace.stop();
  }
}

代码示例来源:origin: visallo/vertexium

@Override
public void deleteEdge(Edge edge, Authorizations authorizations) {
  checkNotNull(edge);
  Span trace = Trace.start("deleteEdge");
  trace.data("edgeId", edge.getId());
  try {
    getSearchIndex().deleteElement(this, edge, authorizations);
    ColumnVisibility visibility = visibilityToAccumuloVisibility(edge.getVisibility());
    Mutation outMutation = new Mutation(edge.getVertexId(Direction.OUT));
    outMutation.putDelete(AccumuloVertex.CF_OUT_EDGE, new Text(edge.getId()), visibility);
    Mutation inMutation = new Mutation(edge.getVertexId(Direction.IN));
    inMutation.putDelete(AccumuloVertex.CF_IN_EDGE, new Text(edge.getId()), visibility);
    addMutations(VertexiumObjectType.VERTEX, outMutation, inMutation);
    deleteAllExtendedDataForElement(edge, authorizations);
    // Deletes everything else related to edge.
    addMutations(VertexiumObjectType.EDGE, getDeleteRowMutation(edge.getId()));
    if (hasEventListeners()) {
      queueEvent(new DeleteEdgeEvent(this, edge));
    }
  } finally {
    trace.stop();
  }
}

代码示例来源:origin: org.vertexium/vertexium-accumulo

@Override
public void softDeleteEdge(Edge edge, Long timestamp, Authorizations authorizations) {
  checkNotNull(edge);
  Span trace = Trace.start("softDeleteEdge");
  trace.data("edgeId", edge.getId());
  try {
    if (timestamp == null) {
      timestamp = IncreasingTime.currentTimeMillis();
    }
    getSearchIndex().deleteElement(this, edge, authorizations);
    ColumnVisibility visibility = visibilityToAccumuloVisibility(edge.getVisibility());
    Mutation outMutation = new Mutation(edge.getVertexId(Direction.OUT));
    outMutation.put(AccumuloVertex.CF_OUT_EDGE_SOFT_DELETE, new Text(edge.getId()), visibility, timestamp, AccumuloElement.SOFT_DELETE_VALUE);
    Mutation inMutation = new Mutation(edge.getVertexId(Direction.IN));
    inMutation.put(AccumuloVertex.CF_IN_EDGE_SOFT_DELETE, new Text(edge.getId()), visibility, timestamp, AccumuloElement.SOFT_DELETE_VALUE);
    addMutations(VertexiumObjectType.VERTEX, outMutation, inMutation);
    // Soft deletes everything else related to edge.
    addMutations(VertexiumObjectType.EDGE, getSoftDeleteRowMutation(edge.getId(), timestamp));
    if (hasEventListeners()) {
      queueEvent(new SoftDeleteEdgeEvent(this, edge));
    }
  } finally {
    trace.stop();
  }
}

代码示例来源:origin: org.vertexium/vertexium-test

Assert.assertEquals(LABEL_LABEL2, IterableUtils.single(v2.getEdgesSummary(AUTHORIZATIONS_A).getInEdgeLabels()));
graph.prepareEdge(e.getId(), e.getVertexId(Direction.OUT), e.getVertexId(Direction.IN), e.getLabel(), e.getVisibility())
    .alterEdgeLabel("label3")
    .save(AUTHORIZATIONS_A);

代码示例来源:origin: visallo/vertexium

Assert.assertEquals(LABEL_LABEL2, IterableUtils.single(v2.getEdgesSummary(AUTHORIZATIONS_A).getInEdgeLabels()));
graph.prepareEdge(e.getId(), e.getVertexId(Direction.OUT), e.getVertexId(Direction.IN), e.getLabel(), e.getVisibility())
    .alterEdgeLabel("label3")
    .save(AUTHORIZATIONS_A);

代码示例来源:origin: org.vertexium/vertexium-test

@Test
public void testReAddingSoftDeletedEdge() {
  Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
  Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
  graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
  graph.flush();
  Edge e1 = graph.getEdge("e1", AUTHORIZATIONS_A);
  graph.softDeleteEdge(e1, AUTHORIZATIONS_A);
  graph.flush();
  graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A)
      .save(AUTHORIZATIONS_A);
  graph.flush();
  e1 = graph.getEdge("e1", AUTHORIZATIONS_A);
  assertNotNull(e1);
  assertEquals(VISIBILITY_A.getVisibilityString(), e1.getVisibility().getVisibilityString());
  v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
  assertEquals(1, count(v1.getEdgeIds(Direction.BOTH, AUTHORIZATIONS_A)));
  assertEquals(1, count(v1.getEdges(Direction.BOTH, AUTHORIZATIONS_A)));
  assertEquals(1, count(v1.getVertexIds(Direction.BOTH, AUTHORIZATIONS_A)));
  v2 = graph.getVertex("v2", AUTHORIZATIONS_A);
  assertEquals(1, count(v2.getEdgeIds(Direction.BOTH, AUTHORIZATIONS_A)));
  assertEquals(1, count(v2.getEdges(Direction.BOTH, AUTHORIZATIONS_A)));
  assertEquals(1, count(v2.getVertexIds(Direction.BOTH, AUTHORIZATIONS_A)));
}

代码示例来源:origin: visallo/vertexium

@Test
public void testReAddingSoftDeletedEdge() {
  Vertex v1 = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
  Vertex v2 = graph.addVertex("v2", VISIBILITY_A, AUTHORIZATIONS_A);
  graph.addEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A, AUTHORIZATIONS_A);
  graph.flush();
  Edge e1 = graph.getEdge("e1", AUTHORIZATIONS_A);
  graph.softDeleteEdge(e1, AUTHORIZATIONS_A);
  graph.flush();
  graph.prepareEdge("e1", v1, v2, LABEL_LABEL1, VISIBILITY_A)
      .save(AUTHORIZATIONS_A);
  graph.flush();
  e1 = graph.getEdge("e1", AUTHORIZATIONS_A);
  assertNotNull(e1);
  assertEquals(VISIBILITY_A.getVisibilityString(), e1.getVisibility().getVisibilityString());
  v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
  assertEquals(1, count(v1.getEdgeIds(Direction.BOTH, AUTHORIZATIONS_A)));
  assertEquals(1, count(v1.getEdges(Direction.BOTH, AUTHORIZATIONS_A)));
  assertEquals(1, count(v1.getVertexIds(Direction.BOTH, AUTHORIZATIONS_A)));
  v2 = graph.getVertex("v2", AUTHORIZATIONS_A);
  assertEquals(1, count(v2.getEdgeIds(Direction.BOTH, AUTHORIZATIONS_A)));
  assertEquals(1, count(v2.getEdges(Direction.BOTH, AUTHORIZATIONS_A)));
  assertEquals(1, count(v2.getVertexIds(Direction.BOTH, AUTHORIZATIONS_A)));
}

相关文章