<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@ page trimDirectiveWhitespaces="true" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Apparatus" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Document" %> <%@ page import="org.crosswire.community.projects.ntmss.data.ProjectManagement" %> <%@ page import="org.crosswire.community.projects.ntmss.data.Transcription" %> <%@ page import="java.util.Collections" %> <%@ page import="java.util.List" %> <%@ page import="org.crosswire.xml.XMLBlock" %> <%@ page import="org.crosswire.webtools.annotation.*" %> <%@ page import="org.crosswire.webtools.*" %> <%@ page import="org.crosswire.utils.HTTPUtils" %> <%@ page import="javax.validation.constraints.NotNull" %> <%! @Description(value = "List the segment reading witness attestations by document ID. see also: variant/apparatus/get", name = "variant/list") public static class MyParameters extends Parameters { protected ProjectManagement.Project project = null; @Description(value = "manuscript id to use for selected readings. All hands from this manuscript will be returned", example = "10046") public Integer docID = null; @Description(value = "segment group id to retrieve", example = "78") public Integer segmentGroupID = null; @Description(value = "augment this project data on top of another project dataset", example = "1") public Integer augmentGroupID = null; @Description(value = "Project ID for which data should be included", example = "1") public Integer projectID; @Description(value = "Project Name for which data should be deleted (i.e., lookup {projectID} by project name)", example = "ECM Matthew") public String projectName; @Description(value = "limit segments to verse", example = "John.3.16") public String indexContent; @Description(value = "full, segment", defaultValue = "full", example = "segment") public String detail = "full"; @Override protected void customValidation() { projectName = Transcription.assureUnicode(projectName); project = projectID != null ? ProjectManagement.getProject(projectID) : ProjectManagement.getProject(projectName); if (projectID == null && project != null) projectID = project.getProjectID(); } } %> <% MyParameters params = new MyParameters().loadFromRequest(request, response, false); int docID = -999; try {docID = Integer.parseInt(request.getParameter("docID"));} catch (Exception e){} int segmentGroupID = -1; try {segmentGroupID = Integer.parseInt(request.getParameter("segmentGroupID"));} catch (Exception e){} if (segmentGroupID == -1) try { segmentGroupID = Integer.parseInt(request.getParameter("groupID")); } catch(Exception e) {} int augmentGroupID = -1; try {augmentGroupID = Integer.parseInt(request.getParameter("augmentGroupID"));} catch (Exception e){} String format = request.getParameter("format"); String detail = request.getParameter("detail"); String indexContent = request.getParameter("indexContent"); if (segmentGroupID > -1) { response.setContentType("text/xml"); List segments = Apparatus.getSegments(indexContent, segmentGroupID); if (augmentGroupID > -1) { List augments = Apparatus.getSegments(indexContent, augmentGroupID); // augments are priority, our project is overlayed on top Apparatus.augmentSegments(augments, segments); segments = augments; } Collections.sort(segments); Document doc = Document.getDocument(docID); if (doc == null) { doc = new Document(); doc.setDocumentID(docID); doc.setPrimaryName(docID == -4 ? "Problematic" : docID == -1 ? "OfInterest" : Integer.toString(docID)); doc.setOriginYearDescription(""); } %> <% if (docID > -999) { %> <% } for (Apparatus.Segment s : segments) { %> <% if (!"segment".equals(detail)) { %> <% for (Apparatus.SegmentReading sr : s.getSegmentReadings()) { %> <%= HTTPUtils.canonize(sr.getReading()) %> <% } %> <% if (docID > -999) { %> <% for (Apparatus.SegmentReadingWitness srw : Apparatus.getSegmentReadingWitnessesForDocumentID(s.getSegmentID(), docID, segmentGroupID)) { out.println(srw.toFormattedXML()); } %> <% } } %> <% } %> <% return; } else params.format = "html"; Serializer.reportErrors(request, response, out, params, true); %>