<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Document" %> <%@ page import="org.crosswire.xml.XMLBlock" %> <%@ page import="org.crosswire.webtools.annotation.*" %> <%@ page import="org.crosswire.webtools.*" %> <%@ page import="javax.validation.constraints.NotNull" %> <%! @Description(value = "Clear all indexing data which was automatically added (likely from a transcription import) for a manuscript.", name = "manuscript/clearnonhumanindexing") public static class MyParameters extends Parameters { @NotNull @Description(value = "manuscript id", example = "10046") public Integer docID; @Override protected void customValidation() { if (getUser() == null) { addError(-5, "Must be logged in."); return; } } } %> <% MyParameters params = new MyParameters().loadFromRequest(request, response, false); if (params.getErrors().size() == 0) { String role = "VMR Administrator"; boolean permission = params.getUser().hasRole(role); Document d = Document.getDocument(params.docID); if (d == null) { params.addError(-5, "Document docID: " + params.docID + " not found."); } else { if (!permission) permission = params.getUser().getUserName().equals(d.getUserID()); if (!permission) { params.addError(-6, "User does not own this document or has the role: " + role + "."); } else { int count = d.executeSQL("delete from BIBLICALCONTENT WHERE USERID='ECM' AND DOCUMENTID={DOCUMENTID}"); Serializer.output(response, out, params, XMLBlock.createXMLBlock( "" )); return; } } } else params.format = "html"; Serializer.reportErrors(request, response, out, params, true); %>