コード例 #1
0
 /** @ejb.interface-method */
 public Collection moveSeriesOfPPSToTrash(String ppsIUID, boolean removeEmptyParents)
     throws RemoteException {
   Collection result = new ArrayList(); // FIXME: NOT IN USE
   try {
     Object[] ppsSeries = seriesHome.findByPpsIuid(ppsIUID).toArray();
     if (ppsSeries.length > 0) {
       SeriesLocal series = null;
       StudyLocal study = ((SeriesLocal) ppsSeries[0]).getStudy();
       for (int i = 0; i < ppsSeries.length; i++) {
         series = (SeriesLocal) ppsSeries[i];
         getPrivateSeries(series, DELETED, null, true);
         series.remove();
       }
       if (removeEmptyParents && study.getSeries().isEmpty()) {
         study.remove();
       } else {
         UpdateDerivedFieldsUtils.updateDerivedFieldsOf(study);
       }
     }
   } catch (FinderException ignore) {
   } catch (Exception e) {
     throw new RemoteException(e.getMessage());
   }
   return result;
 }
コード例 #2
0
  /**
   * Delete a list of instances, i.e., move them to trash bin
   *
   * @ejb.interface-method
   * @param iuids A list of instance uid
   * @param cascading True to delete the series/study if there's no instance/series
   * @return a collection of Dataset containing the actuall detetion information per study
   * @throws RemoteException
   */
  public Collection moveInstancesToTrash(String[] iuids, boolean cascading) throws RemoteException {
    try {
      // These instances may belong to multiple studies,
      // although mostly they should be the same study
      Map mapStudies = new HashMap();
      for (int i = 0; i < iuids.length; i++) {
        InstanceLocal instance = instHome.findBySopIuid(iuids[i]);
        SeriesLocal series = instance.getSeries();
        StudyLocal study = series.getStudy();
        if (!mapStudies.containsKey(study)) mapStudies.put(study, new HashMap());
        Map mapSeries = (Map) mapStudies.get(study);
        if (!mapSeries.containsKey(series)) mapSeries.put(series, new ArrayList());
        Collection colInstances = (Collection) mapSeries.get(series);
        colInstances.add(instance);
      }

      List dss = new ArrayList();
      Iterator iter = mapStudies.keySet().iterator();
      while (iter.hasNext()) {
        StudyLocal study = (StudyLocal) iter.next();
        dss.add(getStudyMgtDataset(study, (Map) mapStudies.get(study)));
        Iterator iter2 = ((Map) mapStudies.get(study)).keySet().iterator();
        while (iter2.hasNext()) {
          SeriesLocal series = (SeriesLocal) iter2.next();
          List instances = (List) ((Map) mapStudies.get(study)).get(series);
          for (int i = 0; i < instances.size(); i++) {
            // Delete the instance now, i.e., move to trash bin,
            // becoming private instance
            getPrivateInstance((InstanceLocal) instances.get(i), DELETED, null);
            ((InstanceLocal) instances.get(i)).remove();
          }
          if (series.getInstances().size() == 0 && cascading) {
            // Delete the series too since there's no instance left
            getPrivateSeries(series, DELETED, null, false);
            series.remove();
          } else UpdateDerivedFieldsUtils.updateDerivedFieldsOf(series);
        }
        if (study.getSeries().size() == 0 && cascading) {
          // Delete the study too since there's no series left
          getPrivateStudy(study, DELETED, null, false);
          study.remove();
        } else UpdateDerivedFieldsUtils.updateDerivedFieldsOf(study);
      }

      return dss;
    } catch (CreateException e) {
      throw new RemoteException(e.getMessage());
    } catch (EJBException e) {
      throw new RemoteException(e.getMessage());
    } catch (FinderException e) {
      throw new RemoteException(e.getMessage());
    } catch (RemoveException e) {
      throw new RemoteException(e.getMessage());
    }
  }
コード例 #3
0
 /** @ejb.interface-method */
 public Dataset moveSeriesToTrash(long series_pk) throws RemoteException {
   try {
     SeriesLocal series = seriesHome.findByPrimaryKey(new Long(series_pk));
     StudyLocal study = series.getStudy();
     Map mapSeries = new HashMap();
     mapSeries.put(series, series.getInstances());
     Dataset ds = getStudyMgtDataset(series.getStudy(), mapSeries);
     getPrivateSeries(series, DELETED, null, true);
     series.remove();
     UpdateDerivedFieldsUtils.updateDerivedFieldsOf(study);
     return ds;
   } catch (CreateException e) {
     throw new RemoteException(e.getMessage());
   } catch (EJBException e) {
     throw new RemoteException(e.getMessage());
   } catch (FinderException e) {
     throw new RemoteException(e.getMessage());
   } catch (RemoveException e) {
     throw new RemoteException(e.getMessage());
   }
 }