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

x33g5p2x  于2022-02-01 转载在 其他  
字(11.5k)|赞(0)|评价(0)|浏览(131)

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

Vertex.getVisibility介绍

暂无

代码示例

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

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

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

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

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

public List<OffsetItem> convertTermMentionsToOffsetItems(Iterable<Vertex> termMentions, String workspaceId, Authorizations authorizations) {
  ArrayList<OffsetItem> termMetadataOffsetItems = new ArrayList<>();
  for (Vertex termMention : termMentions) {
    String visibility = termMention.getVisibility().getVisibilityString();
    SandboxStatus sandboxStatus = SandboxStatus.getFromVisibilityString(visibility, workspaceId);
    termMetadataOffsetItems.add(new VertexOffsetItem(termMention, sandboxStatus, authorizations));
  }
  return termMetadataOffsetItems;
}

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

public VertexBuilder prepareVertex(Vertex vertex) {
  return prepareVertex(vertex.getId(), null, vertex.getVisibility());
}

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

public VertexBuilder prepareVertex(Vertex vertex) {
  return prepareVertex(vertex.getId(), null, vertex.getVisibility());
}

代码示例来源:origin: org.visallo/visallo-web

private byte[] createAndSaveCachedImage(Vertex vertex, String propertyKey, String url, int maxWidth, int maxHeight, int jpegQuality, Authorizations authorizations) throws IOException {
  byte[] imageData = getAndSaveImageData(vertex, url, authorizations);
  imageData = ImageUtils.resize(imageData, maxWidth, maxHeight, jpegQuality);
  StreamingPropertyValue value = new StreamingPropertyValue(new ByteArrayInputStream(imageData), byte[].class);
  value.store(true).searchIndex(false);
  ExistingElementMutation<Vertex> m = vertex.prepareMutation();
  VisalloProperties.CACHED_IMAGE.addPropertyValue(m, propertyKey, value, vertex.getVisibility());
  m.save(authorizations);
  return imageData;
}

代码示例来源:origin: org.visallo/visallo-web

private byte[] getAndSaveImageData(Vertex vertex, String url, Authorizations authorizations) throws IOException {
  String propertyKey = getPropertyKey(url, null, null, null);
  StreamingPropertyValue originalImage = VisalloProperties.CACHED_IMAGE.getPropertyValue(vertex, propertyKey);
  if (originalImage != null) {
    return IOUtils.toByteArray(originalImage.getInputStream());
  }
  byte[] imageData = httpRepository.get(url);
  StreamingPropertyValue value = new StreamingPropertyValue(new ByteArrayInputStream(imageData), byte[].class);
  value.store(true).searchIndex(false);
  ExistingElementMutation<Vertex> m = vertex.prepareMutation();
  VisalloProperties.CACHED_IMAGE.addPropertyValue(m, propertyKey, value, vertex.getVisibility());
  m.save(authorizations);
  return imageData;
}

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

@Override
public void reportProgress(String longRunningProcessGraphVertexId, double progressPercent, String message) {
  Authorizations authorizations = getAuthorizations(userRepository.getSystemUser());
  Vertex vertex = this.graph.getVertex(longRunningProcessGraphVertexId, authorizations);
  checkNotNull(vertex, "Could not find long running process vertex: " + longRunningProcessGraphVertexId);
  JSONObject object = LongRunningProcessProperties.QUEUE_ITEM_JSON_PROPERTY.getPropertyValue(vertex);
  if (object.optBoolean("canceled", false)) {
    throw new VisalloException("Unable to update progress of cancelled process");
  }
  JSONObject json = LongRunningProcessProperties.QUEUE_ITEM_JSON_PROPERTY.getPropertyValue(vertex);
  json.put("progress", progressPercent);
  json.put("progressMessage", message);
  json.put("id", longRunningProcessGraphVertexId);
  VertexBuilder vb = graph.prepareVertex(longRunningProcessGraphVertexId, vertex.getVisibility());
  LongRunningProcessProperties.QUEUE_ITEM_JSON_PROPERTY.setProperty(
      vb,
      json,
      getVisibility()
  );
  vb.save(authorizations);
  this.graph.flush();
  workQueueRepository.broadcastLongRunningProcessChange(json);
}

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

