final CssMenuBuilder.CssMenuContext cssMenuContext) {
// check visibility
final AuthenticationSession session = getAuthenticationSession();
final ObjectAdapter adapter = targetAdapterMemento.getObjectAdapter(ConcurrencyChecking.CHECK);
final Consent visibility = objectAction.isVisible(session, adapter, ActionModel.WHERE_FOR_ACTION_INVOCATION);
if (visibility.isVetoed()) {
return null;
}
// build the link
final LinkAndLabel linkAndLabel = cssMenuContext.getCssMenuLinkFactory().newLink(
targetAdapterMemento, objectAction, PageAbstract.ID_MENU_LINK,
cssMenuContext.getActionPromptProvider());
if(linkAndLabel==null) {
// can only get a null if invisible, so this should not happen given guard above
return null;
}
final AbstractLink link = linkAndLabel.getLink();
final String actionLabel = linkAndLabel.getLabel();
final Consent usability = objectAction.isUsable(session, adapter, ActionModel.WHERE_FOR_ACTION_INVOCATION);
final String reasonDisabledIfAny = usability.getReason();
final DescribedAsFacet describedAsFacet = objectAction.getFacet(DescribedAsFacet.class);
final String descriptionIfAny = describedAsFacet != null? describedAsFacet.value(): null;
Builder builder = newSubMenuItem(actionLabel)