@Test(expected = IllegalArgumentException.class) public void test_updateKewType_null_input() { getKewTypeBoService().updateKewType(null); }
@Override public void updateKewType(KewTypeDefinition kewType) { if (kewType == null) { throw new RiceIllegalArgumentException("kewType is null"); } final String idKey = kewType.getId(); final KewTypeBo existing = dataObjectService.find(KewTypeBo.class, idKey); if (existing == null) { throw new RiceIllegalStateException("The KEW type does not exist: " + kewType); } final KewTypeDefinition toUpdate; if (!existing.getId().equals(kewType.getId())){ final KewTypeDefinition.Builder builder = KewTypeDefinition.Builder.create(kewType); builder.setId(existing.getId()); toUpdate = builder.build(); } else { toUpdate = kewType; } dataObjectService.save(KewTypeBo.from(toUpdate)); }
KewTypeBoServiceImpl implements KewTypeRepositoryService { @Override public void updateKewType(KewTypeDefinition kewType) { if (kewType == null) { throw new RiceIllegalArgumentException("kewType is null"); } final String idKey = kewType.getId(); final KewTypeBo existing = dataObjectService.find(KewTypeBo.class, idKey); if (existing == null) { throw new RiceIllegalStateException("The KEW type does not exist: " + kewType); } final KewTypeDefinition toUpdate; if (!existing.getId().equals(kewType.getId())){ final KewTypeDefinition.Builder builder = KewTypeDefinition.Builder.create(kewType); builder.setId(existing.getId()); toUpdate = builder.build(); } else { toUpdate = kewType; } dataObjectService.save(KewTypeBo.from(toUpdate)); } }
KewTypeBoServiceImpl implements KewTypeRepositoryService { @Override public void updateKewType(KewTypeDefinition kewType) { if (kewType == null) { throw new RiceIllegalArgumentException("kewType is null"); } final String idKey = kewType.getId(); final KewTypeBo existing = dataObjectService.find(KewTypeBo.class, idKey); if (existing == null) { throw new RiceIllegalStateException("The KEW type does not exist: " + kewType); } final KewTypeDefinition toUpdate; if (!existing.getId().equals(kewType.getId())){ final KewTypeDefinition.Builder builder = KewTypeDefinition.Builder.create(kewType); builder.setId(existing.getId()); toUpdate = builder.build(); } else { toUpdate = kewType; } dataObjectService.save(KewTypeBo.from(toUpdate)); }  }
KewTypeBoServiceImpl implements KewTypeRepositoryService { @Override public void updateKewType(KewTypeDefinition kewType) { if (kewType == null) { throw new RiceIllegalArgumentException("kewType is null"); } final String idKey = kewType.getId(); final KewTypeBo existing = dataObjectService.find(KewTypeBo.class, idKey); if (existing == null) { throw new RiceIllegalStateException("The KEW type does not exist: " + kewType); } final KewTypeDefinition toUpdate; if (!existing.getId().equals(kewType.getId())){ final KewTypeDefinition.Builder builder = KewTypeDefinition.Builder.create(kewType); builder.setId(existing.getId()); toUpdate = builder.build(); } else { toUpdate = kewType; } dataObjectService.save(KewTypeBo.from(toUpdate)); }  @Override KewTypeDefinition createKewType(KewTypeDefinition kewType); @Override void updateKewType(KewTypeDefinition kewType); @Override KewTypeDefinition getTypeById(final String id); @Override KewTypeDefinition getTypeByNameAndNamespace(final String name, final String namespace); @Override List<KewTypeDefinition> findAllTypesByNamespace(final String namespace); @Override List<KewTypeDefinition> findAllTypes(); void setDataObjectService(final DataObjectService dataObjectService); @Override void createKewTypeAttribute(KewTypeAttribute kewTypeAttribute); @Override void updateKewTypeAttribute(KewTypeAttribute kewTypeAttribute); }
KewTypeBoServiceImpl implements KewTypeRepositoryService { @Override public void updateKewType(KewTypeDefinition kewType) { if (kewType == null) { throw new RiceIllegalArgumentException("kewType is null"); } final String idKey = kewType.getId(); final KewTypeBo existing = dataObjectService.find(KewTypeBo.class, idKey); if (existing == null) { throw new RiceIllegalStateException("The KEW type does not exist: " + kewType); } final KewTypeDefinition toUpdate; if (!existing.getId().equals(kewType.getId())){ final KewTypeDefinition.Builder builder = KewTypeDefinition.Builder.create(kewType); builder.setId(existing.getId()); toUpdate = builder.build(); } else { toUpdate = kewType; } dataObjectService.save(KewTypeBo.from(toUpdate)); }  @Override KewTypeDefinition createKewType(KewTypeDefinition kewType); @Override void updateKewType(KewTypeDefinition kewType); @Override KewTypeDefinition getTypeById(final String id); @Override KewTypeDefinition getTypeByNameAndNamespace(final String name, final String namespace); @Override List<KewTypeDefinition> findAllTypesByNamespace(final String namespace); @Override List<KewTypeDefinition> findAllTypes(); void setDataObjectService(final DataObjectService dataObjectService); @Override void createKewTypeAttribute(KewTypeAttribute kewTypeAttribute); @Override void updateKewTypeAttribute(KewTypeAttribute kewTypeAttribute);  }