@Test(expected = RiceIllegalArgumentException.class) public void testNullPrincipalId() { mediator.getActionListCustomizations(null, Collections.<ActionItem>emptyList()); }
@Override public Map<String, ActionItemCustomization> getActionListCustomizations(String principalId, List<ActionItem> actionItems) throws RiceIllegalArgumentException { if (StringUtils.isBlank(principalId)) { throw new RiceIllegalArgumentException("invalid principalId: " + principalId); } if (actionItems == null) { actionItems = Collections.emptyList(); } Map<String, ActionItemCustomization> results = new HashMap<String, ActionItemCustomization>(); ListMultimap<String, ActionItem> itemsByApplicationId = ArrayListMultimap.create(); for (ActionItem actionItem : actionItems) { DocumentType docType = getDocumentTypeService().findByName(actionItem.getDocName()); if (docType == null) { LOG.error(String.format("Action item %s has an invalid document type name of %s", actionItem.getId(), actionItem.getDocName())); itemsByApplicationId.put(null, actionItem); } else { itemsByApplicationId.put(getActionListCustomizationApplicationId(docType), actionItem); } } for (String applicationId : itemsByApplicationId.keySet()) { ActionListCustomizationHandlerService actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(applicationId); if (actionListCustomizationHandler == null) { actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(null); } List<ActionItemCustomization> customizations = actionListCustomizationHandler.customizeActionList(principalId, itemsByApplicationId.get( applicationId)); if (customizations != null) for (ActionItemCustomization customization : customizations) { results.put(customization.getActionItemId(), customization); } } return results; }
ActionListCustomizationMediatorImpl implements ActionListCustomizationMediator { @Override public Map<String, ActionItemCustomization> getActionListCustomizations(String principalId, List<ActionItem> actionItems) throws RiceIllegalArgumentException { if (StringUtils.isBlank(principalId)) { throw new RiceIllegalArgumentException("invalid principalId: " + principalId); } if (actionItems == null) { actionItems = Collections.emptyList(); } Map<String, ActionItemCustomization> results = new HashMap<String, ActionItemCustomization>(); ListMultimap<String, ActionItem> itemsByApplicationId = ArrayListMultimap.create(); for (ActionItem actionItem : actionItems) { DocumentType docType = getDocumentTypeService().findByName(actionItem.getDocName()); if (docType == null) { LOG.error(String.format("Action item %s has an invalid document type name of %s", actionItem.getId(), actionItem.getDocName())); itemsByApplicationId.put(null, actionItem); } else { itemsByApplicationId.put(getActionListCustomizationApplicationId(docType), actionItem); } } for (String applicationId : itemsByApplicationId.keySet()) { ActionListCustomizationHandlerService actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(applicationId); if (actionListCustomizationHandler == null) { actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(null); } List<ActionItemCustomization> customizations = actionListCustomizationHandler.customizeActionList(principalId, itemsByApplicationId.get( applicationId)); if (customizations != null) for (ActionItemCustomization customization : customizations) { results.put(customization.getActionItemId(), customization); } } return results; } }
ActionListCustomizationMediatorImpl implements ActionListCustomizationMediator { @Override public Map<String, ActionItemCustomization> getActionListCustomizations(String principalId, List<ActionItem> actionItems) throws RiceIllegalArgumentException { if (StringUtils.isBlank(principalId)) { throw new RiceIllegalArgumentException("invalid principalId: " + principalId); } if (actionItems == null) { actionItems = Collections.emptyList(); } Map<String, ActionItemCustomization> results = new HashMap<String, ActionItemCustomization>(); ListMultimap<String, ActionItem> itemsByApplicationId = ArrayListMultimap.create(); for (ActionItem actionItem : actionItems) { DocumentType docType = getDocumentTypeService().findByName(actionItem.getDocName()); if (docType == null) { LOG.error(String.format("Action item %s has an invalid document type name of %s", actionItem.getId(), actionItem.getDocName())); itemsByApplicationId.put(null, actionItem); } else { itemsByApplicationId.put(getActionListCustomizationApplicationId(docType), actionItem); } } for (String applicationId : itemsByApplicationId.keySet()) { ActionListCustomizationHandlerService actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(applicationId); if (actionListCustomizationHandler == null) { actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(null); } List<ActionItemCustomization> customizations = actionListCustomizationHandler.customizeActionList(principalId, itemsByApplicationId.get( applicationId)); if (customizations != null) for (ActionItemCustomization customization : customizations) { results.put(customization.getActionItemId(), customization); } } return results; }  }
ActionListCustomizationMediatorImpl implements ActionListCustomizationMediator { @Override public Map<String, ActionItemCustomization> getActionListCustomizations(String principalId, List<ActionItem> actionItems) throws RiceIllegalArgumentException { if (StringUtils.isBlank(principalId)) { throw new RiceIllegalArgumentException("invalid principalId: " + principalId); } if (actionItems == null) { actionItems = Collections.emptyList(); } Map<String, ActionItemCustomization> results = new HashMap<String, ActionItemCustomization>(); ListMultimap<String, ActionItem> itemsByApplicationId = ArrayListMultimap.create(); for (ActionItem actionItem : actionItems) { DocumentType docType = getDocumentTypeService().findByName(actionItem.getDocName()); if (docType == null) { LOG.error(String.format("Action item %s has an invalid document type name of %s", actionItem.getId(), actionItem.getDocName())); itemsByApplicationId.put(null, actionItem); } else { itemsByApplicationId.put(getActionListCustomizationApplicationId(docType), actionItem); } } for (String applicationId : itemsByApplicationId.keySet()) { ActionListCustomizationHandlerService actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(applicationId); if (actionListCustomizationHandler == null) { actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(null); } List<ActionItemCustomization> customizations = actionListCustomizationHandler.customizeActionList(principalId, itemsByApplicationId.get( applicationId)); if (customizations != null) for (ActionItemCustomization customization : customizations) { results.put(customization.getActionItemId(), customization); } } return results; }  @Override Map<String, ActionItemCustomization> getActionListCustomizations(String principalId,
            List<ActionItem> actionItems); DocumentTypeService getDocumentTypeService(); void setDocumentTypeService(DocumentTypeService documentTypeService); ActionListCustomizationHandlerServiceChooser getActionListCustomizationHandlerServiceChooser(); void setActionListCustomizationHandlerServiceChooser(
            ActionListCustomizationHandlerServiceChooser actionListCustomizationHandlerServiceChooser); }
