Skip to content

Commit

Permalink
Refactor SearchApi functions for clarity #267
Browse files Browse the repository at this point in the history
  • Loading branch information
patrick-austin committed Apr 28, 2022
1 parent 9450c4b commit 901e3ad
Show file tree
Hide file tree
Showing 10 changed files with 654 additions and 515 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.json.stream.JsonGenerator;
import javax.persistence.CascadeType;
Expand Down Expand Up @@ -55,7 +57,7 @@ public void setFacility(Facility facility) {
@Column(name = "VERSION", nullable = false)
private String version;

public static List<String> docFields = Arrays.asList("datafileFormat.name", "datafileFormat.id");
public static Set<String> docFields = new HashSet<>(Arrays.asList("datafileFormat.name", "datafileFormat.id"));

/* Needed for JPA */
public DatafileFormat() {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/icatproject/core/entity/DatasetType.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.json.stream.JsonGenerator;
import javax.persistence.CascadeType;
Expand Down Expand Up @@ -39,7 +41,7 @@ public class DatasetType extends EntityBaseBean implements Serializable {
@Column(name = "NAME", nullable = false)
private String name;

public static List<String> docFields = Arrays.asList("type.name", "type.id");
public static Set<String> docFields = new HashSet<>(Arrays.asList("type.name", "type.id"));

/* Needed for JPA */
public DatasetType() {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/icatproject/core/entity/Facility.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.json.stream.JsonGenerator;
import javax.persistence.CascadeType;
Expand Down Expand Up @@ -65,7 +67,7 @@ public class Facility extends EntityBaseBean implements Serializable {
@Comment("A URL associated with this facility")
private String url;

public static List<String> docFields = Arrays.asList("facility.name", "facility.id");
public static Set<String> docFields = new HashSet<>(Arrays.asList("facility.name", "facility.id"));

/* Needed for JPA */
public Facility() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.json.stream.JsonGenerator;
import javax.persistence.CascadeType;
Expand Down Expand Up @@ -55,7 +57,7 @@ public void setInvestigations(List<Investigation> investigations) {
this.investigations = investigations;
}

public static List<String> docFields = Arrays.asList("type.name", "type.id");
public static Set<String> docFields = new HashSet<>(Arrays.asList("type.name", "type.id"));

/* Needed for JPA */
public InvestigationType() {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/icatproject/core/entity/ParameterType.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.json.stream.JsonGenerator;
import javax.persistence.CascadeType;
Expand Down Expand Up @@ -95,7 +97,7 @@ public class ParameterType extends EntityBaseBean implements Serializable {
@Comment("If ordinary users are allowed to create their own parameter types this indicates that this one has been approved")
private boolean verified;

public static List<String> docFields = Arrays.asList("type.name", "type.units", "type.unitsSI", "numericValueSI", "type.id");
public static Set<String> docFields = new HashSet<>(Arrays.asList("type.name", "type.units", "type.unitsSI", "numericValueSI", "type.id"));

/* Needed for JPA */
public ParameterType() {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/icatproject/core/entity/SampleType.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.json.stream.JsonGenerator;
import javax.persistence.CascadeType;
Expand Down Expand Up @@ -44,7 +46,7 @@ public class SampleType extends EntityBaseBean implements Serializable {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "type")
private List<Sample> samples = new ArrayList<>();

public static List<String> docFields = Arrays.asList("sample.type.name", "type.id");
public static Set<String> docFields = new HashSet<>(Arrays.asList("sample.type.name", "type.id"));

/* Needed for JPA */
public SampleType() {
Expand Down
4 changes: 3 additions & 1 deletion src/main/java/org/icatproject/core/entity/User.java
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
import java.io.Serializable;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import javax.json.stream.JsonGenerator;
import javax.persistence.CascadeType;
Expand Down Expand Up @@ -55,7 +57,7 @@ public class User extends EntityBaseBean implements Serializable {
@OneToMany(cascade = CascadeType.ALL, mappedBy = "user")
private List<Study> studies = new ArrayList<Study>();

public static List<String> docFields = Arrays.asList("user.name", "user.fullName", "user.id");
public static Set<String> docFields = new HashSet<>(Arrays.asList("user.name", "user.fullName", "user.id"));

public User() {
}
Expand Down
Loading

0 comments on commit 901e3ad

Please sign in to comment.