Skip to content

Commit d615d96

Browse files
Starting the new standard for case search stuff
Implements #135
1 parent bb2fc57 commit d615d96

File tree

9 files changed

+275
-2
lines changed

9 files changed

+275
-2
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,4 @@ google-java-format_*
9090
# MKDocs Output
9191
site
9292

93-
.jqwik-database
93+
.jqwik-database

proxyserver/src/main/java/edu/suffolk/litlab/efsp/model/Name.java

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,29 @@ public Name(
2121
String lastName,
2222
String suffix,
2323
String maidenName) {
24+
if (prefix == null) {
25+
prefix = "";
26+
}
2427
this.prefix = prefix;
28+
if (firstName == null) {
29+
firstName = "";
30+
}
2531
this.firstName = firstName;
32+
if (middleName == null) {
33+
middleName = "";
34+
}
2635
this.middleName = middleName;
36+
if (lastName == null) {
37+
lastName = "";
38+
}
2739
this.lastName = lastName;
40+
if (suffix == null) {
41+
suffix = "";
42+
}
2843
this.suffix = suffix;
44+
if (maidenName == null) {
45+
maidenName = "";
46+
}
2947
this.maidenName = maidenName;
3048
}
3149

@@ -39,6 +57,9 @@ public Name(String firstName, String middleName, String lastName) {
3957

4058
/** The full name, with no extra spaces. */
4159
public String getFullName() {
60+
if (prefix.isBlank() && firstName.isBlank() && middleName.isBlank() && suffix.isBlank()) {
61+
return "(No name given)";
62+
}
4263
return Stream.of(prefix, firstName, middleName, lastName, suffix)
4364
.reduce(
4465
(wd, n) -> {
@@ -65,9 +86,15 @@ public String getLastName() {
6586
return lastName;
6687
}
6788

68-
/** If there's only a first name, then us it, otherwise take only the last name */
89+
/**
90+
* If there's only a first name, then us it, otherwise take only the last name. Used to create the
91+
* titles of cases, i.e. Jones v. Discover, etc.
92+
*/
6993
public String getTitleName() {
7094
if (lastName == null || lastName.isBlank()) {
95+
if (firstName == null || firstName.isBlank()) {
96+
return "(Unnamed)";
97+
}
7198
return firstName;
7299
} else {
73100
return lastName;
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package edu.suffolk.litlab.efsp.model.cases;
2+
3+
import edu.suffolk.litlab.efsp.model.ContactInformation;
4+
import edu.suffolk.litlab.efsp.model.Name;
5+
6+
public class Attorney extends Person {
7+
String attorneyId;
8+
String barNumber;
9+
10+
public Attorney(Name name, ContactInformation contactInformation) {
11+
super(name, contactInformation);
12+
}
13+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
package edu.suffolk.litlab.efsp.model.cases;
2+
3+
import edu.suffolk.litlab.efsp.ecfcodes.tyler.CaseCategory;
4+
import edu.suffolk.litlab.efsp.ecfcodes.tyler.CaseType;
5+
import edu.suffolk.litlab.efsp.model.Person;
6+
import java.time.LocalDateTime;
7+
import java.util.List;
8+
import java.util.Map;
9+
10+
/** All of the information Tyler sends about a particular case. */
11+
public class CaseResponse {
12+
List<Person> participants;
13+
Map<String, Attorney> attorneys;
14+
15+
CaseCategory caseCategory;
16+
CaseType caseType;
17+
String caseTitle;
18+
LocalDateTime filedDate;
19+
// TODO(Attorneys)
20+
}
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
package edu.suffolk.litlab.efsp.model.cases;
2+
3+
import edu.suffolk.litlab.efsp.model.Name;
4+
import edu.suffolk.litlab.efsp.model.Person;
5+
import edu.suffolk.litlab.efsp.server.ecf4.EcfCaseTypeFactory;
6+
import gov.niem.niem.niem_core._2.CaseType;
7+
import gov.niem.niem.niem_core._2.OrganizationType;
8+
import gov.niem.niem.niem_core._2.PersonNameType;
9+
import gov.niem.niem.niem_core._2.PersonType;
10+
import java.util.Optional;
11+
import oasis.names.tc.legalxml_courtfiling.schema.xsd.caseresponsemessage_4.CaseResponseMessageType;
12+
import oasis.names.tc.legalxml_courtfiling.schema.xsd.commontypes_4.CaseParticipantType;
13+
import tyler.ecf.extensions.common.CaseAugmentationType;
14+
15+
/** A class for parsing ECF types into our internal model types */
16+
public class ECFToReturn {
17+
18+
/** TODO: should replace EcfCaseTypeFactory.getCaseParticipants. */
19+
public static Name toName(PersonNameType pnt) {
20+
var givenName = "";
21+
if (pnt.getPersonGivenName() != null) {
22+
givenName = pnt.getPersonGivenName().getValue();
23+
}
24+
var middleName = "";
25+
if (pnt.getPersonMiddleName() != null) {
26+
middleName = pnt.getPersonMiddleName().getValue();
27+
}
28+
var surName = "";
29+
if (pnt.getPersonSurName() != null) {
30+
surName = pnt.getPersonSurName().getValue();
31+
}
32+
return new Name(givenName, middleName, surName);
33+
}
34+
35+
public static Person toPerson(CaseResponseMessageType resp) {
36+
CaseType caseType = resp.getCase().getValue();
37+
Optional<CaseAugmentationType> caseAug = EcfCaseTypeFactory.getCaseAugmentation(caseType);
38+
CaseParticipantType t = caseAug.get().getCaseParticipant().get(0).getValue();
39+
Object o = t.getEntityRepresentation();
40+
if (o instanceof OrganizationType ot) {
41+
42+
} else if (o instanceof PersonType pt) {
43+
PersonNameType pnt = pt.getPersonName();
44+
}
45+
46+
return null;
47+
}
48+
49+
// TODO: GetCaseResponseMessageType c;
50+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package edu.suffolk.litlab.efsp.model.cases;
2+
3+
import edu.suffolk.litlab.efsp.model.ContactInformation;
4+
import edu.suffolk.litlab.efsp.model.Name;
5+
6+
public class Person {
7+
private final Name name;
8+
private final ContactInformation contactInfo;
9+
10+
public Person(Name name, ContactInformation contactInfo) {
11+
this.name = name;
12+
this.contactInfo = contactInfo;
13+
}
14+
15+
public Name getName() {
16+
return name;
17+
}
18+
19+
public ContactInformation getContactInformation() {
20+
return contactInfo;
21+
}
22+
}
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
package edu.suffolk.litlab.efsp.server.services;
2+
3+
import jakarta.ws.rs.GET;
4+
import jakarta.ws.rs.Path;
5+
import jakarta.ws.rs.PathParam;
6+
import jakarta.ws.rs.Produces;
7+
import jakarta.ws.rs.QueryParam;
8+
import jakarta.ws.rs.core.Context;
9+
import jakarta.ws.rs.core.HttpHeaders;
10+
import jakarta.ws.rs.core.MediaType;
11+
import jakarta.ws.rs.core.Response;
12+
13+
/**
14+
* The interface for Case search queries.
15+
*
16+
* <p>Introduces some abstraction between our current API (returning all raw API info) and a more
17+
* structured, culled down version of the API that returns information without all of the silly NIEM
18+
* abstractions. Would choose between different versions of the API with a separate X-API-VERSION header.
19+
*/
20+
@Produces(MediaType.APPLICATION_JSON)
21+
public abstract class CasesServiceAPI {
22+
23+
@GET
24+
@Path("/")
25+
public abstract Response getAll();
26+
27+
@GET
28+
@Path("/courts")
29+
public abstract Response getCourts();
30+
31+
@GET
32+
@Path("/courts/{court_id}")
33+
public abstract Response getEndpointsUnderCourt(@PathParam("court_id") String courtId);
34+
35+
@GET
36+
@Path("/courts/{court_id}/cases/{case_tracking_id}/documents")
37+
public abstract Response getDocument(
38+
@Context HttpHeaders httpHeaders,
39+
@PathParam("court_id") String courtId,
40+
@PathParam("case_tracking_id") String caseId);
41+
42+
/** Gets all possible cases associated with either a party's name or a docket number. */
43+
@GET
44+
@Path("/courts/{court_id}/cases")
45+
public abstract Response getCaseList(
46+
@Context HttpHeaders httpHeaders,
47+
@PathParam("court_id") String courtId,
48+
@QueryParam("docket_number") String docketId,
49+
@QueryParam("business_name") String businessName,
50+
@QueryParam("first_name") String firstName,
51+
@QueryParam("middle_name") String middleName,
52+
@QueryParam("last_name") String lastName);
53+
54+
@GET
55+
@Path("/courts/{court_id}/cases/{case_tracking_id}")
56+
public abstract Response getCase(
57+
@Context HttpHeaders httpHeaders,
58+
@PathParam("court_id") String courtId,
59+
@PathParam("case_tracking_id") String caseId);
60+
61+
@GET
62+
@Path("/courts/{court_id}/service-contacts/{service_contact_id}/cases")
63+
public abstract Response getServiceAttachCaseList(
64+
@Context HttpHeaders httpHeaders,
65+
@PathParam("court_id") String courtId,
66+
@PathParam("service_contact_id") String serviceId);
67+
68+
@GET
69+
@Path("/courts/{court_id}/cases/{case_tracking_id}/service-information")
70+
public abstract Response getServiceInformation(
71+
@Context HttpHeaders httpHeaders,
72+
@PathParam("court_id") String courtId,
73+
@PathParam("case_tracking_id") String caseId);
74+
75+
@GET
76+
@Path("/courts/{court_id}/cases/{case_tracking_id}/service-information-history")
77+
public abstract Response getServiceInformationHistory(
78+
@Context HttpHeaders httpHeaders,
79+
@PathParam("court_id") String courtId,
80+
@PathParam("case_tracking_id") String caseId);
81+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
package edu.suffolk.litlab.efsp.model.cases;
2+
3+
import gov.niem.niem.niem_core._2.PersonNameType;
4+
import net.jqwik.api.ForAll;
5+
import net.jqwik.api.Property;
6+
import net.jqwik.api.domains.Domain;
7+
8+
public class ECFToReturnTest {
9+
10+
@Property
11+
@Domain(PersonNameExamples.class)
12+
boolean allNamesArentBlank(@ForAll PersonNameType pnt) {
13+
return !ECFToReturn.toName(pnt).getFullName().isBlank();
14+
}
15+
16+
@Property
17+
@Domain(PersonNameExamples.class)
18+
boolean allTitlesArentBlank(@ForAll PersonNameType pnt) {
19+
return !ECFToReturn.toName(pnt).getTitleName().isBlank();
20+
}
21+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
package edu.suffolk.litlab.efsp.model.cases;
2+
3+
import gov.niem.niem.niem_core._2.PersonNameTextType;
4+
import gov.niem.niem.niem_core._2.PersonNameType;
5+
import net.jqwik.api.Arbitraries;
6+
import net.jqwik.api.Arbitrary;
7+
import net.jqwik.api.Combinators;
8+
import net.jqwik.api.Provide;
9+
import net.jqwik.api.domains.DomainContextBase;
10+
11+
public class PersonNameExamples extends DomainContextBase {
12+
13+
@Provide
14+
Arbitrary<PersonNameTextType> nameTexts() {
15+
return Arbitraries.strings()
16+
.map(
17+
(x) -> {
18+
var pntt = new PersonNameTextType();
19+
pntt.setValue(x);
20+
return pntt;
21+
});
22+
}
23+
24+
@Provide
25+
Arbitrary<PersonNameType> names() {
26+
Arbitrary<PersonNameTextType> firsts = Arbitraries.defaultFor(PersonNameTextType.class);
27+
Arbitrary<PersonNameTextType> middles = Arbitraries.defaultFor(PersonNameTextType.class);
28+
Arbitrary<PersonNameTextType> lasts = Arbitraries.defaultFor(PersonNameTextType.class);
29+
return Combinators.combine(firsts, middles, lasts)
30+
.as(
31+
(f, m, l) -> {
32+
var pnt = new PersonNameType();
33+
pnt.setPersonGivenName(f);
34+
pnt.setPersonMiddleName(m);
35+
pnt.setPersonSurName(l);
36+
return pnt;
37+
});
38+
}
39+
}

0 commit comments

Comments
 (0)