Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Acas 1023 allow sel to load experiments with existing case insensitive conservative #444

Open
wants to merge 2 commits into
base: release/2023.2.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ public ResponseEntity<java.lang.String> listJson(
}
}
} else if (protocolKind == null && protocolName != null) {
List<Protocol> protocols = Protocol.findProtocolByProtocolName(protocolName);
List<Protocol> protocols = Protocol.findProtocolByProtocolName(protocolName, false);
for (Protocol protocol : protocols) {
List<Experiment> experiments = Experiment.findExperimentsByProtocol(protocol).getResultList();
for (Experiment experiment : experiments) {
Expand Down
15 changes: 13 additions & 2 deletions src/main/java/com/labsynch/labseer/api/ApiProtocolController.java
Original file line number Diff line number Diff line change
Expand Up @@ -371,7 +371,7 @@ public ResponseEntity<java.lang.String> jsonFindProtocolsByProtocolNameEqualsRou
String protocolName = restOfTheUrl.split("protocolname\\/")[1].replaceAll("/$", "");
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json; charset=utf-8");
return new ResponseEntity<String>(Protocol.toJsonArray(Protocol.findProtocolByProtocolName(protocolName)),
return new ResponseEntity<String>(Protocol.toJsonArray(Protocol.findProtocolByProtocolName(protocolName, false)),
headers, HttpStatus.OK);
}

Expand All @@ -382,7 +382,18 @@ public ResponseEntity<java.lang.String> jsonFindProtocolsByProtocolNameEqualsGet
@RequestParam("protocolName") String protocolName) {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json; charset=utf-8");
return new ResponseEntity<String>(Protocol.toJsonArray(Protocol.findProtocolByProtocolName(protocolName)),
return new ResponseEntity<String>(Protocol.toJsonArray(Protocol.findProtocolByProtocolName(protocolName, false)),
headers, HttpStatus.OK);
}

@Transactional
@RequestMapping(params = "FindByProtocolNameLike", method = RequestMethod.GET, headers = "Accept=application/json")
@ResponseBody
public ResponseEntity<java.lang.String> jsonFindProtocolsByProtocolNameLikeGet(
@RequestParam("protocolName") String protocolName) {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json; charset=utf-8");
return new ResponseEntity<String>(Protocol.toJsonArray(Protocol.findProtocolByProtocolName(protocolName, true)),
headers, HttpStatus.OK);
}

Expand Down
10 changes: 8 additions & 2 deletions src/main/java/com/labsynch/labseer/domain/Protocol.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,14 @@ public static com.labsynch.labseer.domain.Protocol update(com.labsynch.labseer.d
return updatedProtocol;
}

public static List<com.labsynch.labseer.domain.Protocol> findProtocolByProtocolName(String protocolName) {
List<ProtocolLabel> foundProtocolLabels = ProtocolLabel.findProtocolLabelsByName(protocolName).getResultList();
public static List<com.labsynch.labseer.domain.Protocol> findProtocolByProtocolName(String protocolName, boolean useLike) {
List<ProtocolLabel> foundProtocolLabels;
if (useLike) {
foundProtocolLabels = ProtocolLabel.findProtocolLabelsByName(protocolName).getResultList();
} else {
foundProtocolLabels = ProtocolLabel.findProtocolLabelsByNameLike(protocolName).getResultList();
}

List<Protocol> protocolList = new ArrayList<Protocol>();
for (ProtocolLabel protocolLabel : foundProtocolLabels) {
Protocol protocol = Protocol.findProtocol(protocolLabel.getProtocol().getId());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ public class ProtocolServiceTest {

// @Test
public void FindProtocolByName_Test10() {
List<Protocol> protocols = Protocol.findProtocolByProtocolName("test");
List<Protocol> protocols = Protocol.findProtocolByProtocolName("test", false);
logger.info("Found number of protocols: " + protocols.size());
for (Protocol protocol : protocols) {
logger.info(protocol.toJson());
Expand Down