test_class.declarator: DOUBLE_TOLERANCE = .0000000001
test_class.modifier: private static final
test_class.original_string: private static final double DOUBLE_TOLERANCE = .0000000001;
test_class.type: double
test_class.var_name: DOUBLE_TOLERANCE
test_class.declarator: LAYER_ID = "countries"
test_class.modifier: private static final
test_class.original_string: private static final String LAYER_ID = "countries";
test_class.type: String
test_class.var_name: LAYER_ID
test_class.declarator: CRS = "EPSG:4326"
test_class.modifier: private static final
test_class.original_string: private static final String CRS = "EPSG:4326";
test_class.type: String
test_class.var_name: CRS
test_class.declarator: dispatcher
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private CommandDispatcher dispatcher;
test_class.type: CommandDispatcher
test_class.var_name: dispatcher
test_class.declarator: geoService
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private GeoService geoService;
test_class.type: GeoService
test_class.var_name: geoService
test_class.declarator: dtoConverter
test_class.modifier: @Autowired
  	private
test_class.original_string: @Autowired
  	private DtoConverterService dtoConverter;
test_class.type: DtoConverterService
test_class.var_name: dtoConverter
test_class.declarator: securityRule
test_class.modifier: @Autowired
  	@Rule
  	public
test_class.original_string: @Autowired
  	@Rule
  	public SecurityRule securityRule;
test_class.type: SecurityRule
test_class.var_name: securityRule
test_class.file: command/src/test/java/org/geomajas/command/feature/PersistTransactionCommandTest.java
test_class.identifier: PersistTransactionCommandTest
test_case.body: @Test
  	@DirtiesContext // adding a bean with empty context if the test fails
  	public void testCreateWithoutGeometry() throws Exception {
  		PersistTransactionRequest request = new PersistTransactionRequest();
  		request.setCrs(CRS);
  		FeatureTransaction featureTransaction = new FeatureTransaction();
  		featureTransaction.setLayerId(LAYER_ID);
  		Feature feature = new Feature();
  		featureTransaction.setNewFeatures(new Feature[] {feature});
  		request.setFeatureTransaction(featureTransaction);
  		PersistTransactionResponse response = (PersistTransactionResponse) dispatcher.execute(
  				PersistTransactionRequest.COMMAND, request, null, "en");
  		assertThat(response.isError()).isTrue();
  		Throwable error = response.getErrors().get(0);
  		assertThat(error).isInstanceOf(LayerException.class);
  		assertThat(((LayerException) error).getExceptionCode()).isEqualTo(
  				ExceptionCode.LAYER_EMPTY_GEOMETRY_NOT_ALLOWED);
  		/*
  		if (response.isError()) {
  			response.getErrors().get(0).printStackTrace();
  		}
  		Assert.assertFalse(response.isError());
  		Assert.assertNotNull(response.getFeatureTransaction());
  		Feature[] newFeatures = response.getFeatureTransaction().getNewFeatures();
  		assertThat(newFeatures.length).isEqualTo(1);
  		assertThat(newFeatures[0].getId()).isNotNull();
  		assertThat(newFeatures[0].getGeometry()).isNotNull();
  		*/
  	}
test_case.class_method_signature: PersistTransactionCommandTest.testCreateWithoutGeometry()
test_case.full_signature: @Test @DirtiesContext // adding a bean with empty context if the test fails public void testCreateWithoutGeometry()
test_case.identifier: testCreateWithoutGeometry
test_case.invocations: setCrs setLayerId setNewFeatures setFeatureTransaction execute isTrue assertThat isError get getErrors isInstanceOf assertThat isEqualTo assertThat getExceptionCode
test_case.modifiers: @Test @DirtiesContext // adding a bean with empty context if the test fails public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreateWithoutGeometry()
focal_class.declarator: geoService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private GeoService geoService;
focal_class.type: GeoService
focal_class.var_name: geoService
focal_class.declarator: converter
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private DtoConverterService converter;
focal_class.type: DtoConverterService
focal_class.var_name: converter
focal_class.declarator: layerService
focal_class.modifier: @Autowired
  	private
focal_class.original_string: @Autowired
  	private VectorLayerService layerService;
