public void analyzeSelectStmt()
        throws EFapsException
    {
        final Pattern mainPattern = Pattern.compile("[^.]+");
        final Pattern attrPattern = Pattern.compile("(?<=\\[)[0-9a-zA-Z_]*(?=\\])");
        final Pattern esjpPattern = Pattern.compile("(?<=\\[)[\\w\\d\\s,.\"]*(?=\\])");
        final Pattern linkfomPat = Pattern.compile("(?<=\\[)[0-9a-zA-Z_#:]*(?=\\])");
        final Pattern formatPat = Pattern.compile("(?<=\\[).*(?=\\])");
        final Pattern attrSetPattern = Pattern.compile("(?<=\\[)[0-9a-zA-Z_]+");
        final Pattern attrSetWherePattern = Pattern.compile("(?<=\\|).+(?=\\])");

        final Matcher mainMatcher = mainPattern.matcher(this.selectStmt);

        OneSelect currentSelect = this;
        while (mainMatcher.find()) {
            final String part = mainMatcher.group();
            if (part.startsWith("class[")) {
                final Matcher matcher = attrPattern.matcher(part);
                if (matcher.find()) {
                    currentSelect.addClassificationSelectPart(matcher.group());
                }
            } else if (part.startsWith("linkto")) {
                final Matcher matcher = attrPattern.matcher(part);
                if (matcher.find()) {
                    currentSelect.addLinkToSelectPart(matcher.group());
                }
            } else if (part.startsWith("attributeset")) {
                final Matcher matcher = attrSetPattern.matcher(part);
                if (matcher.find()) {
                    currentSelect.addValueSelect(new IDValueSelect(currentSelect));
                    final Matcher whereMatcher = attrSetWherePattern.matcher(part);
                    if (whereMatcher.find()) {
                        currentSelect.addAttributeSetSelectPart(matcher.group(), whereMatcher.group());
                    } else {
                        currentSelect.addAttributeSetSelectPart(matcher.group());
                    }
                    currentSelect = currentSelect.fromSelect.getMainOneSelect();
                }
            } else if (part.startsWith("attribute")) {
                final Matcher matcher = attrPattern.matcher(part);
                if (matcher.find()) {
                    currentSelect.addValueSelect(new AttributeValueSelect(currentSelect, matcher.group()));
                }
            } else if (part.startsWith("linkfrom")) {
                final Matcher matcher = linkfomPat.matcher(part);
                if (matcher.find()) {
                    currentSelect.addValueSelect(new IDValueSelect(currentSelect));
                    currentSelect.addLinkFromSelectPart(matcher.group());
                    currentSelect = currentSelect.fromSelect.getMainOneSelect();
                }
            } else if (part.startsWith("format")) {
                final Matcher matcher = formatPat.matcher(part);
                if (matcher.find()) {
                    currentSelect.addValueSelect(new FormatValueSelect(currentSelect, matcher.group()));
                }
            } else if (part.startsWith("esjp[")) {
                final String esjpPart = this.selectStmt.substring(this.selectStmt.indexOf("esjp["));
                final Matcher matcher = esjpPattern.matcher(esjpPart);
                if (matcher.find()) {
                    currentSelect.addValueSelect(new EsjpValueSelect(currentSelect, matcher.group()));
                }
            } else {
                switch (part) {
                    case "oid":
                        currentSelect.addValueSelect(new OIDValueSelect(currentSelect));
                        break;
                    case "type":
                        currentSelect.addValueSelect(new TypeValueSelect(currentSelect));
                        break;
                    case "instance":
                        currentSelect.addValueSelect(new InstanceValueSelect(currentSelect));
                        break;
                    case "label":
                        currentSelect.addValueSelect(new LabelValueSelect(currentSelect));
                        break;
                    case "id":
                        currentSelect.addValueSelect(new IDValueSelect(currentSelect));
                        break;
                    case "uuid":
                        currentSelect.addValueSelect(new UUIDValueSelect(currentSelect));
                        break;
                    case "name":
                        currentSelect.addValueSelect(new NameValueSelect(currentSelect));
                        break;
                    case "class":
                        currentSelect.addValueSelect(new ClassificationValueSelect(currentSelect));
                        break;
                    case "value":
                        currentSelect.addValueSelect(new ValueValueSelect(currentSelect));
                        break;
                    case "base":
                        currentSelect.addValueSelect(new BaseValueSelect(currentSelect));
                        break;
                    case "uom":
                        currentSelect.addValueSelect(new UoMValueSelect(currentSelect));
                        break;
                    case "file":
                        currentSelect.addFileSelectPart();
                        break;
                    case "length":
                        currentSelect.addValueSelect(new LengthValueSelect(currentSelect));
                        break;
                    case "status":
                        currentSelect.addValueSelect(new StatusValueSelect(currentSelect));
                        break;
                    case "key":
                        currentSelect.addValueSelect(new KeyValueSelect(currentSelect));
                        break;
                    default:
                        break;
                }
            }
        }
    }