@Override
public void cancel(String longRunningProcessId, User user) {
  Authorizations authorizations = getAuthorizations(userRepository.getSystemUser());
  Vertex vertex = this.graph.getVertex(longRunningProcessId, authorizations);
  checkNotNull(vertex, "Could not find long running process vertex: " + longRunningProcessId);
  JSONObject json = LongRunningProcessProperties.QUEUE_ITEM_JSON_PROPERTY.getPropertyValue(vertex);
  json.put("canceled", true);
  json.put("id", longRunningProcessId);
  VertexBuilder vb = graph.prepareVertex(longRunningProcessId, vertex.getVisibility());
  LongRunningProcessProperties.QUEUE_ITEM_JSON_PROPERTY.setProperty(
      vb,
      json,
      getVisibility()
  );
  vb.save(getAuthorizations(user));
  this.graph.flush();
  workQueueRepository.broadcastLongRunningProcessChange(json);
}

代码示例来源:origin: org.visallo/visallo-tools-migration-workspace-to-workproduct

LOGGER.info("Found a workspace: %s", workspace.getId());
VertexBuilder productVertex = graph.prepareVertex(workspace.getVisibility());
VisalloProperties.CONCEPT_TYPE.setProperty(
    productVertex,
    WorkspaceProperties.PRODUCT_CONCEPT_IRI,
    workspace.getVisibility()
);
WorkspaceProperties.TITLE.setProperty(productVertex, "Migrated", workspace.getVisibility());
WorkspaceProperties.PRODUCT_KIND.setProperty(productVertex, GRAPH_KIND, workspace.getVisibility());
String productId = productVertex.getVertexId();
productVertex.save(authorizations);
EdgeBuilderByVertexId workspaceToProductEdge = graph.prepareEdge(workspace.getId() + "_hasProduct_" + productId, workspace.getId(), productId,
    WORKSPACE_TO_PRODUCT_RELATIONSHIP_IRI, workspace.getVisibility());
              edgeInfo.getVertexId(),
              PRODUCT_TO_ENTITY_RELATIONSHIP_IRI,
              workspace.getVisibility()
          );
          JSONObject position = new JSONObject();
          position.put("x", positionForProperty(edge, GRAPH_POSITION_X));
          position.put("y", positionForProperty(edge, GRAPH_POSITION_Y));
          productToEntityEdge.setProperty(EDGE_POSITION, position.toString(), workspace.getVisibility());
          productToEntityEdge.save(authorizations);

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

@Test
public void testBlankVisibilityString() {
  Vertex v = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY);
  assertNotNull(v);
  assertEquals("v1", v.getId());
  graph.flush();
  v = graph.getVertex("v1", AUTHORIZATIONS_EMPTY);
  assertNotNull(v);
  assertEquals("v1", v.getId());
  assertEquals(VISIBILITY_EMPTY, v.getVisibility());
}

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

@Test
public void testBlankVisibilityString() {
  Vertex v = graph.addVertex("v1", VISIBILITY_EMPTY, AUTHORIZATIONS_EMPTY);
  assertNotNull(v);
  assertEquals("v1", v.getId());
  graph.flush();
  v = graph.getVertex("v1", AUTHORIZATIONS_EMPTY);
  assertNotNull(v);
  assertEquals("v1", v.getId());
  assertEquals(VISIBILITY_EMPTY, v.getVisibility());
}

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

graph.flush();
assertEquals(VISIBILITY_A.getVisibilityString(), v1.getVisibility().getVisibilityString());
assertEquals(VISIBILITY_A.getVisibilityString(), v1.getVisibility().getVisibilityString());
assertEquals(0, count(v1.getProperties()));
assertEquals(VISIBILITY_A_AND_B.getVisibilityString(), v1.getVisibility().getVisibilityString());
assertEquals(VISIBILITY_EMPTY.getVisibilityString(), v1.getVisibility().getVisibilityString());

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

graph.flush();
assertEquals(VISIBILITY_A.getVisibilityString(), v1.getVisibility().getVisibilityString());
assertEquals(VISIBILITY_A.getVisibilityString(), v1.getVisibility().getVisibilityString());
assertEquals(0, count(v1.getProperties()));
assertEquals(VISIBILITY_A_AND_B.getVisibilityString(), v1.getVisibility().getVisibilityString());
assertEquals(VISIBILITY_EMPTY.getVisibilityString(), v1.getVisibility().getVisibilityString());

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

