Class CaseBase
- All Implemented Interfaces:
ICaseBase
,IMutableCaseBase
Cases of super or sub-types of the entity this casebase was created for will be located in their own casebase. The casebase will thus only contain cases that are exactly of the specified type.
The match definitions are sorted on threshold, master-slave relations and weight, see
MatchDefinitionComparator
. If this casebase has a supertype, then cases of this casebase can also be used in
a match on the supertype. The list of match definitions of this casebase must start with the match definitions of the
supertype, and the match definitions must be in the same order as in the supertype. Therefore, the match definitions
must be sorted per casebase.
Example:
Person has attributes A, B, C where B has a threshold of 15.
Customer has one attribute D with a threshold of 25.
The sorted list of match definitions becomes B,A,C,D, even though D has the highest threshold.
- Since:
- 6.2
- Author:
- O. Kerpershoek, F. van der Meer
-
Constructor Summary
ConstructorsModifierConstructorDescriptionprotected
CaseBase
(IEntityDefinition definition, CaseBase superType, CaseBase[] subTypes) -
Method Summary
Modifier and TypeMethodDescriptionprotected void
protected void
addMatchDefinition
(MatchDefinition definition) protected boolean
containsCase
(String caseName) void
deleteCase
(String caseName) Registers that an existing case in this casebase must be deleted.protected Case
This method locates the case with the given name within this casebase or it's parent case base.ICase[]
getCases
(boolean includeSubTypes) This method returns all the cases of this casebase.protected void
int
This method returns the threshold that will be used for cases when the match request does not specify a threshold.This method returns the name of the attribute whose values should be used to group the results on.int
This method returns the maximum number of values that may be grouped on one unique key value.int
This method returns the maximum number of result that will be returned by a match action when the match request does not specify a maximum.protected IEntityDefinition
This method returns the entity name for which the cases in this casebase are defined.This returns all the match definitions that should be used to match the values of a case from this casebase.protected void
getMatchDefinitions
(List<IMatchDefinition> matchDefinitions) This method returns an array of casebases containing the casebases of the sub types of the entity this casebase is defined for.This method returns the casebase for the super type of the entity this casebase is defined for.protected void
initializeCases
(CaseBaseList casebases, ICaseBaseDS datasource) protected void
initializeCaseValues
(CaseBaseList casebases, ICaseBaseDS datasource) protected void
initializeMatchDefinitions
(MatchEngine matchEngine, ICaseBaseDS datasource) void
insertCase
(String caseName) Registers a new case for this casebase.boolean
Indicates if any changes are registered for this casebase.protected void
protected void
iterateInserts
(ICaseBaseDS datasource) protected void
iterateUpdates
(ICaseBaseDS datasource) protected void
protected void
void
updateCase
(String caseName) Registers that the values of an existing case in this casebase must be updated.
-
Constructor Details
-
CaseBase
-
-
Method Details
-
initializeMatchDefinitions
-
onStartup
protected void onStartup() -
onLoadComplete
protected void onLoadComplete() -
addMatchDefinition
-
initializeCases
-
initializeCaseValues
-
iterateInserts
-
iterateDeletes
protected void iterateDeletes() -
iterateUpdates
-
getEntityDefinition
-
getEntityName
Description copied from interface:ICaseBase
This method returns the entity name for which the cases in this casebase are defined.- Specified by:
getEntityName
in interfaceICaseBase
- Returns:
- the entity name for which the cases in this casebase are defined.
-
getSuperType
Description copied from interface:ICaseBase
This method returns the casebase for the super type of the entity this casebase is defined for. When the entity of this casebase does not have a super type defined, this method will return null.- Specified by:
getSuperType
in interfaceICaseBase
- Returns:
- The casebase for the super type of the entity, or null when the entity does not have a super type.
-
getSubTypes
Description copied from interface:ICaseBase
This method returns an array of casebases containing the casebases of the sub types of the entity this casebase is defined for. When the entity does not have any sub types, this method will return an empty array.- Specified by:
getSubTypes
in interfaceICaseBase
- Returns:
- An array containing the casebases for the sub types of the entity this casebase is defined for.
-
containsCase
-
addCase
-
insertCase
Description copied from interface:IMutableCaseBase
Registers a new case for this casebase.- Specified by:
insertCase
in interfaceIMutableCaseBase
- Parameters:
caseName
- The case name.
-
updateCase
Description copied from interface:IMutableCaseBase
Registers that the values of an existing case in this casebase must be updated.- Specified by:
updateCase
in interfaceIMutableCaseBase
- Parameters:
caseName
- The case name.
-
deleteCase
Description copied from interface:IMutableCaseBase
Registers that an existing case in this casebase must be deleted.- Specified by:
deleteCase
in interfaceIMutableCaseBase
- Parameters:
caseName
- The case name.
-
isChanged
public boolean isChanged()Description copied from interface:IMutableCaseBase
Indicates if any changes are registered for this casebase.- Specified by:
isChanged
in interfaceIMutableCaseBase
- Returns:
- true if changes to the case data are registered but not yet applied.
-
getCases
Description copied from interface:ICaseBase
This method returns all the cases of this casebase. The boolean argument 'includeSubTypes' may be used to request only the cases that are defined for the entity type of this casebase, or to retrieve all cases that match the current type. -
getCases
-
getCase
Description copied from interface:ICaseBase
This method locates the case with the given name within this casebase or it's parent case base. -
findCase
-
getMatchDefinitions
Description copied from interface:ICaseBase
This returns all the match definitions that should be used to match the values of a case from this casebase. The array of the match definition matches the order of the array from ICase.getValues.Important note: This ordering of the output array is a design v.s. optimization issue which has favored to the optimization side. Since a casebase consisting of 1,000,000 cases matching over 20 attributes per case will result in 20 million hash map lookups. Since the order is known from the clients point of view one can access this array directly resulting in a much faster process.
- Specified by:
getMatchDefinitions
in interfaceICaseBase
- Returns:
- The match definitions that should be used to match the values of a case from this casebase.
-
getMatchDefinitions
-
getDefaultCaseThreshold
public int getDefaultCaseThreshold()Description copied from interface:ICaseBase
This method returns the threshold that will be used for cases when the match request does not specify a threshold.- Specified by:
getDefaultCaseThreshold
in interfaceICaseBase
- Returns:
- the threshold that will be used for cases when the match request does not specify a threshold.
-
getDefaultMaxResults
public int getDefaultMaxResults()Description copied from interface:ICaseBase
This method returns the maximum number of result that will be returned by a match action when the match request does not specify a maximum.- Specified by:
getDefaultMaxResults
in interfaceICaseBase
- Returns:
- The maximum number of results from a match action.
-
getDefaultKeyField
Description copied from interface:ICaseBase
This method returns the name of the attribute whose values should be used to group the results on. The key field is optional, so this method may return null when no key field has been specified. Note: Only attributes that are matched may be used as key field.- Specified by:
getDefaultKeyField
in interfaceICaseBase
- Returns:
- the name of the attribute whose values should be used to group the results on.
-
getDefaultMaxKeyResults
public int getDefaultMaxKeyResults()Description copied from interface:ICaseBase
This method returns the maximum number of values that may be grouped on one unique key value.- Specified by:
getDefaultMaxKeyResults
in interfaceICaseBase
- Returns:
- the maximum number of values that may be grouped on one unique key value.
-