Move the HTML input to the screen record fields.
@param strSuffix value to add to the end of the field name before retrieving the param.
@exception DBException File exception.
@return bParamsFound True if params were found and moved.
770349
public int moveControlInput(String strSuffix)
        throws DBException
    {
        int iDefaultParamsFound = DBConstants.NO_PARAMS_FOUND;
        if ((((GridScreen)this.getScreenField()).getEditing())
            && (this.getTask() instanceof ServletTask))
        {
            // First, go through all the params and find out which rows have been submitted.
            Record record = this.getMainRecord();
            Record recCurrent = null;
            ServletTask task = (ServletTask)this.getTask();
            Map<String,Object> ht = task.getRequestProperties(task.getServletRequest(), false);
            for (String strParamName : ht.keySet())
            {
                try   {
                    strParamName = URLDecoder.decode(strParamName, DBConstants.URL_ENCODING);
                } catch (java.io.UnsupportedEncodingException ex) {
                    ex.printStackTrace();
                }
                int iAtPosition = strParamName.indexOf('@');
                if (iAtPosition != -1)
                {
//                    String strFieldName = strParamName.substring(0, iAtPosition);
                    String strObjectID = strParamName.substring(iAtPosition + 1);
                    if (ht.get(strObjectID) == null)
                        ht.put(strObjectID, strObjectID);   // Add this unique row
                }
            }
            // Now go through each record; read the record, update the fields, and update the record (if changed).
            for (String strObjectID : ht.keySet())
            {
                int iRawDBType = (record.getDatabaseType() & DBConstants.TABLE_TYPE_MASK);
                if ((iRawDBType == DBConstants.LOCAL)
                        || (iRawDBType == DBConstants.REMOTE)
                            || (iRawDBType == DBConstants.TABLE))
                    recCurrent = record.setHandle(strObjectID, DBConstants.OBJECT_ID_HANDLE);
                else
                {
                    recCurrent = record.setHandle(strObjectID, DBConstants.BOOKMARK_HANDLE);    // Non-persistent
                }
                if (recCurrent != null)
                    if (recCurrent.getEditMode() == DBConstants.EDIT_CURRENT)
                {
                    recCurrent.edit();      // HACK - Change to lock on mod
                    iDefaultParamsFound = super.moveControlInput('@' + strObjectID);
                    if (recCurrent.isModified())
                    {
                        recCurrent.set();
                    }
                }
            }
        }
        int iParamsFound = super.moveControlInput(strSuffix);
        if (iParamsFound == DBConstants.NORMAL_RETURN)
            iDefaultParamsFound = DBConstants.NORMAL_RETURN;
        return iDefaultParamsFound;
    }
1339472
public boolean moveFields(Record recSource, ResourceBundle resource, boolean bDisplayOption, int iMoveMode, boolean bAllowFieldChange, boolean bOnlyModifiedFields, boolean bMoveModifiedState, boolean syncSelection)
    {
        boolean bFieldsMoved = false;
        for (int iFieldSeq = 0; iFieldSeq < this.getFieldCount(); iFieldSeq++)
        {
            BaseField fldDest = this.getField(iFieldSeq);
            BaseField fldSource = null;
            try   {
                if (resource == Record.MOVE_BY_NAME)
                {
                    String strSourceField = fldDest.getFieldName();
                    fldSource = recSource.getField(strSourceField);
                }
                else if (resource != null)
                {
                    String strSourceField = resource.getString(fldDest.getFieldName());    // Lookup source field name from dest
                    if ((strSourceField != null) && (strSourceField.length() > 0))
                        fldSource = recSource.getField(strSourceField);
                }
                else // if (resource == null)
                {
                    fldSource = recSource.getField(iFieldSeq);
                }
            } catch (MissingResourceException ex) {
                fldSource = null;
            }
            if (fldSource != null)
            {
                if ((!bOnlyModifiedFields) || (fldSource.isModified()))
                {
                    boolean[] rgbEnabled = null;
                    if (bAllowFieldChange == false)    // Don't enable a disabled field listener
                        rgbEnabled = fldDest.setEnableListeners(bAllowFieldChange);                  // Don't call the HandleFieldChanged beh until ALL inited!
                    
                    FieldDataScratchHandler listenerScratchData = null;
                    if ((bAllowFieldChange == false) && (bMoveModifiedState))
                    	if (iMoveMode == DBConstants.READ_MOVE)	// Very obscure - Make sure this fake read move does not change the scratch area
                    		if (fldDest.getNextValidListener(iMoveMode) instanceof FieldDataScratchHandler)	// Always enable would have to be true since listeners have been disabled
                    			(listenerScratchData = ((FieldDataScratchHandler)fldDest.getNextValidListener(iMoveMode))).setAlwaysEnabled(false);

                    fldDest.moveFieldToThis(fldSource, bDisplayOption, iMoveMode);
                    
                    if (listenerScratchData != null)
                    	listenerScratchData.setAlwaysEnabled(true);
                    
                    if (rgbEnabled != null)
                        fldDest.setEnableListeners(rgbEnabled);
                    if (bAllowFieldChange == false)
                        fldDest.setModified(false); // At this point, no changes have been done
                    bFieldsMoved = true;
                }
                if ((bAllowFieldChange) || (bMoveModifiedState))
                    fldDest.setModified(fldSource.isModified()); // If you allow field change set if source is modified.
                if (syncSelection)
                    fldDest.setSelected(fldSource.isSelected());
            }
        }
        return bFieldsMoved;
    }
