@RequestMapping(value = "/{cid}", consumes = "application/json", method = RequestMethod.DELETE)
 @Override
 public HttpEntity<ResponseBean> delete(@PathVariable("cid") String entity)
     throws SpartanPersistenceException, Exception {
   ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK;
   try {
     communicationGrouprepo.delete(entity);
     httpStatus = org.springframework.http.HttpStatus.NO_CONTENT;
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not delete", e.getCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }
Ejemplo n.º 2
0
 @RequestMapping(consumes = "application/json", method = RequestMethod.PUT)
 @Override
 public HttpEntity<ResponseBean> update(@RequestBody Taluka entity)
     throws SpartanPersistenceException, SpartanTransactionException, Exception {
   ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK;
   try {
     talukarepo.update(entity);
     responseBean.add("success", true);
     responseBean.add("message", "Successfully updated ");
     responseBean.add("data", entity._getPrimarykey().toString());
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not update", e.getRootCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }
 @RequestMapping(value = "/{cid}", consumes = "application/json", method = RequestMethod.DELETE)
 @Override
 public HttpEntity<ResponseBean> delete(@PathVariable("cid") String entity)
     throws SpartanPersistenceException, SpartanTransactionException, Exception {
   ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK;
   try {
     userAccessDomainrepo.delete(entity);
     httpStatus = org.springframework.http.HttpStatus.OK;
     responseBean.add("success", true);
     responseBean.add("message", "Successfully deleted ");
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not delete", e.getRootCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }
Ejemplo n.º 4
0
 @RequestMapping(value = "/findById", method = RequestMethod.POST)
 @Override
 public HttpEntity<ResponseBean> findById(@RequestBody FindByBean findByBean)
     throws SpartanPersistenceException, Exception {
   com.athena.framework.server.bean.ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK;
   try {
     project1.app.shared.location.Taluka lsttaluka =
         talukarepo.findById((String) findByBean.getFindKey());
     responseBean.add("success", true);
     responseBean.add("message", "Successfully retrived ");
     responseBean.add("data", lsttaluka);
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not find ID", e.getRootCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }
 @RequestMapping(consumes = "application/json", method = RequestMethod.POST)
 @Override
 public HttpEntity<ResponseBean> save(@RequestBody CommunicationType entity)
     throws SpartanPersistenceException, SpartanTransactionException, Exception {
   ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.CREATED;
   try {
     communicationTyperepo.save(entity);
     responseBean.add("success", true);
     responseBean.add("message", "Successfully Created");
     responseBean.add("data", entity);
     httpStatus = org.springframework.http.HttpStatus.CREATED;
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not save", e.getRootCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }
 @RequestMapping(value = "/findByRelationCode", method = RequestMethod.POST)
 @Override
 public HttpEntity<ResponseBean> findByRelationCode(@RequestBody FindByBean findByBean)
     throws SpartanPersistenceException, Exception {
   com.athena.framework.server.bean.ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK;
   try {
     List<com.app.shared.issuetrackerboundedcontext.issuetracker.IssueRelation> lstissuerelation =
         issueRelationrepo.findByRelationCode((java.lang.String) findByBean.getFindKey());
     responseBean.add("success", true);
     responseBean.add("message", "Successfully retrived ");
     responseBean.add("data", lstissuerelation);
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not find ID", e.getRootCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }
 @RequestMapping(value = "/findByInputTypeId", method = RequestMethod.POST)
 @Override
 public HttpEntity<ResponseBean> findByInputTypeId(@RequestBody FindByBean findByBean)
     throws SpartanPersistenceException, Exception {
   com.athena.framework.server.bean.ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK;
   try {
     List<singx.app.shared.singx.CfgMasterAddress> lstcfgmasteraddress =
         cfgMasterAddressrepo.findByInputTypeId((java.lang.Integer) findByBean.getFindKey());
     responseBean.add("success", true);
     responseBean.add("message", "Successfully retrived ");
     responseBean.add("data", lstcfgmasteraddress);
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not find ID", e.getCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }
  public void insert(List<InvoicedOrderLine> invoicedOrderLines) throws BillingServiceException {
    TransactionCallback<Integer> insertInvoicedOrderLines =
        new InsertInvoicedOrderLines(invoicedOrderLines, invoiceCreatedAx);
    Integer returnValue;

    try {
      returnValue = transactionTemplate.execute(insertInvoicedOrderLines);
    } catch (TransactionException es) {
      // this could happen, for instance, if the db is unreachable. Therefore throw an integration
      // disturbance
      throw BillingServiceException.createIntegrationDisturbance(es.getMessage());
    }

    if (returnValue == DB_FUNCTION_ERROR_CODE) {
      throw BillingServiceException.createBugDisturbance(
          "BUG_DISTURBANCE : Error when inserting invoiced order lines: "
              + ((InsertInvoicedOrderLines) insertInvoicedOrderLines).getFailedOrderLine());
    }
  }
 private void doFirstTimeFilter(
     ServletRequest request, ServletResponse response, FilterChain chain)
     throws IOException, ServletException {
   request.setAttribute(TRANSACTION_FILTER_MARKER_ATTRIBUTE, TRANSACTION_FILTER_MARKER_ATTRIBUTE);
   ApplicationContext ctx =
       WebApplicationContextUtils.getWebApplicationContext(request.getServletContext());
   PlatformTransactionManager txManager =
       (PlatformTransactionManager) ctx.getBean("transactionManager");
   TransactionAttribute def =
       new DefaultTransactionAttribute(TransactionDefinition.PROPAGATION_REQUIRED);
   TransactionStatus tx = null;
   try {
     tx = txManager.getTransaction(def);
   } catch (TransactionException txe) {
     logger.error("FATAL: not able to start a transaction to service this request.");
     throw new ServletException(txe);
   }
   try {
     chain.doFilter(request, response);
   } catch (Exception e) {
     logger.error(
         "Exception occurred servicing this request, rolling back the current transaction...");
     try {
       txManager.rollback(tx);
     } catch (TransactionException txe) {
       logger.error(
           "Exception occurred rolling back the current transaction: " + txe.getMessage());
     }
     throw new ServletException(e);
   } finally {
     if (!tx.isCompleted()) {
       try {
         txManager.commit(tx);
       } catch (TransactionException txe) {
         logger.error(
             "Exception occurred committing the current transaction: " + txe.getMessage());
         throw new ServletException(txe);
       }
     }
   }
 }
Ejemplo n.º 10
0
 @RequestMapping(
     consumes = "application/json",
     headers = {"isArray"},
     method = RequestMethod.PUT)
 @Override
 public HttpEntity<ResponseBean> update(
     @RequestBody List<Taluka> entity, @RequestHeader("isArray") boolean request)
     throws SpartanPersistenceException, SpartanTransactionException, Exception {
   ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK;
   try {
     talukarepo.update(entity);
     responseBean.add("success", true);
     responseBean.add("message", "Successfully updated entities");
     httpStatus = org.springframework.http.HttpStatus.OK;
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not update", e.getRootCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }
 @RequestMapping(
     consumes = "application/json",
     headers = {"isArray"},
     method = RequestMethod.POST)
 @Override
 public HttpEntity<ResponseBean> save(
     @RequestBody List<CfgMasterAddress> entity, @RequestHeader("isArray") boolean request)
     throws SpartanPersistenceException, Exception {
   ResponseBean responseBean = new ResponseBean();
   org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.CREATED;
   try {
     cfgMasterAddressrepo.save(entity);
     responseBean.add("success", true);
     responseBean.add("message", "Successfully Created");
     httpStatus = org.springframework.http.HttpStatus.CREATED;
   } catch (org.springframework.transaction.TransactionException e) {
     throw new com.athena.framework.server.exception.repository.SpartanTransactionException(
         "can not save", e.getCause());
   }
   return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus);
 }