public void analyzeSelectStmt ( ) throws EFapsException { final Pattern mainPattern = Pattern . compile ( "[^.]+" ) ; final Pattern attrPattern = Pattern . compile ( "(?<=\\[)[0-9a-zA-Z_]*(?=\\])" ) ; final Pattern esjpPattern = Pattern . compile ( "(?<=\\[)[\\w\\d\\s,.\"]*(?=\\])" ) ; final Pattern linkfomPat = Pattern . compile ( "(?<=\\[)[0-9a-zA-Z_#:]*(?=\\])" ) ; final Pattern formatPat = Pattern . compile ( "(?<=\\[).*(?=\\])" ) ; final Pattern attrSetPattern = Pattern . compile ( "(?<=\\[)[0-9a-zA-Z_]+" ) ; final Pattern attrSetWherePattern = Pattern . compile ( "(?<=\\|).+(?=\\])" ) ; final Matcher mainMatcher = mainPattern . matcher ( this . selectStmt ) ; OneSelect currentSelect = this ; while ( mainMatcher . find ( ) ) { final String part = mainMatcher . group ( ) ; if ( part . startsWith ( "class[" ) ) { final Matcher matcher = attrPattern . matcher ( part ) ; if ( matcher . find ( ) ) { currentSelect . addClassificationSelectPart ( matcher . group ( ) ) ; } } else if ( part . startsWith ( "linkto" ) ) { final Matcher matcher = attrPattern . matcher ( part ) ; if ( matcher . find ( ) ) { currentSelect . addLinkToSelectPart ( matcher . group ( ) ) ; } } else if ( part . startsWith ( "attributeset" ) ) { final Matcher matcher = attrSetPattern . matcher ( part ) ; if ( matcher . find ( ) ) { currentSelect . addValueSelect ( new IDValueSelect ( currentSelect ) ) ; final Matcher whereMatcher = attrSetWherePattern . matcher ( part ) ; if ( whereMatcher . find ( ) ) { currentSelect . addAttributeSetSelectPart ( matcher . group ( ) , whereMatcher . group ( ) ) ; } else { currentSelect . addAttributeSetSelectPart ( matcher . group ( ) ) ; } currentSelect = currentSelect . fromSelect . getMainOneSelect ( ) ; } } else if ( part . startsWith ( "attribute" ) ) { final Matcher matcher = attrPattern . matcher ( part ) ; if ( matcher . find ( ) ) { currentSelect . addValueSelect ( new AttributeValueSelect ( currentSelect , matcher . group ( ) ) ) ; } } else if ( part . startsWith ( "linkfrom" ) ) { final Matcher matcher = linkfomPat . matcher ( part ) ; if ( matcher . find ( ) ) { currentSelect . addValueSelect ( new IDValueSelect ( currentSelect ) ) ; currentSelect . addLinkFromSelectPart ( matcher . group ( ) ) ; currentSelect = currentSelect . fromSelect . getMainOneSelect ( ) ; } } else if ( part . startsWith ( "format" ) ) { final Matcher matcher = formatPat . matcher ( part ) ; if ( matcher . find ( ) ) { currentSelect . addValueSelect ( new FormatValueSelect ( currentSelect , matcher . group ( ) ) ) ; } } else if ( part . startsWith ( "esjp[" ) ) { final String esjpPart = this . selectStmt . substring ( this . selectStmt . indexOf ( "esjp[" ) ) ; final Matcher matcher = esjpPattern . matcher ( esjpPart ) ; if ( matcher . find ( ) ) { currentSelect . addValueSelect ( new EsjpValueSelect ( currentSelect , matcher . group ( ) ) ) ; } } else { switch ( part ) { case "oid" : currentSelect . addValueSelect ( new OIDValueSelect ( currentSelect ) ) ; break ; case "type" : currentSelect . addValueSelect ( new TypeValueSelect ( currentSelect ) ) ; break ; case "instance" : currentSelect . addValueSelect ( new InstanceValueSelect ( currentSelect ) ) ; break ; case "label" : currentSelect . addValueSelect ( new LabelValueSelect ( currentSelect ) ) ; break ; case "id" : currentSelect . addValueSelect ( new IDValueSelect ( currentSelect ) ) ; break ; case "uuid" : currentSelect . addValueSelect ( new UUIDValueSelect ( currentSelect ) ) ; break ; case "name" : currentSelect . addValueSelect ( new NameValueSelect ( currentSelect ) ) ; break ; case "class" : currentSelect . addValueSelect ( new ClassificationValueSelect ( currentSelect ) ) ; break ; case "value" : currentSelect . addValueSelect ( new ValueValueSelect ( currentSelect ) ) ; break ; case "base" : currentSelect . addValueSelect ( new BaseValueSelect ( currentSelect ) ) ; break ; case "uom" : currentSelect . addValueSelect ( new UoMValueSelect ( currentSelect ) ) ; break ; case "file" : currentSelect . addFileSelectPart ( ) ; break ; case "length" : currentSelect . addValueSelect ( new LengthValueSelect ( currentSelect ) ) ; break ; case "status" : currentSelect . addValueSelect ( new StatusValueSelect ( currentSelect ) ) ; break ; case "key" : currentSelect . addValueSelect ( new KeyValueSelect ( currentSelect ) ) ; break ; default : break ; } } } }
Method to analyse the select statement. Meaning the the different
select parts will be added to {@link #selectParts}.
@throws EFapsException on error