311406
public FieldList move(int iRelPosition) throws DBException
    {
        Record record = (Record)super.move(iRelPosition);
        Iterator<BaseTable> iterator = this.getTables();
        while (iterator.hasNext())
        {
            BaseTable table = iterator.next();
            if ((table != null) && (table != this.getNextTable()))
                this.syncTables(table, record);
        }
        return record;
    }
350554
protected void appendStringType(StringBuilder sb, FieldType fieldType, int fieldWidth) {
		if (isVarcharFieldWidthSupported()) {
			sb.append("VARCHAR(").append(fieldWidth).append(')');
		} else {
			sb.append("VARCHAR");
		}
	}
1367876
public boolean hasNext() throws DBException
    {
        if (m_iCurrentRecord >= m_iRecordsAccessed)
            return true;
        Object record = this.next();
        if (record == null)
            return false;
        else
        {
            m_iRecordsAccessed--;   // Offically this record has not been accessed
            return true;
        }
    }
746253
final public void BracketSuffix() throws ParseException {
                                       /*@bgen(jjtree) BracketSuffix */
  AstBracketSuffix jjtn000 = new AstBracketSuffix(JJTBRACKETSUFFIX);
  boolean jjtc000 = true;
  jjtree.openNodeScope(jjtn000);
    try {
      jj_consume_token(LBRACK);
      Expression();
      jj_consume_token(RBRACK);
    } catch (Throwable jjte000) {
      if (jjtc000) {
        jjtree.clearNodeScope(jjtn000);
        jjtc000 = false;
      } else {
        jjtree.popNode();
      }
      if (jjte000 instanceof RuntimeException) {
        {if (true) throw (RuntimeException)jjte000;}
      }
      if (jjte000 instanceof ParseException) {
        {if (true) throw (ParseException)jjte000;}
      }
      {if (true) throw (Error)jjte000;}
    } finally {
      if (jjtc000) {
        jjtree.closeNodeScope(jjtn000, true);
      }
    }
  }
74515
public synchronized BaseBuffer seek(String strSeekSign, FieldTable table) throws DBException
    {
        int iKeyOrder = table.getRecord().getDefaultOrder();
        if (iKeyOrder == -1)
            iKeyOrder = Constants.MAIN_KEY_AREA;
        if (m_VKeyList == null)
            this.open(table);   // First time, set up
        PKeyArea vKeyArea = this.getPKeyArea(iKeyOrder);
        KeyAreaInfo keyArea = table.getRecord().getKeyArea(iKeyOrder);
        if (keyArea == null)
            throw new DBException(Constants.INVALID_KEY);
        try   {
            BaseBuffer buffer = vKeyArea.doSeek(strSeekSign, table, keyArea);
            this.saveCurrentKeys(table, buffer, (buffer == null));
            return buffer;
        } catch (DBException ex)    {
            throw ex;
        }
    }
560721
private void appendAffixPattern(StringBuffer buffer, boolean isNegative, boolean isPrefix,
                                    boolean localized) {
        String affixPat = null;
        if (isPrefix) {
            affixPat = isNegative ? negPrefixPattern : posPrefixPattern;
        } else {
            affixPat = isNegative ? negSuffixPattern : posSuffixPattern;
        }

        // When there is a null affix pattern, we use the affix itself.
        if (affixPat == null) {
            String affix = null;
            if (isPrefix) {
                affix = isNegative ? negativePrefix : positivePrefix;
            } else {
                affix = isNegative ? negativeSuffix : positiveSuffix;
            }
            // Do this crudely for now: Wrap everything in quotes.
            buffer.append(QUOTE);
            for (int i = 0; i < affix.length(); ++i) {
                char ch = affix.charAt(i);
                if (ch == QUOTE) {
                    buffer.append(ch);
                }
                buffer.append(ch);
            }
            buffer.append(QUOTE);
            return;
        }

        if (!localized) {
            buffer.append(affixPat);
        } else {
            int i, j;
            for (i = 0; i < affixPat.length(); ++i) {
                char ch = affixPat.charAt(i);
                switch (ch) {
                case QUOTE:
                    j = affixPat.indexOf(QUOTE, i + 1);
                    if (j < 0) {
                        throw new IllegalArgumentException("Malformed affix pattern: " + affixPat);
                    }
                    buffer.append(affixPat.substring(i, j + 1));
                    i = j;
                    continue;
                case PATTERN_PER_MILLE:
                    ch = symbols.getPerMill();
                    break;
                case PATTERN_PERCENT:
                    ch = symbols.getPercent();
                    break;
                case PATTERN_MINUS_SIGN:
                    ch = symbols.getMinusSign();
                    break;
                }
                // check if char is same as any other symbol
                if (ch == symbols.getDecimalSeparator() || ch == symbols.getGroupingSeparator()) {
                    buffer.append(QUOTE);
                    buffer.append(ch);
                    buffer.append(QUOTE);
                } else {
                    buffer.append(ch);
                }
            }
        }
    }
