%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ page trimDirectiveWhitespaces="true" %>
<%@ page import="org.crosswire.utils.Sessions" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Regularization.RegularizationRule" %>
<%@ page import="org.crosswire.community.projects.ntmss.data.Regularization" %>
<%@ page import="org.crosswire.sword.keys.VerseKey" %>
<%@ page import="org.crosswire.xml.XMLBlock" %>
<%@ page import="org.crosswire.webtools.annotation.*" %>
<%@ page import="javax.validation.constraints.NotNull" %>
<%@ page import="org.crosswire.webtools.*" %>
<%!
@Description(value = "Deletes an exception for a global regularization rule.", name = "regularization/deleteexception")
public static class MyParameters extends Parameters {
@NotNull
@Description(value = "regularization rule id to modify. if not provided, a new regularization rule will be created.", example = "32")
public Integer regID;
@Description(value = "owner of the regularization rule exception", example = "joe")
public String userName;
@Description(value = "group name to assign rule exception to", example = "ECM Matthew")
public String groupName;
@NotNull
@Description(value = "context verse", example = "Jn.2.2")
public String verse;
@Override
protected void customValidation() {
if (getUser() == null) {
addError(-5, "Must be logged in.");
return;
}
if (userName == null) userName = getUser().getUserName();
}
}
%>
<%
MyParameters params = new MyParameters().loadFromRequest(request, response, false);
if (params.getErrors().size() == 0) {
RegularizationRule reg = RegularizationRule.getRegularizationRule(params.regID);
if (reg == null) {
params.addError(-6, "regID: " + params.regID + " not found.");
}
else {
int verseHash = new VerseKey(params.verse).getHashNumber();
Regularization.deleteRuleException(params.regID, verseHash, params.userName, params.groupName);
Serializer.output(response, out, params, XMLBlock.createXMLBlock(""));
return;
}
}
else params.format = "html";
Serializer.reportErrors(request, response, out, params, true);
%>