public MeasureStandard(OrientVertex scale, OrientVertex vUser, OrientBaseGraph g) throws AccessForbiddenException { super(scale, vUser, g); if (!AccessRights.canRead(vUser, scale, g)) { throw new AccessForbiddenException( (String) vUser.getProperty(DataModel.Properties.id), (String) scale.getProperty(DataModel.Properties.id)); } this.userCanDelete = DeleteUtils.canUserDeleteSubGraph(scale, vUser, g); Double lengthInMm = scale.getProperty(DataModel.Properties.length); Iterator<Vertex> itMeasurements = scale.getVertices(Direction.IN, DataModel.Links.definedAsMeasureStandard).iterator(); // It's 1 and only 1 (except for new versions of it) Vertex vMeasurement = AccessUtils.findLatestVersion(itMeasurements, g); Double lengthInPixels = vMeasurement.getProperty(DataModel.Properties.pxValue); this.mmPerPixel = lengthInMm / lengthInPixels; }
protected void updateVertex(OrientVertex v) { v.setProperty("saved", ((Integer) v.getProperty("saved")) + 1); }