package info.elexis.server.elexis.common.types;

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class LockResponse {

	public static final LockResponse OK = new LockResponse(Status.OK, null);
	public static final LockResponse ERROR = new LockResponse(Status.ERROR, null);
	
	public enum Status{
		OK, DENIED, ERROR
	};

	private Status status;
	private LockInfo lockInfo;

	public LockResponse() {
		status = Status.OK;
	}

	public LockResponse(Status status, LockInfo lockInfo) {
		this.status = status;
		this.lockInfo = lockInfo;
	}

	public Status getStatus() {
		return status;
	}

	public void setStatus(Status status) {
		this.status = status;
	}

	/**
	 * @return if {@link #getStatus()} {@link Status#DENIED} contains the
	 *         {@link LockInfo} the request failed upon, else <code>null</code>
	 */
	public LockInfo getLockInfos() {
		return lockInfo;
	}

	public void setLockInfos(LockInfo lockInfo) {
		this.lockInfo = lockInfo;
	}

	public static LockResponse OK() {
		return new LockResponse();
	}

	public static LockResponse DENIED(LockInfo lie) {
		return new LockResponse(Status.DENIED, lie);
	}

	public boolean isOk() {
		return getStatus()==Status.OK;
	}
}

@@ -327,16 +327,34 @@
  DENIED,
+ DENIED_PERMANENT,
  ERROR%0A%09

Add LockResponse.Status.DENIED_PERMANENT