/**
   * Import book exemplars
   *
   * @param nodes
   * @return
   */
  private Boolean processExemplars(NodeList nodes) {
    NodeList exemplars = nodes.item(0).getChildNodes();

    for (int i = 0; i < exemplars.getLength(); i++) {
      if (exemplars.item(i).getNodeType() == Node.ELEMENT_NODE) {
        Element exemplarNode = (Element) exemplars.item(i);

        Exemplar exemplar = new Exemplar();

        exemplar.setIdexemplar(Integer.parseInt(getTagValue("idexemplar", exemplarNode)));
        exemplar.setAquired(
            DatatypeConverter.parseDateTime(getTagValue("aquired", exemplarNode)).getTime());
        exemplar.setState(Integer.parseInt(getTagValue("state", exemplarNode)));

        Book book = bookMgr.findByIdbook(Integer.parseInt(getTagValue("book", exemplarNode)));
        if (book == null) {
          continue;
        }

        exemplar.setBook(book);

        try {
          exemplarMgr.save(exemplar);
        } catch (EJBException ex) {
          ex.printStackTrace(System.out);
        }
      }
    }
    return true;
  }
Exemple #2
0
 private void persistCube(Cube cube, JsfUtil.PersistAction persistAction, String successMessage) {
   if (cube != null) {
     try {
       if (persistAction == JsfUtil.PersistAction.CREATE) {
         cubeEM.create(cube);
       } else if (persistAction == JsfUtil.PersistAction.DELETE) {
         cubeEM.remove(cube);
       } else {
         cubeEM.edit(cube);
       }
       JsfUtil.addSuccessMessage(successMessage);
     } catch (EJBException ex) {
       String msg = "";
       Throwable cause = ex.getCause();
       JsfUtil.setValidationFailed();
       ;
       if (cause != null) {
         msg = cause.getLocalizedMessage();
       }
       if (msg.length() > 0) {
         JsfUtil.addErrorMessage(msg);
       } else {
         JsfUtil.addErrorMessage(
             ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
       }
     } catch (Exception ex) {
       Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
       JsfUtil.addErrorMessage(
           ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
     }
   }
 }
  /**
   * Import books
   *
   * @param nodes
   * @return
   */
  private Boolean processBooks(NodeList nodes) {
    NodeList books = nodes.item(0).getChildNodes();

    for (int i = 0; i < books.getLength(); i++) {
      if (books.item(i).getNodeType() == Node.ELEMENT_NODE) {
        Element bookNode = (Element) books.item(i);

        Book book = new Book();

        book.setIdbook(Integer.parseInt(getTagValue("idbook", bookNode)));
        book.setCode(getTagValue("code", bookNode));
        book.setEdition(Integer.parseInt(getTagValue("edition", bookNode)));
        book.setPages(Integer.parseInt(getTagValue("pages", bookNode)));
        book.setPlace(getTagValue("place", bookNode));
        book.setYear(DatatypeConverter.parseDateTime(getTagValue("year", bookNode)).getTime());
        book.setType(getTagValue("type", bookNode));
        book.setName(getTagValue("name", bookNode));

        // find and set publisher
        Publisher publisher =
            publisherMgr.findByIdpublisher(Integer.parseInt(getTagValue("publisher", bookNode)));
        if (publisher == null) {
          continue;
        }

        book.setPublisher(publisher);

        // find and set genre
        Genre genre = genreMgr.findByIdgenre(Integer.parseInt(getTagValue("genre", bookNode)));
        if (genre == null) {
          continue;
        }

        book.setGenre(genre);

        // setup book authors
        List<String> authors = getTagsValues("authorCollection", bookNode);

        if (book.getAuthorCollection() == null) {
          book.setAuthorCollection(new ArrayList<Author>());
        }

        for (String authorId : authors) {
          Author author = authorMgr.findByIdauthor(Integer.parseInt(authorId));
          if (author != null) {
            //						book.getAuthorCollection().add(author);
            author.getBooksCollection().add(book);
            authorMgr.save(author);
          }
        }

        try {
          bookMgr.save(book);
        } catch (EJBException ex) {
          ex.printStackTrace(System.out);
        }
      }
    }
    return true;
  }
 public String process() {
   if (!this.loggedIn) {
     try {
       this.loggedIn =
           this.authenticateObject.check(new AuthenticateDTO(this.login, this.password));
     } catch (EJBException ejbex) {
       this.loggedIn = false;
       System.out.println(ejbex.toString());
     }
   } else {
     this.loggedIn = false;
   }
   if (this.loggedIn) {
     ((HttpServletRequest) FacesContext.getCurrentInstance().getExternalContext().getRequest())
         .getSession(true);
     this.cartObject.initialize();
   } else {
     FacesContext facesContext = FacesContext.getCurrentInstance();
     ExternalContext externalContext = facesContext.getExternalContext();
     Locale loc = externalContext.getRequestLocale();
     externalContext.invalidateSession();
     facesContext.getViewRoot().setLocale(loc);
     if (this.cartObject != null) {
       this.cartObject.setClientId(null);
       this.cartObject.setMerchandiseId(null);
       this.cartObject.setAmount(null);
       this.cartObject.destroy();
     }
     this.currencyObject.setLocalizationLocale(loc);
   }
   return null;
 }
  public void addSubscriber() {
    try {
      if (program.getListEditing() == null) {
        throw new RuntimeException(
            "List is not set yet but you still manage to come to this page? Notify your admin immediately! =)");
      }

      subService.subscribe(program.getListEditingId(), this.getFieldValues());
      FacesMessenger.setFacesMessage(
          program.getFormName(), FacesMessage.SEVERITY_FATAL, "Subscriber added!", null);
      // How to redirect to List editing panel?
      program.refresh();

    } catch (EJBException ex) { // Transaction did not go through
      // Throwable cause = ex.getCause();
      FacesMessenger.setFacesMessage(
          formName, FacesMessage.SEVERITY_ERROR, "Error with transaction", ex.getMessage());
    } catch (EntityNotFoundException ex) {
      FacesMessenger.setFacesMessage(formName, FacesMessage.SEVERITY_ERROR, ex.getMessage(), "");
    } catch (IncompleteDataException ex) {
      FacesMessenger.setFacesMessage(formName, FacesMessage.SEVERITY_ERROR, ex.getMessage(), "");
    } catch (DataValidationException ex) {
      FacesMessenger.setFacesMessage(formName, FacesMessage.SEVERITY_ERROR, ex.getMessage(), "");
    } catch (RelationshipExistsException ex) {
      FacesMessenger.setFacesMessage(
          formName, FacesMessage.SEVERITY_ERROR, "Subscriber already exist in this list", "");
    } catch (Exception ex) {
      FacesMessenger.setFacesMessage(
          formName, FacesMessage.SEVERITY_ERROR, ex.getClass().getSimpleName(), ex.getMessage());
    }
  }
 private void persist(PersistAction persistAction, String successMessage) {
   if (selected != null) {
     setEmbeddableKeys();
     try {
       if (persistAction != PersistAction.DELETE) {
         getFacade().edit(selected);
       } else {
         getFacade().remove(selected);
       }
       JsfUtil.addSuccessMessage(successMessage);
     } catch (EJBException ex) {
       String msg = "";
       Throwable cause = ex.getCause();
       if (cause != null) {
         msg = cause.getLocalizedMessage();
       }
       if (msg.length() > 0) {
         JsfUtil.addErrorMessage(msg);
       } else {
         JsfUtil.addErrorMessage(
             ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
       }
     } catch (Exception ex) {
       Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
       JsfUtil.addErrorMessage(
           ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
     }
   }
 }
  @RequestMapping(value = "/create-category", method = RequestMethod.POST)
  public String createCategory(
      Model model,
      @ModelAttribute("category") @Valid Category category,
      Errors errors,
      @RequestParam("name") String name,
      @RequestParam("description") String description) {

    model.addAttribute("title", "Create Category");

    Category newCategory =
        new Category(HtmlUtils.htmlEscape(name), HtmlUtils.htmlEscape(description));

    if (errors.hasErrors()) {
      model.addAttribute("category", category);
      return "create-category";
    }

    /*
     * What to do if there is no error
     * We need a DAO and Service to add category into the database
     */
    try {
      categoryService.createCategory(newCategory);
      model.addAttribute(
          "success",
          "<div class=\"info\">Succesfully Created <p> <a href='manage-category.html'>Go back to Management Page</a></div>"); // Add success message
      category.setName(""); // Reset form field
      category.setDescription(""); // Reset form field
    } catch (EJBException e) {
      model.addAttribute("error", e.getMessage());
    }

    return "create-category";
  }
 @Test
 public void testDeleteByUserGroup() throws Throwable {
   try {
     runTX(
         new Callable<Void>() {
           @Override
           public Void call() throws Exception {
             doTestAdd();
             return null;
           }
         });
     runTX(
         new Callable<Void>() {
           @Override
           public Void call() throws Exception {
             doTestDeleteByUserGroup();
             return null;
           }
         });
     runTX(
         new Callable<Void>() {
           @Override
           public Void call() throws Exception {
             doTestDeleteCheckByUserGroup();
             return null;
           }
         });
   } catch (EJBException e) {
     throw e.getCause();
   }
 }
  /**
   * Import users
   *
   * @param nodes list of users nodes (wrapper node, thus only one)
   * @return
   */
  private Boolean processUsers(NodeList nodes) {
    NodeList users = nodes.item(0).getChildNodes();

    for (int i = 0; i < users.getLength(); i++) {
      if (users.item(i).getNodeType() == Node.ELEMENT_NODE) {
        Element userNode = (Element) users.item(i);

        User user = new User();

        user.setIduser(Integer.parseInt(getTagValue("iduser", userNode)));
        user.setForename(getTagValue("forename", userNode));
        user.setSurname(getTagValue("surname", userNode));
        user.setPermitNumber(getTagValue("permitNumber", userNode));
        user.setAddress(getTagValue("address", userNode));
        user.setEmail(getTagValue("email", userNode));
        user.setRegistered(
            DatatypeConverter.parseDateTime(getTagValue("registered", userNode)).getTime());
        user.setExpire(DatatypeConverter.parseDateTime(getTagValue("expire", userNode)).getTime());
        user.setPassword(getTagValue("password", userNode));
        user.setLevel(getTagValue("level", userNode));

        try {
          userMgr.Save(user);
        } catch (EJBException ex) {
          ex.printStackTrace(System.out);
        }
      }
    }
    return true;
  }
 /**
  * @throws FinderException
  * @ejb.interface-method
  */
 public void deletePrivateFile(long file_pk) throws RemoteException {
   try {
     privFileHome.remove(new Long(file_pk));
   } catch (EJBException e) {
     throw new RemoteException(e.getMessage());
   } catch (RemoveException e) {
     throw new RemoteException(e.getMessage());
   }
 }
 /** @ejb.interface-method */
 public void deletePrivatePatient(long patient_pk) throws RemoteException {
   try {
     privPatHome.remove(new Long(patient_pk));
   } catch (EJBException e) {
     throw new RemoteException(e.getMessage());
   } catch (RemoveException e) {
     throw new RemoteException(e.getMessage());
   }
 }
 public String reset() {
   if (this.installed) {
     try {
       throw new EJBException("Desinstalação não foi implementada!");
     } catch (EJBException e) {
       Logger.getGlobal().fine(e.getMessage());
     }
   }
   return "setup";
 }
  /**
   * 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());
    }
  }
 /**
  * @throws FinderException
  * @ejb.interface-method
  */
 public void deletePrivateFiles(Collection fileDTOs) throws RemoteException {
   try {
     for (Iterator iter = fileDTOs.iterator(); iter.hasNext(); ) {
       privFileHome.remove(new Long(((FileDTO) iter.next()).getPk()));
     }
   } catch (EJBException e) {
     throw new RemoteException(e.getMessage());
   } catch (RemoveException e) {
     throw new RemoteException(e.getMessage());
   }
 }
 /** @ejb.interface-method */
 public Dataset moveStudyToTrash(String iuid) throws RemoteException {
   try {
     StudyLocal study = studyHome.findByStudyIuid(iuid);
     if (study != null) return moveStudyToTrash(study.getPk().longValue());
     else return null;
   } catch (EJBException e) {
     throw new RemoteException(e.getMessage());
   } catch (FinderException e) {
     throw new RemoteException(e.getMessage());
   }
 }
 public void clientData(String _id) {
   Object[] objects = null;
   try {
     objects = this.authenticateObject.testification(_id);
   } catch (EJBException ejbex) {
     System.out.println(ejbex.toString());
   }
   if (objects != null) {
     this.login = objects[0].toString().trim();
     this.forename = (objects[1] == null) ? "" : objects[1].toString().trim();
     this.email = objects[2].toString().trim();
   }
 }
 @Override
 @AroundInvoke
 public Object invoke(InvocationContext context) throws Exception {
   try {
     try {
       return context.proceed();
     } catch (EJBException ejbExc) {
       if (ejbExc.getCause() != null && ejbExc.getCause() instanceof RuntimeException) {
         throw (RuntimeException) ejbExc.getCause();
       } else {
         throw ejbExc;
       }
     }
   } catch (EJBException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (SystemException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (ApplicationException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (InvalidStateException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (SQLException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (StaleObjectStateException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (StaleStateException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (HibernateException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (OptimisticLockException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (PersistenceException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (RuntimeException e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   } catch (Error e) {
     afterThrowing(context.getMethod(), context.getParameters(), context.getTarget(), e);
     throw e;
   }
 }
 /** @ejb.interface-method */
 public void deleteAll(int privateType) throws RemoteException {
   try {
     Collection c = privPatHome.findByPrivateType(privateType);
     for (Iterator iter = c.iterator(); iter.hasNext(); ) {
       privPatHome.remove(((PrivatePatientLocal) iter.next()).getPk());
     }
   } catch (EJBException e) {
     throw new RemoteException(e.getMessage());
   } catch (RemoveException e) {
     throw new RemoteException(e.getMessage());
   } catch (FinderException e) {
     throw new RemoteException(e.getMessage());
   }
 }
Exemple #19
0
  public void deleteCubes() {
    if (selectedCubes != null && (!selectedCubes.isEmpty())) {
      try {
        cubeEM.deleteCubes(selectedCubes);
        cubes.removeAll(selectedCubes);
        cubeEM.flush();

        List<X3DScene> scenes = scene.getScene();
        if (scenes != null && (!scenes.isEmpty())) {
          X3DScene get = scenes.get(0);

          List<X3DObject> transformedCubes = new ArrayList<>(selectedCubes.size());
          for (Cube select : selectedCubes) {
            if (cubeToScene.containsKey(select)) {
              X3DTransform cubeNode = cubeToScene.get(select);
              if (get.removeTransform(cubeNode)) {
                cubeToScene.remove(select);
                transformedCubes.add(cubeNode);
              }
            }
          }

          //                    String generateDelta = dataHandler.generateDeltaMessage("delete",
          // get, transformedCubes, true);
          //                    RequestContext requestContext = RequestContext.getCurrentInstance();
          //                    requestContext.execute(String.format("window.updateScene('%s')",
          // generateDelta));

        }
        JsfUtil.addSuccessMessage(ResourceBundle.getBundle("/Bundle").getString("CubeDeleted"));
      } catch (EJBException ex) {
        String msg = "";
        Throwable cause = ex.getCause();
        JsfUtil.setValidationFailed();
        if (cause != null) {
          msg = cause.getLocalizedMessage();
        }
        if (msg.length() > 0) {
          JsfUtil.addErrorMessage(msg);
        } else {
          JsfUtil.addErrorMessage(
              ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
        }
      } catch (Exception ex) {
        Logger.getLogger(this.getClass().getName()).log(Level.SEVERE, null, ex);
        JsfUtil.addErrorMessage(
            ex, ResourceBundle.getBundle("/Bundle").getString("PersistenceErrorOccured"));
      }
    }
  }
 public Integer clientIdentification() {
   if (this.loggedIn) {
     try {
       this.clientIdentification =
           this.authenticateObject.identification(new AuthenticateDTO(this.login, this.password));
     } catch (EJBException ejbex) {
       this.loggedIn = false;
       this.clientIdentification = null;
       System.out.println(ejbex.toString());
     }
     return this.clientIdentification;
   }
   return null;
 }
 @Override
 public void createBluetoothDwell(BluetoothDwell entry) {
   try {
     em.persist(entry);
   } catch (javax.validation.ConstraintViolationException err) {
     logger.error(err.getConstraintViolations().toString());
   } catch (javax.ejb.EJBException err) {
     Throwable cause = err.getCause();
     if (cause instanceof ConstraintViolationException) {
       logger.error(((ConstraintViolationException) cause).getConstraintViolations().toString());
     }
   } catch (Exception err) {
     logger.error(null, err);
   }
 }
 @Test(expected = IllegalArgumentException.class)
 public void testStoreControllerSetting_null2() throws Throwable {
   try {
     runTX(
         new Callable<Void>() {
           @Override
           public Void call() throws Exception {
             cs.storeControllerConfigurationSettings("ess.test", null);
             return null;
           }
         });
   } catch (EJBException e) {
     throw e.getCause();
   }
 }
 /**
  * @throws FinderException
  * @ejb.interface-method
  */
 public Collection deletePrivateStudy(long study_pk) throws RemoteException, FinderException {
   try {
     PrivateStudyLocal study = privStudyHome.findByPrimaryKey(new Long(study_pk));
     ArrayList files = null;
     PrivatePatientLocal pat = study.getPatient();
     study.remove();
     if (pat.getStudies().isEmpty()) {
       pat.remove();
     }
     return files;
   } catch (EJBException e) {
     throw new RemoteException(e.getMessage());
   } catch (RemoveException e) {
     throw new RemoteException(e.getMessage());
   }
 }
  public void loadListFields() {
    try {
      long listId = program.getListEditingId();
      // to improve performance
      // no! it's necessary else there will be nullpointerexception :p
      if (listId <= 0) {
        return;
      }
      List<SubscriptionListField> fieldList = subService.getFieldsForSubscriptionList(listId);
      this.program.setFieldList(fieldList);

    } catch (EJBException ex) {
      FacesMessenger.setFacesMessage(
          program.getFormName(), FacesMessage.SEVERITY_ERROR, ex.getMessage(), null);
    }
  }
  /**
   * Import borrows
   *
   * @param nodes
   * @return
   */
  public Boolean processBorrows(NodeList nodes) {
    NodeList borrows = nodes.item(0).getChildNodes();

    for (int i = 0; i < borrows.getLength(); i++) {
      if (borrows.item(i).getNodeType() == Node.ELEMENT_NODE) {
        Element borrowNode = (Element) borrows.item(i);

        Borrow borrow = new Borrow();

        borrow.setIdborrow(Integer.parseInt(getTagValue("idborrow", borrowNode)));
        borrow.setProlongations(Integer.parseInt(getTagValue("prolongations", borrowNode)));
        borrow.setBorrowed(
            DatatypeConverter.parseDateTime(getTagValue("borrowed", borrowNode)).getTime());

        // set returned date (can be null)
        try {
          if (getTagValue("returned", borrowNode) != null) {
            borrow.setReturned(
                DatatypeConverter.parseDateTime(getTagValue("returned", borrowNode)).getTime());
          }
        } catch (NullPointerException e) {
        }

        User user = userMgr.findByIduser(Integer.parseInt(getTagValue("user", borrowNode)));
        if (user == null) {
          continue;
        }

        borrow.setUser(user);

        Exemplar exemplar =
            exemplarMgr.findByIdexemplar(Integer.parseInt(getTagValue("exemplar", borrowNode)));
        if (exemplar == null) {
          continue;
        }

        borrow.setExemplar(exemplar);

        try {
          borrowMgr.Save(borrow);
        } catch (EJBException ex) {
          ex.printStackTrace(System.out);
        }
      }
    }
    return true;
  }
 @Override
 public void updateBluetoothFileSendSummary(BluetoothFileSendSummary entry) {
   try {
     em.merge(entry);
   } catch (javax.validation.ConstraintViolationException err) {
     logger.error(err.getConstraintViolations().toString());
   } catch (javax.ejb.EJBException err) {
     Throwable cause = err.getCause();
     if (cause instanceof ConstraintViolationException) {
       logger.error(((ConstraintViolationException) cause).getConstraintViolations().toString());
     } else {
       logger.error(null, err);
     }
   } catch (Exception err) {
     logger.error(null, err);
   }
 }
 /** @ejb.interface-method */
 public Dataset moveStudyToTrash(long study_pk) throws RemoteException {
   try {
     StudyLocal study = studyHome.findByPrimaryKey(new Long(study_pk));
     Dataset ds = getStudyMgtDataset(study, null);
     getPrivateStudy(study, DELETED, null, true);
     study.remove();
     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());
   }
 }
 public String delete() {
   if (name.equalsIgnoreCase("default")) {
     setErrorMessage("Builtin profile 'Default' can not be deleted.");
     return null;
   }
   try {
     Ejb.lookupDeviceProfileBean().findByPrimaryKey(name).remove();
     setDeleted();
     return "deleted";
   } catch (RemoveException ex) {
     setErrorMessage(ex.getMessage());
   } catch (EJBException ex) {
     setErrorMessage(ex.getMessage());
   } catch (FinderException ex) {
     setErrorMessage(ex.getMessage());
   }
   return null;
 }
 /**
  * @throws FinderException
  * @ejb.interface-method
  */
 public void deletePrivateSeries(long series_pk) throws RemoteException, FinderException {
   try {
     PrivateSeriesLocal series = privSeriesHome.findByPrimaryKey(new Long(series_pk));
     PrivateStudyLocal study = series.getStudy();
     series.remove();
     if (study.getSeries().isEmpty()) {
       PrivatePatientLocal pat = study.getPatient();
       study.remove();
       if (pat.getStudies().isEmpty()) {
         pat.remove();
       }
     }
   } catch (EJBException e) {
     throw new RemoteException(e.getMessage());
   } catch (RemoveException e) {
     throw new RemoteException(e.getMessage());
   }
 }
 @SuppressWarnings("unchecked")
 @Ignore
 @Test
 public void testBaseServiceWithInvalidArgumentType() {
   try {
     baseService.doSomething(Boolean.TRUE);
     fail("Expected ClassCastException");
   } catch (ClassCastException e) {
   } catch (EJBException e) {
     if (!(e.getCause() instanceof ClassCastException)) {
       throw e;
     }
   }
   assertEquals(
       "ClassCastException should be thrown before interceptor is invoked",
       0,
       SomeInterceptor.invocationCount);
 }