public void deleteDevice(String _device) throws MSMApplicationException {
   try {
     deviceManager.deleteDevice(_device);
   } catch (RuntimeException e) {
     Throwable cause = e.getCause();
     for (int i = 0; i < 3 && cause != null; i++) {
       cause = cause.getCause();
       if (cause instanceof ConstraintViolationException) {
         throw new DeviceHasRelationshipException();
       }
     }
     throw e;
   }
 }
 public void sendDynamicJad(String msisdn, String imei) throws MSMApplicationException {
   String urlToJad = null;
   try {
     urlToJad = deviceManager.createDynamicJad(msisdn);
     ArrayList<ImeiVO> listoOfDevices = new ArrayList<ImeiVO>();
     ImeiVO imeiVo = new ImeiVO();
     imeiVo.setImei(imei);
     imeiVo.setMsisdn(msisdn);
     listoOfDevices.add(imeiVo);
     if (SmsHandlerFactory.getInstance().hasSmsSupport()) {
       sendLinkSMS(urlToJad, listoOfDevices);
     }
   } catch (MSMApplicationException e) {
     e.printStackTrace();
   }
 }
  public byte[] jadDownload(String msisdn) throws MSMApplicationException {
    deviceManager.createDynamicJad(msisdn);

    if (msisdn.contains("+")) {
      msisdn = msisdn.replace("+", "");
    }
    String jboss_home_dir = System.getProperty("jboss.server.home.dir");
    String deployJadDir = jboss_home_dir + "/deploy/ndg-ota.war/client/dyn/" + msisdn + "/ndg.jad";

    File file = new File(deployJadDir);
    byte[] byteArray = null;
    try {
      byteArray = FileUtil.getBytesFromFile(file);
    } catch (IOException e) {
      e.printStackTrace();
      throw new JadDownloadException();
    }
    return byteArray;
  }
 public void deleteJadDir(String msisdn) throws MSMApplicationException {
   deviceManager.deleteJadDir(msisdn);
 }
  public QueryInputOutputVO listAllDevices(QueryInputOutputVO queryIOVO)
      throws MSMApplicationException {
    QueryInputOutputVO queryIOVOOutput = deviceManager.listAllDevices(queryIOVO);

    return queryIOVOOutput;
  }
 public void updateDevice(DeviceVO deviceVO) throws MSMApplicationException {
   deviceManager.updateDevice(deviceVO);
 }