@Test public final void testExecuteWithoutFullyLoading() { context.checking(new Expectations() { { oneOf(systemSettingDAO).execute(null); will(returnValue(systemSettings)); allowing(systemSettings).getSupportStreamGroupShortName(); will(returnValue("supportstream")); oneOf(groupMapper).execute(with(any(List.class))); allowing(actionContext).getParams(); will(returnValue(null)); } }); assertEquals(systemSettings, sut.execute(actionContext)); context.assertIsSatisfied(); }
@Override public SystemSettings execute(final ActionContext inActionContext) { SystemSettings settings = systemSettingsDAO.execute(null); if (settings.getSupportStreamGroupShortName() != null && settings.getSupportStreamGroupShortName().length() > 0) { log.debug("looking for group " + settings.getSupportStreamGroupShortName()); List<DomainGroupModelView> groups = groupByShortNameMapper.execute(Collections.singletonList(settings .getSupportStreamGroupShortName())); if (groups.size() == 1) { log.debug("setting group website " + groups.get(0).getUrl()); settings.setSupportStreamWebsite(groups.get(0).getUrl()); } } if ((inActionContext.getParams() instanceof Boolean) && (Boolean) inActionContext.getParams()) { log.debug("User wants fully populated system settings - fetch admins and membership criteria."); List<PersonModelView> adminsList = systemAdminsMapper.execute(null); log.debug("Found system admins: " + adminsList); Set<PersonModelView> adminsSet = new HashSet<PersonModelView>(); adminsSet.addAll(adminsList); settings.setSystemAdministrators(adminsSet); settings.setMembershipCriteria(membershipCriteriaDAO.execute(null)); settings.setGalleryTabTemplates(galleryTabTemplateDAO.findSortedByRecent(0, maxGalleryItems).getPagedSet()); settings.setThemes(themeTransformer.transform(themeDAO.findSortedByRecent(0, maxGalleryItems) .getPagedSet())); } return settings; }
GetSystemSettingsExecution implements ExecutionStrategy<ActionContext> { @Override public SystemSettings execute(final ActionContext inActionContext) { SystemSettings settings = systemSettingsDAO.execute(null); if (settings.getSupportStreamGroupShortName() != null && settings.getSupportStreamGroupShortName().length() > 0) { log.debug("looking for group " + settings.getSupportStreamGroupShortName()); List<DomainGroupModelView> groups = groupByShortNameMapper.execute(Collections.singletonList(settings .getSupportStreamGroupShortName())); if (groups.size() == 1) { log.debug("setting group website " + groups.get(0).getUrl()); settings.setSupportStreamWebsite(groups.get(0).getUrl()); } } if ((inActionContext.getParams() instanceof Boolean) && (Boolean) inActionContext.getParams()) { log.debug("User wants fully populated system settings - fetch admins and membership criteria."); List<PersonModelView> adminsList = systemAdminsMapper.execute(null); log.debug("Found system admins: " + adminsList); Set<PersonModelView> adminsSet = new HashSet<PersonModelView>(); adminsSet.addAll(adminsList); settings.setSystemAdministrators(adminsSet); settings.setMembershipCriteria(membershipCriteriaDAO.execute(null)); settings.setGalleryTabTemplates(galleryTabTemplateDAO.findSortedByRecent(0, maxGalleryItems).getPagedSet()); settings.setThemes(themeTransformer.transform(themeDAO.findSortedByRecent(0, maxGalleryItems) .getPagedSet())); } return settings; } }
GetSystemSettingsExecution implements ExecutionStrategy<ActionContext> { @Override public SystemSettings execute(final ActionContext inActionContext) { SystemSettings settings = systemSettingsDAO.execute(null); if (settings.getSupportStreamGroupShortName() != null && settings.getSupportStreamGroupShortName().length() > 0) { log.debug("looking for group " + settings.getSupportStreamGroupShortName()); List<DomainGroupModelView> groups = groupByShortNameMapper.execute(Collections.singletonList(settings .getSupportStreamGroupShortName())); if (groups.size() == 1) { log.debug("setting group website " + groups.get(0).getUrl()); settings.setSupportStreamWebsite(groups.get(0).getUrl()); } } if ((inActionContext.getParams() instanceof Boolean) && (Boolean) inActionContext.getParams()) { log.debug("User wants fully populated system settings - fetch admins and membership criteria."); List<PersonModelView> adminsList = systemAdminsMapper.execute(null); log.debug("Found system admins: " + adminsList); Set<PersonModelView> adminsSet = new HashSet<PersonModelView>(); adminsSet.addAll(adminsList); settings.setSystemAdministrators(adminsSet); settings.setMembershipCriteria(membershipCriteriaDAO.execute(null)); settings.setGalleryTabTemplates(galleryTabTemplateDAO.findSortedByRecent(0, maxGalleryItems).getPagedSet()); settings.setThemes(themeTransformer.transform(themeDAO.findSortedByRecent(0, maxGalleryItems) .getPagedSet())); } return settings; } GetSystemSettingsExecution(
            final DomainMapper<MapperRequest, SystemSettings> inSystemSettingsDAO,
            final DomainMapper<Serializable, List<PersonModelView>> inSystemAdminsMapper,
            final DomainMapper<MapperRequest, List<MembershipCriteriaDTO>> inMembershipCriteriaDAO,
            final GalleryItemMapper<GalleryTabTemplateDTO> inGalleryTabTemplateDAO,
            final GalleryItemMapper<Theme> inThemeDAO, //
            final Transformer<List<Theme>, List<ThemeDTO>> inThemeTransformer,
            final GetDomainGroupsByShortNames inGroupByShortNameMapper); }
