Skip to content
Snippets Groups Projects

fix: Allow variable committee prefix casing

1 unresolved thread
2 files
+ 23
18
Compare changes
  • Side-by-side
  • Inline
Files
2
@@ -50,8 +50,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
@@ -50,8 +50,9 @@ import com.fasterxml.jackson.databind.ObjectMapper;
import io.quarkus.runtime.Startup;
import io.quarkus.runtime.Startup;
/**
/**
* Builds a list of working group definitions from an embedded list of working group definitions. This is an interim
* Builds a list of working group definitions from an embedded list of working
* solution to accelerate this project and should be replaced with a call to the foundation API to retrieve this data.
* group definitions. This is an interim solution to accelerate this project and
 
* should be replaced with a call to the foundation API to retrieve this data.
*
*
* @author Martin Lowe, Zachary Sabourin
* @author Martin Lowe, Zachary Sabourin
*/
*/
@@ -72,11 +73,13 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
@@ -72,11 +73,13 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
private Map<String, WorkingGroup> workingGroups;
private Map<String, WorkingGroup> workingGroups;
/**
/**
* At startup, will load the working groups and store them locally to be used throughout the servers life time. As
* At startup, will load the working groups and store them locally to be used
* this resource is embedded within the Jar, we do not need to look for changes to the resource, as that would not
* throughout the servers life time. As this resource is embedded within the
 
* Jar, we do not need to look for changes to the resource, as that would not
* happen with a production server.
* happen with a production server.
*
*
* @throws IOException if there is an issue loading the working groups resource from within the Jar resources.
* @throws IOException if there is an issue loading the working groups resource
 
* from within the Jar resources.
*/
*/
@PostConstruct
@PostConstruct
void init() throws IOException {
void init() throws IOException {
@@ -134,12 +137,12 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
@@ -134,12 +137,12 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
List<FullOrganizationContactData> contacts = apiService.getOrgContacts(alias, documentIds);
List<FullOrganizationContactData> contacts = apiService.getOrgContacts(alias, documentIds);
// Check if any contacts match current committee prefix
// Check if any contacts match current committee prefix
if (contacts == null || contacts
if (contacts == null || contacts.stream()
.stream()
.noneMatch(c -> c.getSysRelation().getRelation().toLowerCase()
.noneMatch(c -> c.getSysRelation().getRelation().toLowerCase().startsWith(groupPrefix))) {
.startsWith(groupPrefix.toLowerCase()))) {
throw new NotFoundException(String
LOGGER.error("No committee/council members found for prefix code {} in working group with alias '{}'",
.format("No committee/council members found for prefix code %s in working group with alias '%s'",
groupPrefix, alias);
groupPrefix, alias));
return null;
}
}
return WorkingGroupCommittee
return WorkingGroupCommittee
@@ -161,12 +164,13 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
@@ -161,12 +164,13 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
}
}
/**
/**
* Creates a Committee role object using the given committee position type, relations, and contact data. Fetches
* Creates a Committee role object using the given committee position type,
* user EFUsername and org logo data. Populates the members list with the respective People and Organization data.
* relations, and contact data. Fetches user EFUsername and org logo data.
 
* Populates the members list with the respective People and Organization data.
*
*
* @param type The current committee position type.
* @param type The current committee position type.
* @param relations List of valid relations for the committee
* @param relations List of valid relations for the committee
* @param contacts List of org contacts for the WG
* @param contacts List of org contacts for the WG
* @return A CommitteeRole entity.
* @return A CommitteeRole entity.
*/
*/
private CommitteeRole createCommitteeRole(CommitteePositionType type, List<SysRelationData> relations,
private CommitteeRole createCommitteeRole(CommitteePositionType type, List<SysRelationData> relations,
@@ -209,10 +213,11 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
@@ -209,10 +213,11 @@ public class DefaultWorkingGroupsService implements WorkingGroupsService {
}
}
/**
/**
* Method used to filter fetched relations. Ensuring they start with the desired prefix, or are IG/CR position type.
* Method used to filter fetched relations. Ensuring they start with the desired
 
* prefix, or are IG/CR position type.
*
*
* @param relation The current relation
* @param relation The current relation
* @param prefix The group prefix
* @param prefix The group prefix
* @return true if criteria is met, false otherwise
* @return true if criteria is met, false otherwise
*/
*/
private boolean filterRelationsByPrefix(String relation, String prefix) {
private boolean filterRelationsByPrefix(String relation, String prefix) {
Loading