700779
public boolean retrieveField(BaseField field)
    {
        String strFieldName = field.getFieldName();   // Fieldname only
        String strData = (String)this.getProperty(strFieldName);
        boolean bFound = false;
        if (strData != null)
        {
            field.setString(strData, DBConstants.DISPLAY, DBConstants.INIT_MOVE);
            bFound = true;
        }
        return bFound;
    }
347166
public boolean processServletCommand()
        throws DBException
    {
        String strCommand = this.getProperty(DBParams.COMMAND);        // Display record
        if (strCommand == null)
            strCommand = Constants.BLANK;
        boolean bSuccess = false;
        if (this.getScreenField() instanceof BasePanel)
        {   // Always
            if (strCommand.equalsIgnoreCase(ThinMenuConstants.FIRST))
                bSuccess = ((BasePanel)this.getScreenField()).onMove(DBConstants.FIRST_RECORD);
            else if (strCommand.equalsIgnoreCase(ThinMenuConstants.PREVIOUS))
                bSuccess = ((BasePanel)this.getScreenField()).onMove(DBConstants.PREVIOUS_RECORD);
            else if (strCommand.equalsIgnoreCase(ThinMenuConstants.NEXT))
                bSuccess = ((BasePanel)this.getScreenField()).onMove(DBConstants.NEXT_RECORD);
            else if (strCommand.equalsIgnoreCase(ThinMenuConstants.LAST))
                bSuccess = ((BasePanel)this.getScreenField()).onMove(DBConstants.LAST_RECORD);
            else if (strCommand.equalsIgnoreCase(ThinMenuConstants.SUBMIT))
                bSuccess = ((BasePanel)this.getScreenField()).onAdd();
            else if (strCommand.equalsIgnoreCase(ThinMenuConstants.DELETE))
                bSuccess = ((BasePanel)this.getScreenField()).onDelete();
            else
            { // Must have sent a user-defined command (send command to this screen)
                bSuccess = false;   // Too dangerous ((BasePanel)this.getScreenField()).handleCommand(strCommand, this.getScreenField(), false);
            }
        }
        return bSuccess;
    }
368720
public void fieldsToData(Rec record) throws DBException
    {
        try   {
            int iFieldTypes = BaseBuffer.PHYSICAL_FIELDS;
            if (!((Record)record).isAllSelected())
                iFieldTypes = BaseBuffer.DATA_FIELDS;   //SELECTED_FIELDS; (Selected and physical)
            m_dataSource = new VectorBuffer(null, iFieldTypes);   //x new StringBuff();
            ((BaseBuffer)m_dataSource).fieldsToBuffer((FieldList)record);
        } catch (Exception ex) {
            throw DatabaseException.toDatabaseException(ex);
        }
    }
