Пример #1
0
    @Override
    public XDoControlFlow run(ActionRequestContext pRequestContext) {
      ContextUCon lContextUCon = pRequestContext.getContextUCon();

      if (lContextUCon.isTransactionControlAllowed()) {
        if (mOperationType == TransactionCommand.OperationType.COMMIT) {
          lContextUCon.commitCurrentConnection();
        } else if (mOperationType == TransactionCommand.OperationType.ROLLBACK) {
          lContextUCon.rollbackCurrentConnection();
        }
      } else {
        String lCurConName = lContextUCon.getCurrentConnectionName();
        if (FoxMainServlet.MAIN_CONNECTION_NAME.equals(lCurConName)) {
          // TODO this should always throw an error - don't for now as lots of old module markup may
          // have commits/rollbacks in legacy code
          Track.alert(
              "TransactionCommand",
              mOperationType
                  + " not permitted on current connection "
                  + lCurConName
                  + " - hard error skipped for backwards compatibility",
              TrackFlag.ACTION_PROCESSING);
        } else {
          throw new ExInternal(
              mOperationType + " not permitted on current connection " + lCurConName);
        }
      }

      return XDoControlFlowContinue.instance();
    }
Пример #2
0
  @Override
  public XDoControlFlow run(ActionRequestContext pRequestContext) {

    ContextUElem lContextUElem = pRequestContext.getContextUElem();
    String lMessage;
    try {
      lMessage = lContextUElem.extendedStringOrXPathString(lContextUElem.attachDOM(), mMessage);
    } catch (ExActionFailed e) {
      throw new ExInternal("Message XPath error in fm:log command", e);
    }

    lMessage = XFUtil.nvl(lMessage, "[Null message]");

    XPathResult lXPathResult;
    if (!XFUtil.isNull(mXPath)) {
      try {
        lXPathResult = lContextUElem.extendedXPathResult(lContextUElem.attachDOM(), mXPath);
      } catch (ExActionFailed e) {
        throw new ExInternal("XPath error in fm:log command", e);
      }
    } else {
      lXPathResult = null;
    }

    Track.pushInfo("LogMessage", lMessage);
    try {
      if (lXPathResult != null) {
        StringBuffer lBuffer = new StringBuffer();
        lXPathResult.printResultAsXML(lBuffer);
        Track.logInfoXMLString("XPathResult", lBuffer.toString());
      }
    } finally {
      Track.pop("LogMessage");
    }

    return XDoControlFlowContinue.instance();
  }