然后,它对参数中的每个portlet进行迭代,找出ResourceActions进行处理:
while (itr.hasNext()) { Portlet portlet = itr.next(); List<String> portletActions = ResourceActionsUtil.getPortletResourceActions(portlet); ResourceActionLocalServiceUtil.checkResourceActions( portlet.getPortletId(), portletActions); List<String> modelNames = ResourceActionsUtil.getPortletModelResources( portlet.getPortletId()); for (String modelName : modelNames) { List<String> modelActions = ResourceActionsUtil.getModelResourceActions(modelName); ResourceActionLocalServiceUtil.checkResourceActions( modelName, modelActions); } }我们逐行分析。
分析04-05行:
在第04行,它调用ResourceActionsUtil的getPortletResourceActions方法来获取和某个portlet相关联的portletActions列表:
public static List<String> getPortletResourceActions(Portlet portlet) { return getResourceActions().getPortletResourceActions(portlet); }它会去委托ResourceActionImpl的getPortletResourceActions方法:
public List<String> getPortletResourceActions(Portlet portlet) { List<String> actions = ListUtil.copy( getPortletResourceActions(portlet.getPortletId())); synchronized (this) { checkPortletActions(portlet, actions); setActions( _portletResourceActions, portlet.getPortletId(), actions); } return actions; }