@Test public void test2Update() { try { org.junit.Assert.assertNotNull(map.get("AddressTypePrimaryKey")); AddressType addresstype = addresstypeRepository.findById((java.lang.String) map.get("AddressTypePrimaryKey")); addresstype.setAddressType("z5ft8OXUBGrY8zsOyexv3q7bT0zc4tRycSAxYAn4mgkxTQLtAa"); addresstype.setAddressTypeDesc("AEukh8ClRChVbnezxiPtcq028dn9KUFbzI4pov5fcXHQxcT8IG"); addresstype.setAddressTypeIcon("fFw4pra2cmu4PfDyzrUZwaIe51Xp7r5O0SRnkXvR915EWPX9Lc"); addresstype.setVersionId(1); addresstype.setEntityAudit(1, "xyz", RECORD_TYPE.UPDATE); addresstypeRepository.update(addresstype); } catch (com.athena.framework.server.exception.repository.SpartanPersistenceException e) { org.junit.Assert.fail(e.getMessage()); } catch (java.lang.Exception e) { org.junit.Assert.fail(e.getMessage()); } }
@Test public void test4Delete() { try { org.junit.Assert.assertNotNull(map.get("AddressTypePrimaryKey")); addresstypeRepository.delete((java.lang.String) map.get("AddressTypePrimaryKey")); } catch (com.athena.framework.server.exception.repository.SpartanPersistenceException e) { org.junit.Assert.fail(e.getMessage()); } catch (Exception e) { org.junit.Assert.fail(e.getMessage()); } }
@RequestMapping(value = "/findAll", consumes = "application/json", method = RequestMethod.GET) @Override public HttpEntity<ResponseBean> findAll() throws SpartanPersistenceException, Exception { ResponseBean responseBean = new ResponseBean(); org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK; java.util.List<shop.app.shared.location.AddressType> lstaddresstype = addressTyperepo.findAll(); responseBean.add("success", true); responseBean.add("message", "Successfully retrived "); responseBean.add("data", lstaddresstype); return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus); }
@RequestMapping(value = "/search", consumes = "application/json", method = RequestMethod.POST) @Override public HttpEntity<ResponseBean> search(@RequestBody Map<String, Object> fieldData) throws SpartanPersistenceException, Exception { ResponseBean responseBean = new ResponseBean(); org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK; List<java.lang.Object> lstaddresstype = addressTyperepo.search("AddressType.DefaultFinders", fieldData, getFieldMetaData()); responseBean.add("success", true); responseBean.add("message", "Successfully retrived "); responseBean.add("data", lstaddresstype); 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 { addressTyperepo.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); }
@RequestMapping(consumes = "application/json", method = RequestMethod.PUT) @Override public HttpEntity<ResponseBean> update(@RequestBody AddressType entity) throws SpartanPersistenceException, SpartanTransactionException, Exception { ResponseBean responseBean = new ResponseBean(); org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.OK; try { addressTyperepo.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); }
@Test public void test1Save() { try { AddressType addresstype = new AddressType(); addresstype.setAddressType("8P6pnOc7c3U208sBDBpw7ZJynZPginggQ77arJXc65xauXHbjh"); addresstype.setAddressTypeDesc("AoifH1KwQh1jzxktbIUYzNbr4XxHnzwFxPXalnRnfJ6jC9PRKY"); addresstype.setAddressTypeIcon("8xFEwKaxtIGJXbqFAiuxcw3OffBvYvPT1ZD0HPR03DMjTuqpIa"); addresstype.setEntityAudit(1, "xyz", RECORD_TYPE.ADD); addresstype.setEntityValidator(entityValidator); addresstype.isValid(); addresstypeRepository.save(addresstype); map.put("AddressTypePrimaryKey", addresstype._getPrimarykey()); } catch (com.athena.framework.server.exception.biz.SpartanConstraintViolationException e) { org.junit.Assert.fail(e.getMessage()); } catch (java.lang.Exception e) { org.junit.Assert.fail(e.getMessage()); } }
@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 { shop.app.shared.location.AddressType lstaddresstype = addressTyperepo.findById((String) findByBean.getFindKey()); responseBean.add("success", true); responseBean.add("message", "Successfully retrived "); responseBean.add("data", lstaddresstype); } 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", headers = {"isArray"}, method = RequestMethod.POST) @Override public HttpEntity<ResponseBean> save( @RequestBody List<AddressType> entity, @RequestHeader("isArray") boolean request) throws SpartanPersistenceException, SpartanTransactionException, Exception { ResponseBean responseBean = new ResponseBean(); org.springframework.http.HttpStatus httpStatus = org.springframework.http.HttpStatus.CREATED; try { addressTyperepo.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.getRootCause()); } return new org.springframework.http.ResponseEntity<ResponseBean>(responseBean, httpStatus); }