@Override public OpenParticipatoryOrganization hydrate(ResultSet rs) throws SQLException { OpenParticipatoryOrganization organization = new OpenParticipatoryOrganization(teamDomain.get(rs), governanceChannel.get(rs)); organization.setName(name.get(rs)); organization.setVision(vision.get(rs)); Stream.of(mission.get(rs)).findFirst().ifPresent(organization::setMission); organization.setValueSet(Arrays.asList(values.get(rs))); idOf(organization).set(id.get(rs)); return organization; }
@Override public void dehydrate(PreparedStatement st, OpenParticipatoryOrganization entity) throws SQLException { name.set(st, entity.getName()); locationType.set(st, Location.Type.OPO.name()); teamDomain.set(st, entity.getTeamDomain()); governanceChannel.set(st, entity.getGovernanceChannel().orElse(null)); vision.set(st, entity.getVision()); mission.set( st, toArray(entity.getMission() != null ? singletonList(entity.getMission()) : emptyList())); values.set(st, toArray(entity.getValueSet())); }