Search in sources :

Example 6 with DfSPolicyStatement

use of org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement in project dbflute-core by dbflute.

the class DfSPolicyMiscSecretary method parseStatement.

// ===================================================================================
// Statement
// =========
public DfSPolicyStatement parseStatement(String statement) {
    if (!statement.startsWith("if ")) {
        String msg = "The element of statementList should start with 'if' for SchemaPolicyCheck: " + statement;
        throw new IllegalStateException(msg);
    }
    final ScopeInfo ifScope = Srl.extractScopeFirst(statement, "if ", " then ");
    if (ifScope == null) {
        final String additional = "The statement should start with 'if' and contain 'then'.";
        throwSchemaPolicyCheckIllegalIfThenStatementException(statement, additional);
    }
    final DfSPolicyIfClause ifClause = analyzeIfClause(statement, ifScope);
    final DfSPolicyThenClause thenClause = analyzeThenClause(statement, ifScope);
    return new DfSPolicyStatement(statement, ifClause, thenClause);
}
Also used : DfSPolicyStatement(org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement) DfSPolicyThenClause(org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement.DfSPolicyThenClause) ScopeInfo(org.dbflute.util.Srl.ScopeInfo) DfSPolicyIfClause(org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement.DfSPolicyIfClause)

Aggregations

DfSPolicyStatement (org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement)6 DfSPolicyThenClause (org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement.DfSPolicyThenClause)4 DfSPolicyIfClause (org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement.DfSPolicyIfClause)3 DfSPolicyIfPart (org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement.DfSPolicyIfPart)2 ScopeInfo (org.dbflute.util.Srl.ScopeInfo)2 List (java.util.List)1 Function (java.util.function.Function)1 Column (org.apache.torque.engine.database.model.Column)1 ForeignKey (org.apache.torque.engine.database.model.ForeignKey)1 Index (org.apache.torque.engine.database.model.Index)1 Table (org.apache.torque.engine.database.model.Table)1 Unique (org.apache.torque.engine.database.model.Unique)1 DfSchemaPolicyCheckUnknownVariableException (org.dbflute.exception.DfSchemaPolicyCheckUnknownVariableException)1 DfSPolicyThenPart (org.dbflute.logic.doc.spolicy.parsed.DfSPolicyStatement.DfSPolicyThenPart)1 DfSPolicyResult (org.dbflute.logic.doc.spolicy.result.DfSPolicyResult)1 DfSPolicyFirstDateSecretary (org.dbflute.logic.doc.spolicy.secretary.DfSPolicyFirstDateSecretary)1 DfSPolicyLogicalSecretary (org.dbflute.logic.doc.spolicy.secretary.DfSPolicyLogicalSecretary)1 Srl (org.dbflute.util.Srl)1