LayoutEntity
Code IndexAdd Codota to your IDE (free)

Best Java code snippets using org.opennms.netmgt.topology.persistence.api.LayoutEntity (Showing top 10 results out of 315)

origin: OpenNMS/opennms

public void addVertexPosition(VertexPositionEntity position) {
  Objects.requireNonNull(position);
  getVertexPositions().add(position);
}
origin: OpenNMS/opennms

public LayoutEntity loadLayout(Graph graph) {
  LayoutEntity layoutEntity = findBy(graph);
  if (layoutEntity != null) {
    layoutEntity.setLastUsed(new Date());
    layoutDao.saveOrUpdate(layoutEntity);
  }
  return layoutEntity;
}
origin: OpenNMS/opennms

LayoutEntity layoutEntity = layoutDao.get(id);
if (layoutEntity == null) {
  layoutEntity = new LayoutEntity();
  layoutEntity.setId(id);
  layoutEntity.setCreated(new Date());
  layoutEntity.setCreator(graphContainer.getApplicationContext().getUsername());
layoutEntity.setUpdated(new Date());
layoutEntity.setUpdator(graphContainer.getApplicationContext().getUsername());
    })
    .collect(Collectors.toList());
layoutEntity.getVertexPositions().clear();
for (VertexPositionEntity eachVertexPosition : vertexPositionEntities) {
  layoutEntity.addVertexPosition(eachVertexPosition);
origin: org.opennms.features.topology/org.opennms.features.topology.app

final Collection<Vertex> vertices = graph.getDisplayVertices();
for (Vertex vertex : vertices) {
  PointEntity pointEntity = layoutEntity.getPosition(vertex.getNamespace(), vertex.getId());
  layout.setLocation(vertex, new Point(pointEntity.getX(), pointEntity.getY()));
origin: org.opennms.features.topology/org.opennms.features.topology.app

LayoutEntity layoutEntity = layoutDao.get(id);
if (layoutEntity == null) {
  layoutEntity = new LayoutEntity();
  layoutEntity.setId(id);
  layoutEntity.setCreated(new Date());
  layoutEntity.setCreator(graphContainer.getApplicationContext().getUsername());
layoutEntity.setUpdated(new Date());
layoutEntity.setUpdator(graphContainer.getApplicationContext().getUsername());
    })
    .collect(Collectors.toList());
layoutEntity.getVertexPositions().clear();
for (VertexPositionEntity eachVertexPosition : vertexPositionEntities) {
  layoutEntity.addVertexPosition(eachVertexPosition);
origin: OpenNMS/opennms

final Collection<Vertex> vertices = graph.getDisplayVertices();
for (Vertex vertex : vertices) {
  PointEntity pointEntity = layoutEntity.getPosition(vertex.getNamespace(), vertex.getId());
  layout.setLocation(vertex, new Point(pointEntity.getX(), pointEntity.getY()));
origin: org.opennms.features.topology/org.opennms.features.topology.persistence.api

public void addVertexPosition(VertexPositionEntity position) {
  Objects.requireNonNull(position);
  getVertexPositions().add(position);
}
origin: org.opennms.features.topology/org.opennms.features.topology.app

public LayoutEntity loadLayout(Graph graph) {
  LayoutEntity layoutEntity = findBy(graph);
  if (layoutEntity != null) {
    layoutEntity.setLastUsed(new Date());
    layoutDao.saveOrUpdate(layoutEntity);
  }
  return layoutEntity;
}
origin: OpenNMS/opennms

  public boolean isPersistedLayoutEqualToCurrentLayout(Graph graph) {
    LayoutEntity layoutEntity = loadLayout(graph);
    if (layoutEntity != null) {
      // If we have a layout persisted, we verify if it is equal.
      final Map<VertexRef, Point> persistedLocations = layoutEntity.getVertexPositions()
          .stream()
          .collect(Collectors.toMap((Function<VertexPositionEntity, VertexRef>) vertexPositionEntity -> {
            VertexRefEntity vertexRefEntity = vertexPositionEntity.getVertexRef();
            return new DefaultVertexRef(vertexRefEntity.getNamespace(), vertexRefEntity.getId());
          }, vertexPositionEntity -> {
            PointEntity position = vertexPositionEntity.getPosition();
            return new Point(position.getX(), position.getY());
          }));

      // The locations may contain elements currently not visible, we filter them
      final Map<VertexRef, Point> manualLocations = new HashMap<>();
      graph.getLayout().getLocations().forEach((key, value) -> {
        if (persistedLocations.containsKey(key)) {
          // layoutEntity stores int coordinates, but manualLocations are stored as double.
          // Convert to int to make it comparable.
          manualLocations.put(key, new Point((int) value.getX(), (int) value.getY()));
        }
      });
      final boolean layoutIsEqual = manualLocations.equals(persistedLocations);
      return layoutIsEqual;
    }
    return false; // We don't have anything persisted, so they are not equal
  }
}
origin: org.opennms.features.topology/org.opennms.features.topology.app

  public boolean isPersistedLayoutEqualToCurrentLayout(Graph graph) {
    LayoutEntity layoutEntity = loadLayout(graph);
    if (layoutEntity != null) {
      // If we have a layout persisted, we verify if it is equal.
      final Map<VertexRef, Point> persistedLocations = layoutEntity.getVertexPositions()
          .stream()
          .collect(Collectors.toMap((Function<VertexPositionEntity, VertexRef>) vertexPositionEntity -> {
            VertexRefEntity vertexRefEntity = vertexPositionEntity.getVertexRef();
            return new DefaultVertexRef(vertexRefEntity.getNamespace(), vertexRefEntity.getId());
          }, vertexPositionEntity -> {
            PointEntity position = vertexPositionEntity.getPosition();
            return new Point(position.getX(), position.getY());
          }));

      // The locations may contain elements currently not visible, we filter them
      final Map<VertexRef, Point> manualLocations = new HashMap<>();
      graph.getLayout().getLocations().forEach((key, value) -> {
        if (persistedLocations.containsKey(key)) {
          // layoutEntity stores int coordinates, but manualLocations are stored as double.
          // Convert to int to make it comparable.
          manualLocations.put(key, new Point((int) value.getX(), (int) value.getY()));
        }
      });
      final boolean layoutIsEqual = manualLocations.equals(persistedLocations);
      return layoutIsEqual;
    }
    return false; // We don't have anything persisted, so they are not equal
  }
}
org.opennms.netmgt.topology.persistence.apiLayoutEntity

Most used methods

  • getVertexPositions
  • <init>
  • addVertexPosition
  • getPosition
  • setCreated
  • setCreator
  • setId
  • setLastUsed
  • setUpdated
  • setUpdator

Popular in Java

  • Making http requests using okhttp
  • getApplicationContext (Context)
  • findViewById (Activity)
  • getExternalFilesDir (Context)
  • Pointer (com.sun.jna)
    An abstraction for a native pointer data type. A Pointer instance represents, on the Java side, a na
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • Charset (java.nio.charset)
    A charset is a named mapping between Unicode characters and byte sequences. Every Charset can decode
  • ConcurrentHashMap (java.util.concurrent)
    A plug-in replacement for JDK1.5 java.util.concurrent.ConcurrentHashMap. This version is based on or
  • DataSource (javax.sql)
    An interface for the creation of Connection objects which represent a connection to a database. This
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base

For IntelliJ IDEA,
Android Studio or Eclipse

  • Search for JavaScript code betaCodota IntelliJ IDEA pluginCodota Android Studio pluginCode IndexSign in
  • EnterpriseFAQAboutBlogContact Us
  • Plugin user guideTerms of usePrivacy policyCodeboxFind Usages
Add Codota to your IDE (free)