Skip to content

Commit

Permalink
feat: created OrganizationRepo class
Browse files Browse the repository at this point in the history
  • Loading branch information
emilfa committed Feb 26, 2026
1 parent fbbdab4 commit 76e620f
Showing 1 changed file with 39 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package edu.group5.app.model.organization;

import edu.group5.app.model.Repository;

import java.util.HashMap;
import java.util.Objects;

/**
* Handles business logic associated with organizations
*/
public class OrganizationRepo implements Repository {
private HashMap<Integer, Organization> content;

/**
* Creates a new Organization Repository
*
* @param content holds all current organizations
* @throws NullPointerException if content is null
*/
public OrganizationRepo(HashMap<Integer, Organization> content) {
this.content = Objects.requireNonNull(content, "content cannot be null");
}

public HashMap<Integer, Organization> getContent() {
return content;
}

public HashMap<Integer, Organization> getTrustedOrganizations() {
HashMap<Integer, Organization> trustedOrgs = new HashMap<>();

content.forEach((orgNr, org) -> {
if (org.trusted()) {
trustedOrgs.put(orgNr, org);
}
});

return trustedOrgs;
}
}

0 comments on commit 76e620f

Please sign in to comment.