/*
 * This is part of Geomajas, a GIS framework, http://www.geomajas.org/.
 *
 * Copyright 2008-2013 Geosparc nv, http://www.geosparc.com/, Belgium.
 *
 * The program is available in open source according to the GNU Affero
 * General Public License. All contributions in this program are covered
 * by the Geomajas Contributors License Agreement. For full licensing
 * details, see LICENSE.txt in the project root.
 */
package org.geomajas.plugin.deskmanager.command.manager;

import org.geomajas.command.Command;
import org.geomajas.plugin.deskmanager.command.manager.dto.CheckGeodeskIdExistsRequest;
import org.geomajas.plugin.deskmanager.command.manager.dto.CheckGeodeskIdExistsResponse;
import org.geomajas.plugin.deskmanager.service.common.GeodeskService;
import org.geomajas.security.GeomajasSecurityException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;

/**
 * Command that checks if a geodesk id already exists in the database. Typically called when an administrator
 * tries to override a geodesk id in the management interface.
 * 
 * @author Oliver May
 * @author Kristof Heirwegh
 */
@Component(/*CheckGeodeskIdExistsRequest.COMMAND*/)
@Transactional(readOnly = true)
public class CheckGeodeskIdExistsCommand implements Command<CheckGeodeskIdExistsRequest, CheckGeodeskIdExistsResponse> {

	@Autowired
	private GeodeskService geodeskService;

	/** {@inheritDoc} */
	public void execute(CheckGeodeskIdExistsRequest request, CheckGeodeskIdExistsResponse response)
			throws GeomajasSecurityException {
		response.setExists(geodeskService.geodeskIdExists(request.getGeodeskId()));
	}

	/** {@inheritDoc} */
	public CheckGeodeskIdExistsResponse getEmptyCommandResponse() {
		return new CheckGeodeskIdExistsResponse();
	}

}

@@ -1101,19 +1101,16 @@
 istrator
-%0A *
  tries t
@@ -1110,16 +1110,19 @@
 tries to
+%0A *
  overrid
@@ -1234,18 +1234,16 @@
 mponent(
-/*
 CheckGeo
@@ -1269,18 +1269,16 @@
 .COMMAND
-*/
 )%0A@Trans

make command names more unique GDM-12: unit test assertion order