assertEquals(VISIBILITY_B, v1.getVisibility());
List<Property> properties = toList(v1.getProperties());
assertEquals(1, properties.size());

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

assertEquals(VISIBILITY_B, v1.getVisibility());
List<Property> properties = toList(v1.getProperties());
assertEquals(1, properties.size());

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

@Test
public void testAddVertexWithId() {
  Vertex vertexAdded = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
  assertNotNull(vertexAdded);
  assertEquals("v1", vertexAdded.getId());
  graph.flush();
  Vertex v = graph.getVertex("v1", AUTHORIZATIONS_A);
  assertNotNull(v);
  assertEquals("v1", v.getId());
  assertEquals(VISIBILITY_A, v.getVisibility());
  v = graph.getVertex("", AUTHORIZATIONS_A);
  assertNull(v);
  v = graph.getVertex(null, AUTHORIZATIONS_A);
  assertNull(v);
  assertEvents(
      new AddVertexEvent(graph, vertexAdded)
  );
}

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

@Test
public void testAddVertexWithId() {
  Vertex vertexAdded = graph.addVertex("v1", VISIBILITY_A, AUTHORIZATIONS_A);
  assertNotNull(vertexAdded);
  assertEquals("v1", vertexAdded.getId());
  graph.flush();
  Vertex v = graph.getVertex("v1", AUTHORIZATIONS_A);
  assertNotNull(v);
  assertEquals("v1", v.getId());
  assertEquals(VISIBILITY_A, v.getVisibility());
  v = graph.getVertex("", AUTHORIZATIONS_A);
  assertNull(v);
  v = graph.getVertex(null, AUTHORIZATIONS_A);
  assertNull(v);
  assertEvents(
      new AddVertexEvent(graph, vertexAdded)
  );
}

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

@Test
public void testGraphQueryVertexWithVisibilityChange() {
  Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A)
      .save(AUTHORIZATIONS_A);
  graph.flush();
  QueryResultsIterable<Vertex> vertices = graph.query(AUTHORIZATIONS_A).vertices();
  assertResultsCount(1, vertices);
  assertVertexIds(vertices, v1.getId());
  // change to same visibility
  v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
  v1 = v1.prepareMutation()
      .alterElementVisibility(VISIBILITY_EMPTY)
      .save(AUTHORIZATIONS_A);
  graph.flush();
  Assert.assertEquals(VISIBILITY_EMPTY, v1.getVisibility());
  vertices = graph.query(AUTHORIZATIONS_A).vertices();
  assertResultsCount(1, vertices);
  assertVertexIds(vertices, v1.getId());
  // change to new visibility
  v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
  v1.prepareMutation()
      .alterElementVisibility(VISIBILITY_B)
      .save(AUTHORIZATIONS_A_AND_B);
  graph.flush();
  vertices = graph.query(AUTHORIZATIONS_A).vertices();
  assertResultsCount(0, vertices);
  assertEquals(0, count(vertices));
}

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

@Test
public void testGraphQueryVertexWithVisibilityChange() {
  Vertex v1 = graph.prepareVertex("v1", VISIBILITY_A)
      .save(AUTHORIZATIONS_A);
  graph.flush();
  QueryResultsIterable<Vertex> vertices = graph.query(AUTHORIZATIONS_A).vertices();
  assertResultsCount(1, vertices);
  assertVertexIds(vertices, v1.getId());
  // change to same visibility
  v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
  v1 = v1.prepareMutation()
      .alterElementVisibility(VISIBILITY_EMPTY)
      .save(AUTHORIZATIONS_A);
  graph.flush();
  Assert.assertEquals(VISIBILITY_EMPTY, v1.getVisibility());
  vertices = graph.query(AUTHORIZATIONS_A).vertices();
  assertResultsCount(1, vertices);
  assertVertexIds(vertices, v1.getId());
  // change to new visibility
  v1 = graph.getVertex("v1", AUTHORIZATIONS_A);
  v1.prepareMutation()
      .alterElementVisibility(VISIBILITY_B)
      .save(AUTHORIZATIONS_A_AND_B);
  graph.flush();
  vertices = graph.query(AUTHORIZATIONS_A).vertices();
  assertResultsCount(0, vertices);
  assertEquals(0, count(vertices));
}

相关文章