org.nuxeo.ecm.platform.actions.Action类的使用及代码示例

x33g5p2x  于2022-01-17 转载在 其他  
字(10.8k)|赞(0)|评价(0)|浏览(115)

本文整理了Java中org.nuxeo.ecm.platform.actions.Action类的一些代码示例,展示了Action类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Action类的具体详情如下:
包路径:org.nuxeo.ecm.platform.actions.Action
类名称:Action

Action介绍

[英]Descriptor for action.
[中]用于操作的描述符。

代码示例

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

@Override
public String getContributionId(Action contrib) {
  return contrib.getId();
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

protected String getStringProperty(String prop) {
  Map<String, Serializable> props = getProperties();
  if (props != null && props.containsKey(prop)) {
    Object obj = props.get(prop);
    if (obj instanceof String) {
      return (String) obj;
    }
  }
  return null;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

String newIcon = source.getIcon();
if (newIcon != null && !newIcon.equals(dest.getIcon())) {
  dest.setIcon(newIcon);
if (source.isEnableSet() && source.isEnabled() != dest.isEnabled()) {
  dest.setEnabled(source.isEnabled());
Set<String> mergedCategories = new HashSet<String>(Arrays.asList(dest.getCategories()));
mergedCategories.addAll(new HashSet<String>(Arrays.asList(source.getCategories())));
dest.setCategories(mergedCategories.toArray(new String[mergedCategories.size()]));
String newLabel = source.getLabel();
if (newLabel != null && !newLabel.equals(dest.getLabel())) {
  dest.setLabel(newLabel);
String newLink = source.getLink();
if (newLink != null && !newLink.equals(dest.getLink())) {
  dest.setLink(newLink);
String newConfirm = source.getConfirm();
if (newConfirm != null && !"".equals(newConfirm) && !newConfirm.equals(dest.getConfirm())) {
  dest.setConfirm(newConfirm);
String tooltip = source.getHelp();
if (tooltip != null && !tooltip.equals(dest.getHelp())) {
  dest.setHelp(tooltip);
String type = source.getType();
if (type != null && !type.equals(dest.getType())) {

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-base

@Override
public void setCurrentSubTabAction(Action tabAction) {
  if (tabAction != null) {
    String[] categories = tabAction.getCategories();
    if (categories == null || categories.length == 0) {
      log.error("Cannot set subtab with id '" + tabAction.getId()
          + "' as this action does not hold any category");
      return;
    }
    if (categories.length != 1) {
      log.error("Setting subtab with id '" + tabAction.getId() + "' with category '" + categories[0]
          + "': use webActions#setCurrentTabAction(action, category) to specify another category");
    }
    setCurrentTabAction(categories[0], tabAction);
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-core

/**
 * Returns all popup actions: used to construct HTML menu template.
 */
public List<Action> getUnfiltredPopupActions() {
  if (unfiltredActions == null) {
    computeUnfiltredPopupActions();
  }
  // post filters links to add docId
  for (Action act : unfiltredActions) {
    String lnk = act.getLink();
    if (lnk.startsWith("javascript:")) {
      lnk = lnk.replaceFirst("javascript:", "");
      act.setLink(lnk);
    }
  }
  return unfiltredActions;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

public synchronized void addAction(Action action) {
  String id = action.getId();
  if (log.isDebugEnabled()) {
    if (actions.containsKey(id)) {
      log.debug("Overriding action: " + action);
    } else {
      log.debug("Registering action: " + action);
    }
  }
  // add a default label if not set
  if (action.getLabel() == null) {
    action.setLabel(action.getId());
  }
  actions.put(id, action);
  for (String category : action.getCategories()) {
    List<String> acts = categories.get(category);
    if (acts == null) {
      acts = new ArrayList<>();
    }
    if (!acts.contains(id)) {
      acts.add(id);
    }
    categories.put(category, acts);
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-jsf

String wtype = actionInstance.getType();
if (StringUtils.isBlank(wtype)) {
  wtype = "link";
props.putAll(actionInstance.getProperties());
if ("template".equals(wtype)) {
String confirm = actionInstance.getConfirm();
if (!StringUtils.isEmpty(confirm)) {
  fullOnclick.append(confirm).append(";");
String onclick = (String) actionInstance.getProperties().get("onclick");
if (!StringUtils.isEmpty(onclick)) {
  fullOnclick.append(onclick).append(";");
props.put("immediate", actionInstance.isImmediate());
props.put("icon", actionInstance.getIcon());
props.put("onclick", actionInstance.getConfirm());
props.put("accessKey", actionInstance.getAccessKey());
props.put("link", actionInstance.getLink());
props.put("actionId", actionInstance.getId());
props.put("action", actionInstance);
if (useAjaxForm != null && !props.containsKey("useAjaxForm")) {
if (!actionInstance.isFiltered()) {
  props.put("enabled", filterExpr);
} else {
  props.put("available", actionInstance.getAvailable());

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-base

cats = new String[] { DIR_ACTION_CATEGORY };
Action a = new Action(ACTION_ID_PREFIX + getName(), cats);
a.setType("rest_document_link");
a.setLabel(getLabel());
Map<String, String> props = new HashMap<String, String>();
props.put("ajaxSupport", "true");
ActionPropertiesDescriptor pdesc = new ActionPropertiesDescriptor();
pdesc.setProperties(props);
a.setPropertiesDescriptor(pdesc);
Integer order = getOrder();
if (order != null) {
  a.setOrder(order.intValue());
} else {
  a.setOrder(1000);
a.setIcon("/img/" + getName() + ".png");
a.setEnabled(Boolean.TRUE.equals(getEnabled()));
a.setFilterIds(new ArrayList<String>());
return a;

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

/**
 * Displays specific help messages for migration of actions.
 *
 * @since 6.0
 */
protected boolean applyCustomCompatibility(String compatType, Action action) {
  // 6.0 BBB: home/admin tab actions migrated to widgets
  if ("admin_rest_document_link".equals(compatType) || "home_rest_document_link".equals(compatType)) {
    boolean applied = false;
    String link = action.getLink();
    if (link != null && !link.startsWith("/")) {
      action.setLink("/" + link);
      applied = true;
    }
    if (applied) {
      log.warn(String.format(
          "Applied compatibility to action '%s', its configuration "
              + "should be reviewed: make sure the link references an " + "absolute path",
          action.getId()));
      return true;
    }
  }
  return false;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-base

public String getViewFor(Action mainTabAction) {
  if (!mainTabAction.getId().equals(WebActions.DOCUMENTS_MAIN_TAB_ID)) {
    return mainTabAction.getLink();
  }
  DocumentModel doc = getDocumentFor(mainTabAction.getId(), navigationContext.getCurrentDocument());
  if (doc != null) {
    TypeInfo typeInfo = doc.getAdapter(TypeInfo.class);
    return typeInfo.getDefaultView();
  }
  return DEFAULT_VIEW;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-core

public String importDocuments() {
  Map<String, Serializable> importOptionProperties = selectedImportOption.getProperties();
  String chainOrOperationId = null;
  if (importOptionProperties.containsKey("chainId")) {
  } else {
    chainOrOperationId = selectedImportOption.getId();

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

private boolean checkFilters(ActionContext context, Action action) {
  if (action == null) {
    return false;
  }
  if (log.isTraceEnabled()) {
    log.trace(String.format("Checking access for action '%s'...", action.getId()));
  }
  boolean granted = checkFilters(action, action.getFilterIds(), context);
  if (granted) {
    if (log.isTraceEnabled()) {
      log.trace(String.format("Granting access for action '%s'", action.getId()));
    }
  } else {
    if (log.isTraceEnabled()) {
      log.trace(String.format("Denying access for action '%s'", action.getId()));
    }
  }
  return granted;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-document-routing-web

if (!actionsCounter.get(action.getId()).equals(taskDocsNum)) {
  action.setAvailable(false);

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-document-routing-web

String buttonId = button.getName();
  String id = getTaskActionId(task, buttonId);
  Action action = new Action(id, Action.EMPTY_CATEGORIES);
  action.setLabel(button.getLabel());
  Map<String, Serializable> actionProps = new HashMap<String, Serializable>();
  actionProps.put("buttonId", buttonId);
  if (addLayout) {
    actionProps.putAll(props);
    action.setProperties(actionProps);
    action.setType("fancybox");
  } else {
    action.setProperties(actionProps);
    action.setType("link");
Action processAction = new Action(id, Action.EMPTY_CATEGORIES);
processAction.setProperties(props);
processAction.setType("process_task");
actions.put(id, processAction);

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-document-routing-web

Action action = new Action(button.getName(),
    Action.EMPTY_CATEGORIES);
action.setLabel(button.getLabel());
boolean displayAction = true;
if (StringUtils.isNotEmpty(button.getFilter())) {

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

protected boolean applyCompatibility(String category, Action finalAction) {
  if (finalAction != null && finalAction.getType() == null) {
    for (TypeCompatibility compat : typeCategoryRelations) {
      for (String compatCategory : compat.getCategories()) {
        if (StringUtils.equals(compatCategory, category)) {
          finalAction.setType(compat.getType());
          if (applyCustomCompatibility(compat.getType(), finalAction)) {
            return true;
          }
        }
      }
    }
  }
  return false;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

@Override
public Action clone() {
  Action clone = new Action();
  clone.id = id;
  clone.link = link;

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-base

/**
 * Helper to register a simple action based on the given descriptor
 *
 * @since 6.0
 */
protected Action getAction() {
  Action a = new Action(ACTION_ID_PREFIX + getTreeId(),
      new String[] { DirectoryTreeDescriptor.NAV_ACTION_CATEGORY });
  a.setType("rest_document_link");
  a.setLabel(getTreeLabel());
  Map<String, String> props = new HashMap<String, String>();
  props.put("ajaxSupport", "true");
  if (isDirectoryTreeBased()) {
    props.put("link", "/incl/single_directory_tree_explorer.xhtml");
  } else {
    props.put("link", getXhtmlview());
  }
  ActionPropertiesDescriptor pdesc = new ActionPropertiesDescriptor();
  pdesc.setProperties(props);
  a.setPropertiesDescriptor(pdesc);
  Integer order = getOrder();
  if (order != null) {
    a.setOrder(order.intValue());
  }
  a.setEnabled(isEnabled());
  a.setIcon(String.format("/img/%s.png", getTreeId()));
  // need to set a non-empty list
  a.setFilterIds(new ArrayList<String>());
  return a;
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-webapp-core

public void setSelectedImportOptionId(String id) {
  for (Action importOption : importOptions) {
    if (importOption.getId().equals(id)) {
      selectedImportOption = importOption;
      break;
    }
  }
}

代码示例来源:origin: org.nuxeo.ecm.platform/nuxeo-platform-actions-core

public boolean isImmediate() {
  if (immediate == null) {
    Map<String, Serializable> props = getProperties();
    if (props != null && props.containsKey("immediate")) {
      Object obj = props.get("immediate");
      if (obj instanceof String) {
        return Boolean.valueOf((String) obj).booleanValue();
      } else if (obj instanceof Boolean) {
        return ((Boolean) obj).booleanValue();
      }
    }
    return false;
  }
  return immediate.booleanValue();
}

相关文章