public void addListGroups(String groupID, List form, int errorFlag, Collection owningCollection) throws WingException, SQLException { if (isAdvancedFormEnabled) { // currently set group form.addLabel(T_groups); Select groupSelect = form.addItem().addSelect("group_id"); groupSelect.setMultiple(false); java.util.List<Group> loadedGroups = null; // retrieve groups String name = ConfigurationManager.getProperty("webui.submission.restrictstep.groups"); if (name != null) { Group uiGroup = groupService.findByName(context, name); if (uiGroup != null) loadedGroups = uiGroup.getMemberGroups(); } if (loadedGroups == null || loadedGroups.size() == 0) { loadedGroups = groupService.findAll(context, GroupService.NAME); } // if no group selected for default set anonymous if (groupID == null || groupID.equals("")) groupID = "0"; // when we're just loading the main step, also default to anonymous if (errorFlag == AccessStep.STATUS_COMPLETE) { groupID = "0"; } for (Group group : loadedGroups) { boolean selectGroup = group.getID().toString().equals(groupID); groupSelect.addOption(selectGroup, group.getID().toString(), group.getName()); } if (errorFlag == AccessStep.STATUS_DUPLICATED_POLICY || errorFlag == AccessStep.EDIT_POLICY_STATUS_DUPLICATED_POLICY || errorFlag == UploadWithEmbargoStep.STATUS_EDIT_POLICIES_DUPLICATED_POLICY || errorFlag == UploadWithEmbargoStep.STATUS_EDIT_POLICY_DUPLICATED_POLICY) { groupSelect.addError(T_error_duplicated_policy); } } }