Skip to content

Commit

Permalink
Code review
Browse files Browse the repository at this point in the history
  • Loading branch information
samleeflang committed Nov 19, 2024
1 parent 8d961f5 commit e8ee889
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,11 +65,11 @@ private static void handleMultipleAgents(
List<Agent> agents, String agentValue, String agentId, AgentRoleType role, Type type) {
var ids = new String[0];
var agentValues = new String[0];
if (checkIfNeedsParsing(agentValue)) {
if (needsParsing(agentValue)) {
agentValues = Arrays.stream(agentValue.split("[&|]")).map(String::trim)
.toArray(String[]::new);
}
if (checkIfNeedsParsing(agentId)) {
if (needsParsing(agentId)) {
ids = Arrays.stream(agentId.split("[&|]")).map(String::trim).toArray(String[]::new);
}
if (agentValues.length == ids.length) {
Expand Down Expand Up @@ -97,7 +97,7 @@ private static void handleMultipleAgents(
}
}

private static boolean checkIfNeedsParsing(String value) {
private static boolean needsParsing(String value) {
return value != null && (value.contains("&") || value.contains("|"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import static eu.dissco.core.translator.domain.RelationshipType.HAS_FDO_TYPE;
import static eu.dissco.core.translator.domain.RelationshipType.HAS_ORGANISATION_ID;
import static eu.dissco.core.translator.schema.Agent.Type.SCHEMA_SOFTWARE_APPLICATION;
import static eu.dissco.core.translator.terms.utils.AgentsUtils.addAgent;
import static org.assertj.core.api.Assertions.assertThat;

import eu.dissco.core.translator.domain.RelationshipType;
Expand Down Expand Up @@ -73,7 +74,7 @@ private EntityRelationship createEntityRelationship(RelationshipType relationshi
.withDwcRelatedResourceID(relatedResource)
.withOdsRelatedResourceURI(relatedResourceURI)
.withDwcRelationshipEstablishedDate(Date.from(Instant.now()))
.withOdsHasAgents(AgentsUtils.addAgent(List.of(), APP_NAME, APP_PID,
.withOdsHasAgents(addAgent(List.of(), APP_NAME, APP_PID,
DATA_TRANSLATOR, SCHEMA_SOFTWARE_APPLICATION));

}
Expand Down

0 comments on commit e8ee889

Please sign in to comment.