focal_class.type: VectorLayerService
focal_class.var_name: layerService
focal_class.file: command/src/main/java/org/geomajas/command/feature/PersistTransactionCommand.java
focal_class.identifier: PersistTransactionCommand
focal_class.interfaces: implements CommandHasRequest<PersistTransactionRequest, PersistTransactionResponse>
focal_class.class_method_signature: PersistTransactionCommand.getEmptyCommandRequest()
focal_class.full_signature: @Override public PersistTransactionRequest getEmptyCommandRequest()
focal_class.identifier: getEmptyCommandRequest
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: PersistTransactionRequest
focal_class.signature: PersistTransactionRequest getEmptyCommandRequest()
focal_class.class_method_signature: PersistTransactionCommand.getEmptyCommandResponse()
focal_class.full_signature: @Override public PersistTransactionResponse getEmptyCommandResponse()
focal_class.identifier: getEmptyCommandResponse
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: PersistTransactionResponse
focal_class.signature: PersistTransactionResponse getEmptyCommandResponse()
focal_class.class_method_signature: PersistTransactionCommand.execute(PersistTransactionRequest request, PersistTransactionResponse response)
focal_class.full_signature: @Override public void execute(PersistTransactionRequest request, PersistTransactionResponse response)
focal_class.identifier: execute
focal_class.modifiers: @Override public
focal_class.parameters: (PersistTransactionRequest request, PersistTransactionResponse response)
focal_class.return: void
focal_class.signature: void execute(PersistTransactionRequest request, PersistTransactionResponse response)
focal_method.body: @Override
  	public void execute(PersistTransactionRequest request, PersistTransactionResponse response) throws Exception {
  		if (null == request.getFeatureTransaction()) {
  			throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "featureTransaction");
  		}
  		if (null == request.getFeatureTransaction().getLayerId()) {
  			throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "featureTransaction.layerId");
  		}
  		if (null == request.getCrs()) {
  			throw new GeomajasException(ExceptionCode.PARAMETER_MISSING, "crs");
  		}
  		FeatureTransaction featureTransaction = request.getFeatureTransaction();
  		if (featureTransaction == null) {
  			return;
  		}
  
  		List<InternalFeature> oldFeatures = new ArrayList<InternalFeature>();
  		List<InternalFeature> newFeatures = new ArrayList<InternalFeature>();
  		if (featureTransaction.getOldFeatures() != null) {
  			for (int i = 0; i < featureTransaction.getOldFeatures().length; i++) {
  				oldFeatures.add(converter.toInternal(featureTransaction.getOldFeatures()[i]));
  			}
  		}
  		if (featureTransaction.getNewFeatures() != null) {
  			for (int i = 0; i < featureTransaction.getNewFeatures().length; i++) {
  				newFeatures.add(converter.toInternal(featureTransaction.getNewFeatures()[i]));
  			}
  		}
  
  		layerService.saveOrUpdate(featureTransaction.getLayerId(), geoService.getCrs(request.getCrs()), oldFeatures,
  				newFeatures);
  
  		// Apply the new set of InternalFeatures onto the transaction: (ID may be filled in now)
  		if (featureTransaction.getNewFeatures() != null) {
  			Feature[] resultFeatures = new Feature[newFeatures.size()];
  			for (int i = 0; i < newFeatures.size(); i++) {
  				InternalFeature internalFeature = newFeatures.get(i);
  				resultFeatures[i] = converter.toDto(internalFeature);
  			}
  			featureTransaction.setNewFeatures(resultFeatures);
  		}
  		response.setFeatureTransaction(featureTransaction);
  	}
focal_method.class_method_signature: PersistTransactionCommand.execute(PersistTransactionRequest request, PersistTransactionResponse response)
focal_method.full_signature: @Override public void execute(PersistTransactionRequest request, PersistTransactionResponse response)
focal_method.identifier: execute
focal_method.invocations: getFeatureTransaction getLayerId getFeatureTransaction getCrs getFeatureTransaction getOldFeatures getOldFeatures add toInternal getOldFeatures getNewFeatures getNewFeatures add toInternal getNewFeatures saveOrUpdate getLayerId getCrs getCrs getNewFeatures size size get toDto setNewFeatures setFeatureTransaction
focal_method.modifiers: @Override public
focal_method.parameters: (PersistTransactionRequest request, PersistTransactionResponse response)
focal_method.return: void
focal_method.signature: void execute(PersistTransactionRequest request, PersistTransactionResponse response)