/** instead of save the entity into backend, we save it in to the importSchema entity */
  @Override
  protected void saveWithManager(ActionContext actionContext, IGTManager manager, IGTEntity entity)
      throws GTClientException {
    try {
      OperationContext op = OperationContext.getOperationContext(actionContext.getRequest());
      String index =
          (String)
              op.getAttribute(
                  INDEX_KEY); // It can be used to differentiate whether we are saving a new entity
                              // or an existing one
      // I followed the existing implementation, so didn't use boolean.

      IGTImportSchemaEntity importSchema = getImportSchema(actionContext);
      ArrayList schemaMappingList =
          (ArrayList) importSchema.getFieldValue(IGTImportSchemaEntity.SCHEMA_MAPPING);

      if ("new".equals(index)) {
        schemaMappingList.add(entity);
      }
    } catch (Exception ex) {
      throw new GTClientException(
          "[SchemaMappingFileDispatchAction.saveWithManager] Error perfroming saving in ImportSchema entity",
          ex);
    }
  }
  /** Override super class method to perform additional population for Operation Context */
  @Override
  protected void processPreparedOperationContext(
      ActionContext actionContext, OperationContext opContext) throws GTClientException {
    try {
      IGTSchemaMappingFileEntity entity = null;
      String indexString = actionContext.getRequest().getParameter("index");
      opContext.setAttribute(INDEX_KEY, indexString); // so that when we save the entity,
      // we can differentiate whether we are saving
      // a new entity or an existing entity. (see detail in saveWithManager)

      if (indexString != null) {
        if (!indexString.equals("new")) {
          try {
            int index = Integer.parseInt(indexString);
            IGTImportSchemaEntity importSchema = getImportSchema(actionContext);
            ArrayList schemaMappingList =
                (ArrayList) importSchema.getFieldValue(IGTImportSchemaEntity.SCHEMA_MAPPING);
            if (schemaMappingList == null) {
              throw new NullPointerException(
                  "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Null value for schemaMappingList.");
            }
            try {
              entity = (IGTSchemaMappingFileEntity) schemaMappingList.get(index);
            } catch (Throwable t) {
              throw new GTClientException(
                  "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Error retrieving schemaMappingFile entity from list at index "
                      + index,
                  t);
            }
            if (entity == null) {
              throw new java.lang.NullPointerException(
                  "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Null entity object at index "
                      + index
                      + " of schemaMappingList list retrieved from ImportSchema entity "
                      + importSchema);
            }
          } catch (Throwable t) {
            throw new GTClientException(
                "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Error retrieving schemaMappingFile entity object from"
                    + " importSchema entity in parent OperationContext",
                t);
          }
        } else {
          entity = (IGTSchemaMappingFileEntity) getRequestedEntity(actionContext);
        }
      } else {
        throw new GTClientException(
            "[SchemaMappingFileDispatchAction.processPreparedOperationContext]No index specified");
      }
      opContext.setAttribute(IOperationContextKeys.ENTITY, entity);
      ActionForward submitForward = actionContext.getMapping().findForward("submit");
      opContext.setAttribute(IOperationContextKeys.FORM_SUBMIT_URL, submitForward.getPath());
    } catch (Exception ex) {
      throw new GTClientException(
          "[SchemaMappingFileDispatchAction.processPreparedOperationContext] Error obtaining SchemaMappingFile entity object",
          ex);
    }
  }