GetSystemSettingsExecution implements ExecutionStrategy<ActionContext> { @Override public SystemSettings execute(final ActionContext inActionContext) { SystemSettings settings = systemSettingsDAO.execute(null); if (settings.getSupportStreamGroupShortName() != null && settings.getSupportStreamGroupShortName().length() > 0) { log.debug("looking for group " + settings.getSupportStreamGroupShortName()); List<DomainGroupModelView> groups = groupByShortNameMapper.execute(Collections.singletonList(settings .getSupportStreamGroupShortName())); if (groups.size() == 1) { log.debug("setting group website " + groups.get(0).getUrl()); settings.setSupportStreamWebsite(groups.get(0).getUrl()); } } if ((inActionContext.getParams() instanceof Boolean) && (Boolean) inActionContext.getParams()) { log.debug("User wants fully populated system settings - fetch admins and membership criteria."); List<PersonModelView> adminsList = systemAdminsMapper.execute(null); log.debug("Found system admins: " + adminsList); Set<PersonModelView> adminsSet = new HashSet<PersonModelView>(); adminsSet.addAll(adminsList); settings.setSystemAdministrators(adminsSet); settings.setMembershipCriteria(membershipCriteriaDAO.execute(null)); settings.setGalleryTabTemplates(galleryTabTemplateDAO.findSortedByRecent(0, maxGalleryItems).getPagedSet()); settings.setThemes(themeTransformer.transform(themeDAO.findSortedByRecent(0, maxGalleryItems) .getPagedSet())); } return settings; } GetSystemSettingsExecution(
            final DomainMapper<MapperRequest, SystemSettings> inSystemSettingsDAO,
            final DomainMapper<Serializable, List<PersonModelView>> inSystemAdminsMapper,
            final DomainMapper<MapperRequest, List<MembershipCriteriaDTO>> inMembershipCriteriaDAO,
            final GalleryItemMapper<GalleryTabTemplateDTO> inGalleryTabTemplateDAO,
            final GalleryItemMapper<Theme> inThemeDAO, //
            final Transformer<List<Theme>, List<ThemeDTO>> inThemeTransformer,
            final GetDomainGroupsByShortNames inGroupByShortNameMapper); @Override SystemSettings execute(final ActionContext inActionContext); }
GetSystemSettingsExecution implements ExecutionStrategy<ActionContext> { @Override public SystemSettings execute(final ActionContext inActionContext) { SystemSettings settings = systemSettingsDAO.execute(null); if (settings.getSupportStreamGroupShortName() != null && settings.getSupportStreamGroupShortName().length() > 0) { log.debug("looking for group " + settings.getSupportStreamGroupShortName()); List<DomainGroupModelView> groups = groupByShortNameMapper.execute(Collections.singletonList(settings .getSupportStreamGroupShortName())); if (groups.size() == 1) { log.debug("setting group website " + groups.get(0).getUrl()); settings.setSupportStreamWebsite(groups.get(0).getUrl()); } } if ((inActionContext.getParams() instanceof Boolean) && (Boolean) inActionContext.getParams()) { log.debug("User wants fully populated system settings - fetch admins and membership criteria."); List<PersonModelView> adminsList = systemAdminsMapper.execute(null); log.debug("Found system admins: " + adminsList); Set<PersonModelView> adminsSet = new HashSet<PersonModelView>(); adminsSet.addAll(adminsList); settings.setSystemAdministrators(adminsSet); settings.setMembershipCriteria(membershipCriteriaDAO.execute(null)); settings.setGalleryTabTemplates(galleryTabTemplateDAO.findSortedByRecent(0, maxGalleryItems).getPagedSet()); settings.setThemes(themeTransformer.transform(themeDAO.findSortedByRecent(0, maxGalleryItems) .getPagedSet())); } return settings; } GetSystemSettingsExecution(
            final DomainMapper<MapperRequest, SystemSettings> inSystemSettingsDAO,
            final DomainMapper<Serializable, List<PersonModelView>> inSystemAdminsMapper,
            final DomainMapper<MapperRequest, List<MembershipCriteriaDTO>> inMembershipCriteriaDAO,
            final GalleryItemMapper<GalleryTabTemplateDTO> inGalleryTabTemplateDAO,
            final GalleryItemMapper<Theme> inThemeDAO, //
            final Transformer<List<Theme>, List<ThemeDTO>> inThemeTransformer,
            final GetDomainGroupsByShortNames inGroupByShortNameMapper); @Override SystemSettings execute(final ActionContext inActionContext);  }