package td2jira.sync.impl;

import org.apache.log4j.Logger;

import td2jira.jira.IJIRAConnector;
import td2jira.jira.JIRAIssue;
import td2jira.td.ITDConnector;
import td2jira.td.api.IBug;

public class MarkTdIssueAsFixed implements IProcessIssuePair {
	private static Logger logger = Logger.getLogger(MarkTdIssueAsFixed.class);
	private IJIRAConnector jiraConnector;
	private ITDConnector tdConnector;
	
	public void setJiraConnector(IJIRAConnector jiraConnector) {
		this.jiraConnector = jiraConnector;
	}

	public void setTdConnector(ITDConnector tdConnector) {
		this.tdConnector = tdConnector;
	}

	public ProcessingResult process(JIRAIssue jiraIssue,IBug tdIssue) throws Exception {
		logger.info("marking TD "+tdIssue.getId()+" as Fixed");
		tdConnector.lockIssue(tdIssue);
		tdIssue.setStatus("Fixed");
		tdConnector.updateIssue(tdIssue);
		return ProcessingResult.PROCESS_NEXT_ISSUE;
	}
}
