public boolean preValidationFullInsert() {
    boolean bResult = true;
    try {
      // check root
      dbSettings.Connect();
      QueryResults qr =
          dbSettings.QueryResults(
              SettingsQueryFactory.Q_CHECK_IF_ACTION_HAS_PARENT(
                  theAction.action_naming_convention()));
      dbSettings.EndConnect();
      String[] results = qr.getSingleColumnResult("THE_COUNT");
      if (results[0].equals("0")) {
        if (!ooDocument.hasSection("root")) {
          checkFieldsMessages.add("The document does not have a root section!");
          bResult = false;
          return bResult;
        }
      }

      if (ooDocument.hasSection(theAction.action_naming_convention())) {
        checkFieldsMessages.add(
            "The document already has a papers section, please delete the section first");
        bResult = false;
        return bResult;
      }

    } catch (Exception ex) {
      log.error("preValidation : " + ex.getMessage());
      bResult = false;
    } finally {
      return bResult;
    }
  }
 private int check_containment_RootSection(String currentSectionname) {
   // check if the current section can have the root section as a parent
   String strQuery =
       "Select count(*) as THE_COUNT from ACTION_PARENT where ACTION_NAME='"
           + m_parentAction.action_name()
           + "'";
   dbSettings.Connect();
   QueryResults qr = dbSettings.QueryResults(strQuery);
   dbSettings.EndConnect();
   if (qr.hasResults()) {
     String[] theCount = qr.getSingleColumnResult("THE_COUNT");
     if (theCount[0].equals("0")) {
       // the section can have the root section as its container
       return BungeniError.VALID_SECTION_CONTAINER;
     } else {
       return BungeniError.INVALID_SECTION_CONTAINER;
     }
   } else {
     return BungeniError.INVALID_SECTION_CONTAINER;
   }
 }
  private int check_containment_Section(String currentContainerSection) {

    int error = BungeniError.GENERAL_ERROR;
    try {
      // get valid parent actions
      String strActionName = m_parentAction.action_name();
      dbSettings.Connect();
      String fetchParentQuery = SettingsQueryFactory.Q_FETCH_PARENT_ACTIONS(strActionName);
      log.debug("checkContainmentSection = " + fetchParentQuery);
      QueryResults qr = dbSettings.QueryResults(fetchParentQuery);
      dbSettings.EndConnect();
      String[] actionSectionTypes = qr.getSingleColumnResult("ACTION_SECTION_TYPE");
      // there can be multiple parents... so we iterate through the array if one of them is a valid
      // parent

      HashMap<String, String> sectionMetadata =
          ooDocument.getSectionMetadataAttributes(currentContainerSection);
      // if (sectionMetadata.get)
      String strDocSectionType = "";
      if (sectionMetadata.containsKey("BungeniSectionType")) {
        strDocSectionType = sectionMetadata.get("BungeniSectionType").trim();
        // check the doc section type against the array of valid action section types
        for (String sectionType : actionSectionTypes) {
          if (strDocSectionType.equals(sectionType.trim())) {
            error = BungeniError.VALID_SECTION_CONTAINER;
            break;
          } else {
            error = BungeniError.INVALID_SECTION_CONTAINER;
          }
        }
      } else {
        error = BungeniError.INVALID_SECTION_CONTAINER;
      }
    } catch (Exception ex) {
      log.error("check_containmentSection : " + ex.getMessage());
      log.error("check_containmentSection : " + CommonExceptionUtils.getStackTrace(ex));
    } finally {
      return error;
    }
  }