@Test(expected = IllegalArgumentException.class) public void test_update_parameter_null_parameter() throws Exception{ getParameterRepositoryService().updateParameter(null); }
@Override @Transactional public Parameter updateParameter(Parameter parameter) { if (parameter == null) { throw new RiceIllegalArgumentException("parameter is null"); } final ParameterKey key = ParameterKey.create(parameter.getApplicationId(), parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName()); final Parameter existing = getParameter(key); if (existing == null) { throw new RiceIllegalStateException("the parameter does not exist: " + parameter); } final Parameter toUpdate; if (!existing.getApplicationId().equals(parameter.getApplicationId())) { final Parameter.Builder builder = Parameter.Builder.create(parameter); builder.setApplicationId(existing.getApplicationId()); toUpdate = builder.build(); } else { toUpdate = parameter; } return ParameterBo.to(getDataObjectService().save(ParameterBo.from(toUpdate))); }
ParameterRepositoryServiceImpl implements ParameterRepositoryService { @Override @Transactional public Parameter updateParameter(Parameter parameter) { if (parameter == null) { throw new RiceIllegalArgumentException("parameter is null"); } final ParameterKey key = ParameterKey.create(parameter.getApplicationId(), parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName()); final Parameter existing = getParameter(key); if (existing == null) { throw new RiceIllegalStateException("the parameter does not exist: " + parameter); } final Parameter toUpdate; if (!existing.getApplicationId().equals(parameter.getApplicationId())) { final Parameter.Builder builder = Parameter.Builder.create(parameter); builder.setApplicationId(existing.getApplicationId()); toUpdate = builder.build(); } else { toUpdate = parameter; } return ParameterBo.to(getDataObjectService().save(ParameterBo.from(toUpdate))); } }
ParameterRepositoryServiceImpl implements ParameterRepositoryService { @Override @Transactional public Parameter updateParameter(Parameter parameter) { if (parameter == null) { throw new RiceIllegalArgumentException("parameter is null"); } final ParameterKey key = ParameterKey.create(parameter.getApplicationId(), parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName()); final Parameter existing = getParameter(key); if (existing == null) { throw new RiceIllegalStateException("the parameter does not exist: " + parameter); } final Parameter toUpdate; if (!existing.getApplicationId().equals(parameter.getApplicationId())) { final Parameter.Builder builder = Parameter.Builder.create(parameter); builder.setApplicationId(existing.getApplicationId()); toUpdate = builder.build(); } else { toUpdate = parameter; } return ParameterBo.to(getDataObjectService().save(ParameterBo.from(toUpdate))); }  }
ParameterRepositoryServiceImpl implements ParameterRepositoryService { @Override @Transactional public Parameter updateParameter(Parameter parameter) { if (parameter == null) { throw new RiceIllegalArgumentException("parameter is null"); } final ParameterKey key = ParameterKey.create(parameter.getApplicationId(), parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName()); final Parameter existing = getParameter(key); if (existing == null) { throw new RiceIllegalStateException("the parameter does not exist: " + parameter); } final Parameter toUpdate; if (!existing.getApplicationId().equals(parameter.getApplicationId())) { final Parameter.Builder builder = Parameter.Builder.create(parameter); builder.setApplicationId(existing.getApplicationId()); toUpdate = builder.build(); } else { toUpdate = parameter; } return ParameterBo.to(getDataObjectService().save(ParameterBo.from(toUpdate))); }  @Override @Transactional Parameter createParameter(Parameter parameter); @Override @Transactional Parameter updateParameter(Parameter parameter); @Override Parameter getParameter(ParameterKey key); @Override String getParameterValueAsString(ParameterKey key); @Override Boolean getParameterValueAsBoolean(ParameterKey key); @Override Collection<String> getParameterValuesAsString(ParameterKey key); @Override String getSubParameterValueAsString(ParameterKey key, String subParameterName); @Override Collection<String> getSubParameterValuesAsString(ParameterKey key, String subParameterName); @Override ParameterQueryResults findParameters(QueryByCriteria queryByCriteria); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService); }
ParameterRepositoryServiceImpl implements ParameterRepositoryService { @Override @Transactional public Parameter updateParameter(Parameter parameter) { if (parameter == null) { throw new RiceIllegalArgumentException("parameter is null"); } final ParameterKey key = ParameterKey.create(parameter.getApplicationId(), parameter.getNamespaceCode(), parameter.getComponentCode(), parameter.getName()); final Parameter existing = getParameter(key); if (existing == null) { throw new RiceIllegalStateException("the parameter does not exist: " + parameter); } final Parameter toUpdate; if (!existing.getApplicationId().equals(parameter.getApplicationId())) { final Parameter.Builder builder = Parameter.Builder.create(parameter); builder.setApplicationId(existing.getApplicationId()); toUpdate = builder.build(); } else { toUpdate = parameter; } return ParameterBo.to(getDataObjectService().save(ParameterBo.from(toUpdate))); }  @Override @Transactional Parameter createParameter(Parameter parameter); @Override @Transactional Parameter updateParameter(Parameter parameter); @Override Parameter getParameter(ParameterKey key); @Override String getParameterValueAsString(ParameterKey key); @Override Boolean getParameterValueAsBoolean(ParameterKey key); @Override Collection<String> getParameterValuesAsString(ParameterKey key); @Override String getSubParameterValueAsString(ParameterKey key, String subParameterName); @Override Collection<String> getSubParameterValuesAsString(ParameterKey key, String subParameterName); @Override ParameterQueryResults findParameters(QueryByCriteria queryByCriteria); DataObjectService getDataObjectService(); @Required void setDataObjectService(DataObjectService dataObjectService);  }