Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright 2014-2015 the original author or authors.
   *
   * Licensed under the Apache License, Version 2.0 (the "License");
   * you may not use this file except in compliance with the License.
   * You may obtain a copy of the License at
   *
   *     http://www.apache.org/licenses/LICENSE-2.0
   *
  * Unless required by applicable law or agreed to in writing, software
  * distributed under the License is distributed on an "AS IS" BASIS,
  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND,
  * either express or implied. See the License for the specific language
  * governing permissions and limitations under the License.
  */
 package org.dbflute.cbean;
 
 import java.util.Map;
 
The bean for condition.

Author(s):
jflute
 
 public interface ConditionBean extends PagingBeanWelcomeToDreamCruise {
 
     // ===================================================================================
     //                                                                             DB Meta
     //                                                                             =======
     
Handle the meta as DBMeta, that has all info of the table.

Returns:
The (singleton) instance of DB meta for the table. (NotNull)
 
     DBMeta asDBMeta();

    
Handle the meta as table DB name, that can be identity of table..

Returns:
The (fixed) DB name of the table. (NotNull)
 
     String asTableDbName();
 
     // ===================================================================================
     //                                                                           SqlClause
     //                                                                           =========
     
Get SQL clause instance. {Internal}

Returns:
The object for SQL clause. (NotNull)
 
 
     // ===================================================================================
     //                                                                 PrimaryKey Handling
     //                                                                 ===================
     
Accept the map of primary-keys. map:{[column-name] = [value]}

Parameters:
primaryKeyMap The map of primary-keys. (NotNull and NotEmpty)
 
     void acceptPrimaryKeyMap(Map<String, ? extends ObjectprimaryKeyMap);

    
Add order-by PrimaryKey asc. {order by primaryKey1 asc, primaryKey2 asc...}

Returns:
this. (NotNull)
 
     ConditionBean addOrderBy_PK_Asc();

    
Add order-by PrimaryKey desc. {order by primaryKey1 desc, primaryKey2 desc...}

Returns:
this. (NotNull)
 
 
     // ===================================================================================
     //                                                                             Specify
     //                                                                             =======
     
Get the handler of the column specification as interface.

Returns:
The instance of column specification. (NotNull: instance is created if null)
 
     HpColumnSpHandler localSp();

    
Does it have specified columns for the local table at least one?
(without new-creation of specification instance)

Returns:
The determination, true or false.
    boolean hasSpecifiedLocalColumn();
    // make when it needs (for compile speed)
    ///**
    // * Does it have specified columns at least one? (without new-creation of specification instance)
    // * @return The determination, true or false.
    // */
    //boolean hasSpecifiedRelationColumn();

    
Does it have specified columns at least one? (without new-creation of specification instance)

Deprecated:
use hasSpecifiedLocalColumn()
Returns:
The determination, true or false.
    boolean hasSpecifiedColumn();
    // ===================================================================================
    //                                                                               Query
    //                                                                               =====
    
Get the conditionQuery of the local table as interface.

Returns:
The instance of conditionQuery. (NotNull: instance is created if null)
    ConditionQuery localCQ();

    
Enable to auto-detect joins that can be inner-join. (back to default)
 o You should call this before registrations of where clause.
 o Union and SubQuery and other sub condition-bean inherit this.
 o You should confirm your SQL on the log to be tuned by inner-join correctly.
 
    void enableInnerJoinAutoDetect();

    
Disable auto-detecting inner-join. (default is enabled)
You should call this before registrations of where clause.
    // ===================================================================================
    //                                                                        Dream Cruise
    //                                                                        ============
    
Invite the derived column to dream cruise. (returns the ticket)

Parameters:
derivedAlias The alias name for derived column. (NotNull)
Returns:
The ticket column specified by your Dream Cruise. (NotNull)
    SpecifiedColumn inviteDerivedToDreamCruise(String derivedAlias); // user interface

    
Create condition-bean for dream cruise.

Returns:
The created condition-bean for Dream Cruise. (NotNull)
Mark as departure port for dream cruise.
    void xmarkAsDeparturePortForDreamCruise();

    
Is this condition-bean departure port for dream cruise?

Returns:
The determination, true or false.
    boolean xisDreamCruiseDeparturePort();

    
Is this condition-bean for dream cruise?

Returns:
The determination, true or false.
    boolean xisDreamCruiseShip();

    
Get the departure port of dream cruise?
(condition-bean creating the condition-bean)

Returns:
The base condition-bean for Dream Cruise. (NullAllowed: when not dream cruise)
Do you have a Dream Cruise ticket?
(whether this CB has the specified column by dream cruise or not)

Returns:
The determination, true or false.
    boolean xhasDreamCruiseTicket();

    
Show me your Dream Cruise ticket.
(get the specified column by Dream Cruise)

Returns:
The information of specified column. (NullAllowed)
Keep journey log-book of Dream Cruise.
(save the relation trace by Dream Cruise)

Parameters:
relationPath The path of relation. (NotNull)
    void xkeepDreamCruiseJourneyLogBook(String relationPath);

    
Set up select for journey log-book of Dream Cruise.
Set up select for journey log-book of Dream Cruise if union query exists.
Get the value of mystic binding.

Returns:
The object value for mystic binding. (NullAllowed: if null, no mystic)
    // ===================================================================================
    //                                                                       Invalid Query
    //                                                                       =============
    
Ignore null-or-empty check for query when query is set. (default is checked)
(no condition if set query is invalid)
 memberBhv.selectList(cb -> {
     cb.ignoreNullOrEmptyQuery();
     cb.query().setMemberName_Equal(null); // no condition (ignored)
     cb.query().setMemberName_Equal("");   // no condition (ignored)
     cb.query().setMemberName_Equal(" ");  // valid (MEMBER_NAME = ' ')
 });
 
You should call this before registrations of where clause and other queries.
And Union and SubQuery and other sub condition-bean inherit this.
    void ignoreNullOrEmptyQuery(); // no mode-query because of high use and wide scope

    
Check null or empty value for query when query is set. (back to default)
(it throws exception if set query is invalid, e.g. null, empty string, empty list)
You should call this before registrations of where clause and other queries.
Union and SubQuery and other sub condition-bean inherit this.
    void checkNullOrEmptyQuery();

    
Enable empty string for query. (default is disabled)
(you can use an empty string as condition)
You should call this before registrations of where clause and other queries.
Union and SubQuery and other sub condition-bean inherit this.

Parameters:
noArgInLambda The callback for empty-string query. (NotNull)
    void enableEmptyStringQuery(ModeQuery noArgInLambda);

    
Disable empty string for query. (back to default)
The empty string for query is treated as invalid data, like null.
    void disableEmptyStringQuery();

    
Enable overriding query. (default is disabled)
(you can override existing value as condition)
You should call this before registrations of where clause and other queries.
Union and SubQuery and other sub condition-bean inherit this.

Parameters:
noArgInLambda The callback for overriding query. (NotNull)
    void enableOverridingQuery(ModeQuery noArgInLambda);

    
Disable overriding query. (back to default)
You should set query to same column and same condition once.
    void disableOverridingQuery();
    // ===================================================================================
    //                                                                      Paging Setting
    //                                                                      ==============
    
Enable paging count-least-join, which means least joined on count select. (back to default)
You can use it by default on DBFlute so you don't need to call this basically. If you've suppressed it by settings of DBFlute property, you can use it by calling.
You should call this before execution of selectPage().
    void enablePagingCountLeastJoin();

    
Disable paging count-least-join, which means least joined on count select. (default is enabled)
You should call this before execution of selectPage().
    void disablePagingCountLeastJoin();

    
Can the SQL execution be split by select and query?

Returns:
The determination, true or false.
    // ===================================================================================
    //                                                                        Lock Setting
    //                                                                        ============
    
Lock for update.
If you call this, your SQL lock target records for update.
It depends whether this method supports this on the database type.

Returns:
this. (NotNull)
    // ===================================================================================
    //                                                                        Select Count
    //                                                                        ============
    
Set up various things for select-count-ignore-fetch-scope. {Internal} This method is for INTERNAL. Don't call this!

Parameters:
uniqueCount Is it unique-count select?
Returns:
this. (NotNull)
    ConditionBean xsetupSelectCountIgnoreFetchScope(boolean uniqueCount);

    
Do after-care for select-count-ignore-fetch-scope. {Internal} This method is for INTERNAL. Don't call this!

Returns:
this. (NotNull)
Is set up various things for select-count-ignore-fetch-scope? {Internal} This method is for INTERNAL. Don't call this!

Returns:
The determination, true or false.
    // ===================================================================================
    //                                                                       Cursor Select
    //                                                                       =============
    
Get the option of cursor select.

Returns:
The option of cursor select. (NullAllowed: when no option)
    // the customizeCursorSelect() method is generated at sub-class
    // because the method is generated only when allowed DBMS
    // ===================================================================================
    //                                                                       Scalar Select
    //                                                                       =============
    
Accept the option for ScalarSelect.

Parameters:
option The option for ScalarSelect. (NullAllowed)
    // ===================================================================================
    //                                                             Statement Configuration
    //                                                             =======================
    
Configure statement JDBC options. e.g. queryTimeout, fetchSize, ... (only one-time call)
 cb.configure(conf -> conf.queryTimeout(3));
 

Parameters:
confLambda The callback for configuration of statement. (NotNull)
    void configure(StatementConfigCall<StatementConfigconfLambda);

    
Get the configuration of statement that is set through configure().

Returns:
The configuration of statement. (NullAllowed)
    // ===================================================================================
    //                                                                      Entity Mapping
    //                                                                      ==============
    // no need to use it as interface method so comment out
    ///**
    // * Disable (entity instance) cache of relation mapping. <br>
    // * Basically you don't need this. This is for accidents.
    // */
    //void disableRelationMappingCache();

    
Can the relation mapping (entity instance) be cached?

Returns:
The determination, true or false.
    boolean canRelationMappingCache();

    
Enable access to non-specified column. (default is disabled)
You can get columns of base-point or setup-select using SpecifyColumn but non-specified column.
 memberBhv.selectEntity(cb -> {
     cb.setupSelect_MemberStatus();
     cb.specify().columnMemberStatusName();
     cb.query().set...
 }).alwaysPresent(member -> {
     member.getMemberStatus().alwaysPresent(status -> {
         ... = status.getMemberStatusName(); // OK
         ... = status.getDisplayOrder(); // OK: allowed
     });
 });
 
    void enableNonSpecifiedColumnAccess();

    
Disable the check of access to non-specified column. (back to default)
You cannot get columns of base-point or setup-select using SpecifyColumn but non-specified column.
 memberBhv.selectEntity(cb -> {
     cb.setupSelect_MemberStatus();
     cb.specify().columnMemberStatusName();
     cb.query().set...
 }).alwaysPresent(member -> {
     member.getMemberStatus().alwaysPresent(status -> {
         ... = status.getMemberStatusName(); // OK
         ... = status.getDisplayOrder(); // *NG: exception
     });
 });
 
    void disableNonSpecifiedColumnAccess();

    
Is the access to non-specified column allowed?

Returns:
The determination, true or false.
    // ===================================================================================
    //                                                            Undefined Classification
    //                                                            ========================
    
Enable the select of undefined classification code. (default is disabled) You can get undefined classification code from database.
Disable the select of undefined classification code. (back to default)
Is the selecting undefined classification code allowed?

Returns:
The determination, true or false.
    // ===================================================================================
    //                                                                   Column NullObject
    //                                                                   =================
    
Enable the handling of column null object. (default is disabled)
The handling is available if the null object target column in selected entity.
    void enableColumnNullObject();

    
Disable the handling of column null object. (back to default)
You can get null from selected entity even if null object target column.
    // ===================================================================================
    //                                                                        Query Update
    //                                                                        ============
    
Enable checking record count before QueryUpdate (contains QueryDelete). (default is disabled)
No query update if zero count. (basically for MySQL's deadlock by next-key lock)
    void enableQueryUpdateCountPreCheck();

    
Disable checking record count before QueryUpdate (contains QueryDelete). (back to default)
Executes query update even if zero count. (normal specification)
    void disableQueryUpdateCountPreCheck();

    
Does it check record count before QueryUpdate (contains QueryDelete)?

Returns:
The determination, true or false.
    boolean isQueryUpdateCountPreCheck();
    // ===================================================================================
    //                                                                         Display SQL
    //                                                                         ===========
    
Convert this conditionBean to SQL for display.

Returns:
SQL for display. (NotNull and NotEmpty)
    String toDisplaySql();

    
Style bound dates on logging display SQL, overriding default style.

Parameters:
logDateDisplayStyle The display style of date for logging. (NullAllowed: if null, configured default style)
    void styleLogDateDisplay(BoundDateDisplayStyle logDateDisplayStyle);

    
Get the display style of date for logging.

Returns:
The specified style object. (NullAllowed: if null, configured default style)
    // ===================================================================================
    //                                                                       Meta Handling
    //                                                                       =============
    
Does it have where clause on the base query?
Clauses on union queries and in-line views are not concerned.

Returns:
The determination, true or false.
    boolean hasWhereClauseOnBaseQuery();

    
Clear where clauses where clause on the base query.
Clauses on union queries and in-line views are not concerned.
    void clearWhereClauseOnBaseQuery();

    
Does it have select-all possible?
The elements for possible are:
 o no where clause on base query
 o no where clause in base table in-line view
 o union queries with select-all possible
 

Returns:
The determination, true or false.
    boolean hasSelectAllPossible();

    
Does it have order-by clauses?
Whether that order-by is effective or not has no influence.

Returns:
The determination, true or false.
    boolean hasOrderByClause();
    // clearOrderBy() is defined at OrderByBean

    
Has union query or union all query?

Returns:
The determination, true or false.
    // ===================================================================================
    //                                                                 Reflection Invoking
    //                                                                 ===================
    
Invoke the method 'setupSelect_Xxx()' and 'withXxx()' by the path of foreign property name.
For example, if this is based on PURCHASE, 'member.memberStatus' means as follows:
 PurchaseCB cb = new PurchaseCB();
 cb.setupSelect_Member().withMemberStatus();
 
A method with parameters (using fixed condition) is unsupported.

Parameters:
foreignPropertyNamePath The path string. (NotNull, NotTrimmedEmpty)
Throws:
org.dbflute.exception.ConditionInvokingFailureException When the method to the property is not found and the method is failed.
    void invokeSetupSelect(String foreignPropertyNamePath);

    
Invoke the method 'specify().columnXxx()' by the path of column name.
For example, if this is based on PURCHASE, 'purchaseDatetime' means as follows:
 PurchaseCB cb = new PurchaseCB();
 cb.specify().columnPurchaseDatetime();
 
And if this is based on PURCHASE, 'member.memberName' means as follows:
 PurchaseCB cb = new PurchaseCB();
 cb.specify().specifyMember().columnMemberName();
 

Parameters:
columnPropertyPath The path string to property for the column. (NotNull, NotTrimmedEmpty)
Returns:
The info of specified column. (NotNull)
Throws:
org.dbflute.exception.ConditionInvokingFailureException When the method to the property is not found and the method is failed.
    SpecifiedColumn invokeSpecifyColumn(String columnPropertyPath);

    
Invoke the method 'orScopeQuery()' by the query callback.

Parameters:
orQuery The callback for or-query. (NotNull)
Throws:
org.dbflute.exception.ConditionInvokingFailureException When the method to the property is not found and the method is failed.
    void invokeOrScopeQuery(OrQuery<ConditionBeanorQuery);

    
Invoke the method 'orScopeQueryAndPart()' by the query callback.

Parameters:
andQuery The callback for and-query. (NotNull)
Throws:
org.dbflute.exception.ConditionInvokingFailureException When the method to the property is not found and the method is failed.
    // ===================================================================================
    //                                                                  Query Synchronizer
    //                                                                  ==================
    
Register union-query synchronizer. {Internal}
Basically for reflecting LoadReferrer's InScope condition to union-queries in condition-bean set-upper.

Parameters:
unionQuerySynchronizer The synchronizer of union query. (NullAllowed)
    void xregisterUnionQuerySynchronizer(UnionQuery<ConditionBeanunionQuerySynchronizer);
    // ===================================================================================
    //                                                                    Derived Mappable
    //                                                                    ================
    
Get the handler of derived type for derived mappable entity (for (Specify)DerivedReferrer).
Called by internal mapping process, so should be fixed instance.

Returns:
The handler of derived type. (NotNull)
    // ===================================================================================
    //                                                                        Purpose Type
    //                                                                        ============
    
Get the purpose of the condition-bean. e.g. NORMAL_USE, EXISTS_REFERRER

Returns:
The instance of purpose object for condition-bean. (NotNull)
    // -----------------------------------------------------
    //                                        Internal Setup
    //                                        --------------
    // only methods called by interface are defined
    
Set up condition-bean for ScalarSelect.
    void xsetupForScalarSelect();

    
Set up condition-bean for QueryInsert.
    void xsetupForQueryInsert();

    
Set up condition-bean for SpecifiedUpdate.
    void xsetupForSpecifiedUpdate();

    
Set up condition-bean for VaryingUpdate.
    void xsetupForVaryingUpdate();
    // -----------------------------------------------------
    //                                                  Lock
    //                                                  ----
    
Enable "that's bad timing" check. (back to default)
    void enableThatsBadTiming();

    
Disable "that's bad timing" check. (default is enabled)
    void disableThatsBadTiming();
New to GrepCode? Check out our FAQ X