ActionListCustomizationMediatorImpl implements ActionListCustomizationMediator { @Override public Map<String, ActionItemCustomization> getActionListCustomizations(String principalId, List<ActionItem> actionItems) throws RiceIllegalArgumentException { if (StringUtils.isBlank(principalId)) { throw new RiceIllegalArgumentException("invalid principalId: " + principalId); } if (actionItems == null) { actionItems = Collections.emptyList(); } Map<String, ActionItemCustomization> results = new HashMap<String, ActionItemCustomization>(); ListMultimap<String, ActionItem> itemsByApplicationId = ArrayListMultimap.create(); for (ActionItem actionItem : actionItems) { DocumentType docType = getDocumentTypeService().findByName(actionItem.getDocName()); if (docType == null) { LOG.error(String.format("Action item %s has an invalid document type name of %s", actionItem.getId(), actionItem.getDocName())); itemsByApplicationId.put(null, actionItem); } else { itemsByApplicationId.put(getActionListCustomizationApplicationId(docType), actionItem); } } for (String applicationId : itemsByApplicationId.keySet()) { ActionListCustomizationHandlerService actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(applicationId); if (actionListCustomizationHandler == null) { actionListCustomizationHandler = getActionListCustomizationHandlerServiceChooser().getByApplicationId(null); } List<ActionItemCustomization> customizations = actionListCustomizationHandler.customizeActionList(principalId, itemsByApplicationId.get( applicationId)); if (customizations != null) for (ActionItemCustomization customization : customizations) { results.put(customization.getActionItemId(), customization); } } return results; }  @Override Map<String, ActionItemCustomization> getActionListCustomizations(String principalId,
            List<ActionItem> actionItems); DocumentTypeService getDocumentTypeService(); void setDocumentTypeService(DocumentTypeService documentTypeService); ActionListCustomizationHandlerServiceChooser getActionListCustomizationHandlerServiceChooser(); void setActionListCustomizationHandlerServiceChooser(
            ActionListCustomizationHandlerServiceChooser actionListCustomizationHandlerServiceChooser);  }