All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.jlot.client.executor.DeleteCommandExecutor Maven / Gradle / Ivy

There is a newer version: 1.2
Show newest version
package org.jlot.client.executor;

import java.util.Properties;

import javax.inject.Inject;

import org.jlot.client.configuration.Console;
import org.jlot.client.configuration.ProjectConfiguration;
import org.jlot.client.executor.spi.AbstractCommandExecutor;
import org.jlot.client.remote.ProjectDeleteRestCommand;
import org.jlot.client.remote.rest.RestException;
import org.jlot.core.form.ProjectForm;
import org.jlot.core.utils.VersionResolver;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

@Component
public class DeleteCommandExecutor extends AbstractCommandExecutor
{
	private Logger						log	= LoggerFactory.getLogger(DeleteCommandExecutor.class);

	@Inject
	private ProjectConfiguration		projectConfiguration;

	@Inject
	private ProjectDeleteRestCommand	projectDeleteRestCommand;

	@Inject
	private Console						console;

	@Inject
	private VersionResolver				versionResolver;

	@Override
	public boolean executeInternal ( Properties properties ) throws RestException
	{
		String messageCode = "form.projectDelete.intro.api";
		String projectName = projectConfiguration.getProjectName();
		String serverUrl = projectConfiguration.getServerUrl();
		console.sure(messageCode, projectName, serverUrl);
		ProjectForm form = new ProjectForm();
		form.setName(projectName);
		form.setJlotClientVersion(versionResolver.getJlotVersionName());

		projectDeleteRestCommand.execute(form);
		log.info("Project '{}' was deleted on {}", projectName, serverUrl);
		return true;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy