コード例 #1
0
 private BungeniMessage validateAction_TextSelectedInsertAction_DebateDateEntry() {
   int nRetValue = -1;
   /*
   if (m_subAction.system_container().length() > 0 ) {
       nRetValue = check_systemContainerExists();
       if (nRetValue == BungeniError.SYSTEM_CONTAINER_NOT_PRESENT){
           return new BungeniMessage(BungeniError.TEXT_SELECTED_INSERT_ACTION_FAIL, nRetValue);
       }
       nRetValue = this.check_generic_systemContainerCheck();
           switch (nRetValue) {
               case BungeniError.SYSTEM_CONTAINER_ALREADY_EXISTS:
               case BungeniError.SYSTEM_CONTAINER_WRONG_POSITION:
               case BungeniError.INVALID_CONTAINER_FOR_SYSTEM_ACTION:
                   return new BungeniMessage(BungeniError.TEXT_SELECTED_INSERT_ACTION_FAIL, nRetValue);
               default:
                   return new BungeniMessage(BungeniError.TEXT_SELECTED_INSERT_ACTION_PROCEED, nRetValue);
            }
   } else { */
   String currentSection = ooDocument.currentSectionName();
   nRetValue = this.check_containment(currentSection);
   if (nRetValue == BungeniError.VALID_SECTION_CONTAINER)
     return new BungeniMessage(
         BungeniError.TEXT_SELECTED_INSERT_ACTION_PROCEED, BungeniError.VALID_SECTION_CONTAINER);
   else
     return new BungeniMessage(
         BungeniError.TEXT_SELECTED_INSERT_ACTION_FAIL, BungeniError.INVALID_SECTION_CONTAINER);
   /* } */
 }
コード例 #2
0
  private BungeniMessage validateAction_TextSelectedInsertAction_CreateSection() {
    int nRetValue = -1;

    // 1st tier, root container check
    nRetValue = check_rootContainerExists();
    if (nRetValue == BungeniError.DOCUMENT_ROOT_DOES_NOT_EXIST) {
      return new BungeniMessage(
          BungeniError.TEXT_SELECTED_INSERT_ACTION_FAIL, BungeniError.DOCUMENT_ROOT_DOES_NOT_EXIST);
    }
    // 2nd tier validation ...check up the hierarchy
    // check if there is a current section, and if the section can be created in the current section
    String currentSectionname = ooDocument.currentSectionName();
    nRetValue = check_containment(currentSectionname);
    if (nRetValue == BungeniError.INVALID_SECTION_CONTAINER) {
      return new BungeniMessage(
          BungeniError.TEXT_SELECTED_INSERT_ACTION_FAIL, BungeniError.INVALID_SECTION_CONTAINER);
    }

    // 3rd tier validation
    // check if section already exists (only for single type section)
    nRetValue = check_actionSectionExists();
    if (nRetValue == BungeniError.SECTION_EXISTS) {
      return new BungeniMessage(
          BungeniError.TEXT_SELECTED_INSERT_ACTION_FAIL, BungeniError.SECTION_EXISTS);
    }

    return new BungeniMessage(BungeniError.TEXT_SELECTED_INSERT_ACTION_PROCEED, nRetValue);
  }
コード例 #3
0
 private int check_systemContainerPositionCheck() {
   String systemContainer = m_subAction.system_container();
   if (ooDocument.hasSection(systemContainer)) {
     String currentSection = ooDocument.currentSectionName();
     if (currentSection.equals(systemContainer)) {
       return BungeniError.SYSTEM_CONTAINER_ALREADY_EXISTS;
     } else {
       return BungeniError.SYSTEM_CONTAINER_WRONG_POSITION;
     }
   } else {
     return BungeniError.SYSTEM_CONTAINER_CHECK_OK;
   }
 }
コード例 #4
0
 private int check_canSystemContainerBeCreated() {
   // this is the actual container section type
   String containerSectionType = m_parentAction.action_section_type();
   // this is the current section where the cursor is, we want to compare actual container
   // section type with required.
   String currentSection = ooDocument.currentSectionName();
   HashMap<String, String> metaMap = ooDocument.getSectionMetadataAttributes(currentSection);
   if (metaMap.containsKey("BungeniSectionType")) {
     String currentSectionType = metaMap.get("BungeniSectionType");
     if (currentSectionType.equals(containerSectionType)) {
       return BungeniError.VALID_CONTAINER_FOR_SYSTEM_ACTION;
     } else {
       return BungeniError.INVALID_CONTAINER_FOR_SYSTEM_ACTION;
     }
   } else return BungeniError.INVALID_CONTAINER_FOR_SYSTEM_ACTION;
 }