415092
public synchronized void add(FieldTable table) throws DBException
    {
        if (m_VKeyList == null)
            this.initKeyAreas(table);

        BaseBuffer bufferNew = (BaseBuffer)table.getDataSource(); // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
        if (table.getRecord().getEditMode() == Constants.EDIT_ADD)
        {
            for (int iKeyArea = Constants.MAIN_KEY_AREA; iKeyArea < table.getRecord().getKeyAreaCount() + Constants.MAIN_KEY_AREA; iKeyArea++)
            {
                try   {
                    if (iKeyArea == Constants.MAIN_KEY_AREA)
                    {   // Special logic to set auto-counter field
                        FieldInfo field = table.getRecord().getCounterField();
                        if (field != null)
                            if (!field.isNull())
                                if (!table.getRecord().isAutoSequence())
                        {   // Autosequence disabled
                            int iValue = (int)field.getValue();
                            if (iValue >= m_iCounter)
                                m_iCounter = iValue + 1;    // New next counter value
                            field = null;   // Special case - autosequence is disabled, so write the field as is.
                        }
                        if (field != null)
                        {
                            field.setValue(m_iCounter++, Constants.DONT_DISPLAY, Constants.READ_MOVE);  // ReadMove keeps this method from being called again
                            table.fieldsToData(table.getRecord()); // Update buffer
                            bufferNew = (BaseBuffer)table.getDataSource();  // same as .getHandle(Constants.DATA_SOURCE_HANDLE);
                        }
                    }
                    bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                    this.getPKeyArea(iKeyArea).doWrite(table, table.getRecord().getKeyArea(iKeyArea), bufferNew);
                } catch (DBException ex)    {
                    if (ex.getErrorCode() == Constants.DUPLICATE_KEY)
                    {
                        iKeyArea--;     // Duplicate key, delete all keys added so far!!!
                        while (iKeyArea >= Constants.MAIN_KEY_AREA)
                        {
                            bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
                            this.getPKeyArea(iKeyArea).doRemove(table, table.getRecord().getKeyArea(iKeyArea), bufferNew);
                            iKeyArea--;
                        }
                    }
                    throw ex;
                }
            }
            // Restore the record before returing (key.doWrite probably changed it).
            bufferNew.bufferToFields(table.getRecord(), Constants.DONT_DISPLAY, Constants.READ_MOVE);
        }
        else
            throw new DBException(Constants.INVALID_RECORD);
    }
630339
final public void ValueSuffix() throws ParseException {
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case DOT:
      DotSuffix();
      break;
    case LBRACK:
      BracketSuffix();
      break;
    default:
      jj_la1[35] = jj_gen;
      jj_consume_token(-1);
      throw new ParseException();
    }
    switch ((jj_ntk==-1)?jj_ntk():jj_ntk) {
    case LPAREN:
      MethodParameters();
      break;
    default:
      jj_la1[36] = jj_gen;
      ;
    }
  }
578661
public AbstractPrintQuery addMsgPhrase(final SelectBuilder _selectBldr,
                                           final MsgPhrase... _msgPhrase)
        throws EFapsException
    {
        final String baseSel;
        if (_selectBldr == null) {
            baseSel = "";
        } else {
            baseSel = _selectBldr.toString() + ".";
        }
        for (final MsgPhrase phrase : _msgPhrase) {
            for (final String selectStmt : phrase.getArguments()) {
                addSelect(baseSel + selectStmt);
            }
        }
        return this;
    }
439350
public static DatabaseException toDatabaseException(Exception ex)
    {
        if (ex instanceof DatabaseException)
            return (DatabaseException)ex;
        int iErrorCode = DBConstants.ERROR_STRING;
        if (ex instanceof DBException)
            iErrorCode = ((DBException)ex).getErrorCode();
        String strMessage = ex.getMessage();
        if (strMessage != null)
            if (strMessage.startsWith(DBEXCEPTION_TEXT))
        {
            int iNextPos = strMessage.indexOf(' ', DBEXCEPTION_TEXT.length());
            if (iNextPos != -1)
            {
                iErrorCode = Integer.parseInt(strMessage.substring(DBEXCEPTION_TEXT.length(), iNextPos));
                if (iNextPos + 1 < strMessage.length())
                    strMessage = strMessage.substring(iNextPos + 1);
            }
        }
        return new DatabaseException(iErrorCode, strMessage);
    }
820471
public void registerPrefixStatsSinglePositionValue(String field,
      String prefix, IndexOutput outPrefix) throws IOException {
    initPrefixStatsField(field);
    registerPrefix(field, prefix, outPrefix);
    if (!multiplePositionPrefix.get(field).contains(prefix)) {
      singlePositionPrefix.get(field).add(prefix);
    }
  }
263576
Expr indexMethodField(Expr expr) {
		if (expr == null) {
			expr = map();
		}
		
		// Expr expr = map();
		while (true) {
			Tok tok = peek();
			// expr [ expr ]
			if (tok.sym == Sym.LBRACK) {
				move();
				Expr index = expr();
				match(Sym.RBRACK);
				expr = new Index(expr, index, location);
				continue;
			}
			if (tok.sym != Sym.DOT) {
				return expr;
			}
			if ((tok = move()).sym != Sym.ID) {
				resetForward(forward - 1);
				return expr;
			}
			
			move();
			if (peek().sym != Sym.LPAREN) {
				expr = new Field(expr, tok.value(), location);
				continue;
			}
			
			move();
			// expr '.' ID '(' ')'
			if (peek().sym == Sym.RPAREN) {
				move();
				expr = new Method(expr, tok.value(), location);
				continue;
			}
			
			// expr '.' ID '(' exprList ')'
			ExprList exprList = exprList();
			match(Sym.RPAREN);
			expr = new Method(expr, tok.value(), exprList, location);
		}
	}