Ejemplo n.º 1
0
  /**
   * Uses bulk update
   *
   * @see <a href="http://trac.openmicroscopy.org.uk/ome/ticket/1654">ticket:1654</a>
   */
  private void clearRois(Session session, Image i) {

    int shapeCount =
        execute(
            session,
            i.getId(),
            "delete from Shape where roi.id in "
                + "(select id from Roi roi where roi.image.id = :id)");
    int roiAnnCount =
        execute(
            session,
            i.getId(),
            "delete from RoiAnnotationLink where parent.id in "
                + "(select id from Roi roi where roi.image.id = :id)");
    int roiCount = execute(session, i.getId(), "delete from Roi where image.id = :id");

    if (shapeCount > 0 || roiAnnCount > 0 || roiCount > 0) {
      log.info(
          String.format(
              "Roi delete for image %s :" + " %s rois, %s shapes, %s annotations",
              i.getId(), roiCount, shapeCount, roiAnnCount));
    }
  }