@Test(expected = IllegalArgumentException.class) public void test_createKewType_null_input() { getKewTypeBoService().createKewType(null); }
@Override public KewTypeDefinition createKewType(KewTypeDefinition kewType) { if (kewType == null){ throw new RiceIllegalArgumentException("kewType is null"); } final String nameKey = kewType.getName(); final String namespaceKey = kewType.getNamespace(); final KewTypeDefinition existing = getTypeByNameAndNamespace(nameKey, namespaceKey); if (existing != null && existing.getName().equals(nameKey) && existing.getNamespace().equals(namespaceKey)){ throw new RiceIllegalStateException("The KEW Type to create already exists: " + kewType); } KewTypeBo bo = dataObjectService.save(KewTypeBo.from(kewType)); return KewTypeBo.to(bo); }
KewTypeBoServiceImpl implements KewTypeRepositoryService { @Override public KewTypeDefinition createKewType(KewTypeDefinition kewType) { if (kewType == null){ throw new RiceIllegalArgumentException("kewType is null"); } final String nameKey = kewType.getName(); final String namespaceKey = kewType.getNamespace(); final KewTypeDefinition existing = getTypeByNameAndNamespace(nameKey, namespaceKey); if (existing != null && existing.getName().equals(nameKey) && existing.getNamespace().equals(namespaceKey)){ throw new RiceIllegalStateException("The KEW Type to create already exists: " + kewType); } KewTypeBo bo = dataObjectService.save(KewTypeBo.from(kewType)); return KewTypeBo.to(bo); } }
KewTypeBoServiceImpl implements KewTypeRepositoryService { @Override public KewTypeDefinition createKewType(KewTypeDefinition kewType) { if (kewType == null){ throw new RiceIllegalArgumentException("kewType is null"); } final String nameKey = kewType.getName(); final String namespaceKey = kewType.getNamespace(); final KewTypeDefinition existing = getTypeByNameAndNamespace(nameKey, namespaceKey); if (existing != null && existing.getName().equals(nameKey) && existing.getNamespace().equals(namespaceKey)){ throw new RiceIllegalStateException("The KEW Type to create already exists: " + kewType); } KewTypeBo bo = dataObjectService.save(KewTypeBo.from(kewType)); return KewTypeBo.to(bo); }  }
KewTypeBoServiceImpl implements KewTypeRepositoryService { @Override public KewTypeDefinition createKewType(KewTypeDefinition kewType) { if (kewType == null){ throw new RiceIllegalArgumentException("kewType is null"); } final String nameKey = kewType.getName(); final String namespaceKey = kewType.getNamespace(); final KewTypeDefinition existing = getTypeByNameAndNamespace(nameKey, namespaceKey); if (existing != null && existing.getName().equals(nameKey) && existing.getNamespace().equals(namespaceKey)){ throw new RiceIllegalStateException("The KEW Type to create already exists: " + kewType); } KewTypeBo bo = dataObjectService.save(KewTypeBo.from(kewType)); return KewTypeBo.to(bo); }  @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 KewTypeDefinition createKewType(KewTypeDefinition kewType) { if (kewType == null){ throw new RiceIllegalArgumentException("kewType is null"); } final String nameKey = kewType.getName(); final String namespaceKey = kewType.getNamespace(); final KewTypeDefinition existing = getTypeByNameAndNamespace(nameKey, namespaceKey); if (existing != null && existing.getName().equals(nameKey) && existing.getNamespace().equals(namespaceKey)){ throw new RiceIllegalStateException("The KEW Type to create already exists: " + kewType); } KewTypeBo bo = dataObjectService.save(KewTypeBo.from(kewType)); return KewTypeBo.to(bo); }  @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);  }