Package overit.geocall.da
Class DAO
java.lang.Object
overit.geocall.da.DAO
- All Implemented Interfaces:
Serializable,DataAttributesHolder,EDMConfigurableBean,overit.geocall.marks.FieldExposer,overit.geocall.marks.NameExposer,DBFieldMapper,DBObjectMapper,Tool
- Direct Known Subclasses:
DAO,DAOAccessoryData,DAOAccount,DAOAccountContact,DAOAccountContactHistory,DAOAccountedSerializedMaterial,DAOAccountHistory,DAOAccountStatus,DAOAccountType,DAOActivity,DAOActivity,DAOActivityForecastHeader,DAOActivitySkillConfiguration,DAOActivitySkillConfiguration,DAOActivityToCancel,DAOAddress,DAOAddress,DAOAddressHistory,DAOAddressHistory,DAOAddressType,DAOAddressType,DAOAgenda,DAOAgenda,DAOAgendaAffinityAccountingsExtractor,DAOAgendaAffinityPrediction,DAOAgendaAffinityWorkshiftsForPrediction,DAOAgendaHistory,DAOAgendaHistory,DAOAgendaMaterial,DAOAgendaResource,DAOAgendaResourceRoles,DAOAgendaTeamResource,DAOAIAgendaAffinity,DAOAIConfigurationParams,DAOAIConfigurationParamsOpCenters,DAOAIDataExtraction,DAOAIMeterPrediction,DAOAIProcessExecutionHistory,DAOAllUsers,DAOApiKey,DAOAppointment,DAOAppointment,DAOAppointments,DAOAsset,DAOAssetCharacteristicValue,DAOAssetCharacteristicValueHistory,DAOAssetContact,DAOAssetContactHistory,DAOAssetHistory,DAOAssetOperationCenter,DAOAssetStatus,DAOAssetStatusType,DAOAssetType,DAOAssetTypeAdmittedStatus,DAOAssetTypeOperationCenter,DAOAssetTypeTemplate,DAOAssetTypeTemplateCharacteristic,overit.geocallapp.wfm.timerange.configuration.bl.da.DAOATimeRangeConfiguration,overit.geocallapp.wfm.documents.bl.attachment.data.DAOAttachment,DAOAutomaticMeterReadingMonitor,DAOAutomaticMeterReadingPredictions,DAOAutomaticMeterReadingPredictionsSearch,DAOAutomaticMeterReadingSearch,DAOAutomatonState,DAOAvailabilityType,DAOAziende,DAOBundleCriterion,DAOBundleExtractRequirements,DAOBundleHeader,DAOBundleOperation,DAOBundleRequirement,DAOBundleScheduling,DAOBundleSkill,DAOBundleSkillDivision,DAOBundlingRuleFilter,DAOBundlingRuleHeader,DAOBundlingRuleOrdering,DAOCalendarUnit,DAOCancellationActivityStatus,DAOCancelSuspendReason,DAOCancelSuspendReason,DAOCapacityPlanningResult,DAOCapacityPlanningResultDetail,DAOCapacityPlanningScenario,DAOCapacityPlanningState,DAOCatalogCode,DAOCatalogGroup,DAOCatalogGroupType,DAOCensusRule,DAOCensusType,DAOCharacteristic,DAOCharacteristicClass,DAOCheckUser,DAOClocking,DAOClocking,DAOClockingState,DAOClockingType,DAOClockingType,DAOConfParamsHistory,DAOContact,DAOContactHistory,DAOConverterType,DAOConverterType,DAOCrewShell,DAOCrewShellAddress,DAOCrewShellComposition,DAOCrewShellCompositionMismatch,DAOCrewShellConfiguration,DAOCrewShellDraftComposition,DAOCrewShellOperationCenter,DAOCrewShellSkill,DAOCrewShellType,DAOCrewShellWorkShift,DAOCriticalActivity,DAOCriticalActivityDetectProcess,DAOCriticalActivityRuleHeader,DAOCriticalActivityRuleWOFilter,DAOCustomers,DAODailyPlanOrderConfigurationDetail,DAODailyPlanOrderConfigurationHeader,DAODashboardAMRPrediction,DAODataCollectionOptionsGroup,DAODataCollectionOutcomeReasonConversion,DAODataCollectionSheet,DAODataCollectionSheetConversion,DAODataCollectionSheetConversionSubset,DAODataCollectionSheetScope,DAODataCollectionSheetState,DAODataCollectionTableNodeConversion,DAODataCollectionTemplateConversion,DAODataCollectionTemplateConversionSubset,DAODataCollectionTemplateHeader,DAODataCollectionTemplateStructure,DAODataCollectionTemplateStructureOutcomeRule,DAODataCollectionTemplateStructureRelease,DAODataCollectionTemplateTypeConversion,DAODataCollectionTemplateVersionConversion,DAODataCollectionTemplateWOCreationRule,DAODataCollectionType,DAODataCollectionWorkCycleConversion,DAODCTemplateVisibilityRuleHeader,DAODCTemplateVisibilityRuleRow,DAOElaborationHistory,DAOEncodedNote,DAOEncodedNote,DAOEventEntity,DAOEventManagerConfWoType,DAOEventType,DAOExpectedMaterialSearch,DAOExternalSystem,DAOExternalSystem,DAOFeature,DAOFeatureClass,DAOFeatureFacilityType,DAOFeatureValueDomain,DAOFeatureValueDomainItem,DAOForecastActivity,DAOForecastActivityDetail,DAOForecastActivityImportFilter,DAOForecastActivityPriority,DAOForecastActivitySkill,DAOForecastGroupingConstraint,DAOForecastResource,DAOForecastResourceDetail,DAOForecastResourceGroupingConstraint,DAOForecastResourceSkill,DAOForecastShiftModel,DAOForecastShiftModelDetail,DAOForecastState,DAOFormationSkillConfiguration,DAOFormationSkillDivision,DAOGisFileType,DAOGisLayerType,DAOGisOfflinePackage,DAOGisVisibilityRule,DAOGoodsGroup,DAOGoodsGroup,DAOHoliday,DAOHourType,DAOImmediateSchedulingCalendar,DAOImmediateSchedulingConfiguration,DAOImmediateSchedulingExclusionReason,DAOImmediateSchedulingLastProcessing,DAOImmediateSchedulingPositionType,DAOImmediateSchedulingProcessing,DAOImmediateSchedulingReprocessingMode,DAOImmediateSchedulingResourceExclusion,DAOImmediateSchedulingResourceProcessing,DAOImmediateSchedulingState,DAOImmediateSchedulingTracking,DAOImmediateSchedulingWorkOrder,DAOImmediateSchedulingWorkOrderHistory,DAOImmediateSchedulingWOSort,DAOImmediateSchedulingWOState,DAOImportExportState,DAOImportExportState,DAOIntegrationVehicleType,DAOIntervention,DAOInterventionGroup,DAOInterventionGroupCensusRule,DAOInterventionInfo,DAOInterventionOutcome,DAOInterventionPlanning,DAOInterventionResource,DAOInterventionResource,DAOLoadAllUsers,DAOLogDetail,DAOLogDetail,DAOLogMaster,DAOLogMaster,DAOMaterial,DAOMaterial,DAOMaterialAccountingType,DAOMaterialClass,DAOMaterialClass,DAOMaterialExpectedQuantity,DAOMaterialHistory,DAOMaterialHistory,DAOMaterialItem,DAOMaterialItemType,DAOMaterialManagementType,DAOMaterialManagementType,DAOMaterialType,DAOMaterialType,DAOMeasure,DAOMeasureElementTemplate,DAOMeasureHistory,DAOMeasureUnit,DAOMeasureUnit,DAOMeasuringElement,DAOMediaFile,DAOMessage,DAOMeter,DAOMeter,DAOMeterAccessibility,DAOMeterBrand,DAOMeterBrand,DAOMeterClass,DAOMeterClass,DAOMeterConverter,DAOMeterConverterHistory,DAOMeterHistory,DAOMeterHistory,DAOMeterLocation,DAOMeterLocation,DAOMeterReading,DAOMeterReadings,DAOMeterReadingsMeasure,DAOMeterReadingsTemplate,DAOMeterType,DAOMeterType,DAOMicrocluster,DAOMicroclusterAggregate,DAOMicroclusterZone,DAOMobileErrorLog,DAOMobileMultistageGroup,DAOMobileMultistageGroupOperation,DAOMobileMultistageGroupOperationDependentOperation,DAOMobileWorkOrderCreationRequestHeader,DAOMobileWorkOrderCreationRequestOperation,DAOMobileWorkOrderCreationRequestState,DAOModel,DAOModelHistory,DAOMultistageConfiguration,DAOMultistageDependencyType,DAOMultistageGroupDependency,DAOMultistageGroupHeader,DAOMultistageGroupHeaderSequenceNumber,DAOMultistageGroupOperation,DAOMultistageManagement,DAOMultistageOriginType,DAOMultistageState,DAOMultistageViolationHeader,DAOMultistageViolationMessage,DAOMultistageViolationType,DAOMunicipality,DAOMunicipality,DAONotifiableUserSearch,DAOOCGroup,DAOOnCallShift,DAOOperationActivity,DAOOperationCenter,DAOOperationCenter,DAOOperationCenterAddress,DAOOperationCenterAddress,DAOOperationCenterSchedulingConfiguration,DAOOperationCenterWorkCenter,DAOOperationExtractRequirements,DAOOperationRequirement,DAOOperationsSlots,DAOOperationType,DAOOssIntegrationConfiguration,DAOOssIntegrationType,DAOOssMatrix,DAOOssResponseLog,DAOOssResponseLogLevel,DAOOssResponseLogSearch,DAOOssResponseType,DAOOssSpace,DAOOssVehicle,DAOOssVehicle,DAOOssVehicleNoFactory,DAOOutcomeClass,DAOOutcomeReason,DAOOutcomeReason,DAOOutcomeReasonEncodedNote,DAOOutcomeReasonEncodedNote,DAOOutcomeReasonType,DAOOutcomeReasonType,DAOOutcomeType,DAOOutcomeType,DAOOutcomeWorkOrderOrigin,DAOPermitObtained,DAOPermitObtainedHistory,DAOPermitRequired,DAOPermitRequiredHistory,DAOPermitType,DAOPermitTypeOutcomeReasonRel,DAOPlannedIntervention,DAOPlanningActionHistory,DAOPPartsManagement,DAOPPartsManagementOrdersExtractor,DAOPPartsManagementPrediction,DAOPPMSearchMaterials,DAOPredictionExtractor,DAOPredictionValidationRules,DAOProfile,DAOProfiles,DAOProfileState,DAOProject,DAOProjectActivity,DAOProjectActivityDebriefing,DAOProjectActivityHistory,DAOProjectActivityRelation,DAOProjectActivityRelationType,DAOProjectActivityStartDate,DAOProjectActivityType,DAOProjectActivityUserStatus,DAOProjectDiary,DAOProjectDiaryCategory,DAOProjectDiaryHistory,DAOProjectHeaderTechnicalObjects,DAOProjectHistory,DAOProjectOperations,DAOProjectOperationsSlots,DAOProjectProfile,DAOProjectProgressive,DAOProjectType,DAOProjectUserStatus,DAOQualification,DAOReceipt,DAOReceiptType,DAORequestType,DAORequestType,DAOResource,DAOResource,DAOResourceAddress,DAOResourceAddress,DAOResourceForecastHeader,DAOResourceGPSPosition,DAOResourceLastGPSPosition,DAOResourceLoan,DAOResourceManagement,DAOResourceQualification,DAOResourceRole,DAOResourceShiftAgendaAffinity,DAOResourceShiftExceptionRequest,DAOResourceShiftExceptionRequestType,DAOResourceSkill,DAOResourceSkill,DAOResourceType,DAORole,DAORoughPlanning,DAORoughPlanningActivityResult,DAORoughPlanningBucket,DAORoughPlanningBucketMovement,DAORoughPlanningCreationFilter,DAORoughPlanningOrderMovement,DAORoughPlanningResource,DAORoughPlanningResourceResult,DAORoughPlanningState,DAORUserTypesWOStatus,DAOScheduling,DAOScheduling,DAOSchedulingArea,DAOSchedulingAreaMicrocluster,DAOSchedulingModel,DAOSchedulingModelRow,DAOSchedulingProposal,DAOSchedulingResourceType,DAOSchedulingSlotSearch,DAOSchedulingTimeslot,DAOSchedulingToCancel,DAOSchedulingUser,DAOSearchMCAggregate,DAOSearchTeamSuggestionOperationsAffinity,DAOSearchWOOperations,DAOSearchWOTypes,DAOSecret,DAOSecretValue,DAOSerializedMaterial,DAOSerializedMaterialHistory,DAOSerializedMaterialModel,DAOServiceType,DAOServiceType,overit.geocall.basic.ms.auth.DAOSession,DAOSharedResource,DAOSharedResourceMetadata,DAOSharedResourceOrigin,DAOSharedResourceType,DAOSharedResourceWithLog,DAOSharedResourceWithLog,DAOShiftExceptionClass,DAOShiftExceptionClassType,DAOShiftExceptionImpact,DAOShiftExceptionManagement,DAOSkill,DAOSkill,DAOSkillConfiguration,DAOSkillConfigurationDivision,DAOSkillConfigurationDivisionHistory,DAOSkillConfigurationHistory,DAOSkillConfigurationSkill,DAOSkillConfigurationSkillHistory,DAOSkillDivision,DAOSkillDivisionHistory,DAOSkillDivisionSkill,DAOSkillDivisionSkillHistory,DAOSkillOverrideConfiguration,DAOSkillOverrideConfigurationSkill,DAOSkillQualification,DAOSkillsExtractor,DAOStock,DAOStockChange,DAOStockHistory,DAOStockSerializedMaterial,DAOStockSerializedMaterialDetail,DAOStockType,DAOStructure,DAOStructure,DAOStructureValidityPeriod,DAOStructureValidityPeriod,DAOSurveySearch,DAOSV,DAOSystemSettings,DAOSystemUsers,DAOTask,DAOTaskCategory,DAOTaskCategoryEventType,DAOTaskHistory,DAOTaskState,DAOTeam,DAOTeamAffinity,DAOTeamDislocation,DAOTeamExperience,DAOTeamLevel,DAOTeamLocation,DAOTeamMember,DAOTeamModel,DAOTeamShift,DAOTeamShift,DAOTeamShiftResource,DAOTeamShiftResource,DAOTeamSuggestionAccountingsExtractor,DAOTeamSuggestionMonitor,DAOTeamSuggestionResourceExtractor,DAOTeamType,DAOTechnicalObject,DAOTechnicalObjectAdmittedState,DAOTechnicalObjectFeatureValue,DAOTechnicalObjectFeatureValueHistory,DAOTechnicalObjectHistory,DAOTechnicalObjectState,DAOTechnicalObjectType,DAOTechnicalObjectType,DAOTechnicalObjectTypeTemplate,DAOTimePredictionSupportFields,DAOTimesheetHeader,DAOTimesheetHeaderHistory,DAOTimesheetState,DAOTimesheetType,DAOTooltipConfiguration,DAOTooltipConfigurationRule,DAOTransferRequestHeader,DAOTransferRequestItem,DAOTransferRequestItemSerializedMaterial,DAOTransferRequestState,DAOTransferRequestType,DAOUnavailabilityMovement,DAOUser,DAOUserAdditionalTypes,DAOUserChanges,DAOUsers,DAOUserType,DAOUserType,DAOUserTypeFunction,DAOUserTypeFunctions,DAOUserTypes,DAOUserTypesFactoryUnbounded,DAOUserTypesUsers,DAOValueDomain,DAOValueDomainItem,DAOVCAppointment,DAOVehicle,DAOWarehouse,DAOWarehouseAgendaMaterial,DAOWarehouseAgendaSerializedMaterial,DAOWarehouseCentralMobile,DAOWarehouseCentralMobile,DAOWarehouseMaterial,DAOWarehouseMaterialStockSearch,DAOWarehouseOperationCenter,DAOWarehouseOperationHeader,DAOWarehouseOperationHeaderSource,DAOWarehouseOperationHeaderState,DAOWarehouseOperationItem,DAOWarehouseOperationItemSerializedMaterial,DAOWarehouseOperationItemState,DAOWarehouseOperationType,DAOWarehouseState,DAOWarehouseTrackingMode,DAOWarehouseTransaction,DAOWarehouseTransactionSerializedMaterial,DAOWarehouseTransactionType,DAOWarehouseType,DAOWarning,DAOWarningType,DAOWOResourceTimePrediction,DAOWorkCenter,DAOWorkCenter,DAOWorkCycle,DAOWorkCycleHeader,DAOWorkCycleOperation,DAOWorkCyclePermitTypeRel,DAOWorkCycleRule,DAOWorkCycleStructure,DAOWorkCycleStructurePermitTypeRel,DAOWorkDayClosureCrewShell,DAOWorkDayClosureOnFieldAgenda,DAOWorkDayClosureScheduledAgenda,DAOWorkDayClosureUsers,DAOWorkingTeam,DAOWorkLoadDistribution,DAOWorkLoadDistribution,DAOWorkOrderEncodedNote,DAOWorkOrderHeader,DAOWorkOrderHeader,DAOWorkOrderHeaderHistory,DAOWorkOrderInterventionPlanningSearch,DAOWorkOrderMeter,DAOWorkOrderNote,DAOWorkOrderObjectsExtractor,DAOWorkOrderOperation,DAOWorkOrderOperation,DAOWorkOrderOperationAccountedMaterial,DAOWorkOrderOperationHistory,DAOWorkOrderOperationMaterial,DAOWorkOrderOperationResource,DAOWorkOrderOperationState,DAOWorkOrderOperationStatus,DAOWorkOrderOperationType,DAOWorkOrderOperationType,DAOWorkOrderOperationTypeActivity,DAOWorkOrderOperationTypeActivity,DAOWorkOrderOperationTypeCategory,DAOWorkOrderSequenceNumber,DAOWorkOrderSource,DAOWorkOrderState,DAOWorkOrderStatus,DAOWorkOrderStatusUserType,DAOWorkOrderTeamAffinity,DAOWorkOrderType,DAOWorkOrderType,DAOWorkOrderTypeStructure,DAOWorkOrderUrgency,DAOWorkOrderUrgency,DAOWorkShift,DAOWorkShift,DAOWorkShift,DAOWorkShiftException,DAOWorkShiftException,DAOWorkShiftExceptionClass,DAOWorkShiftExceptionClassType,DAOWorkShiftExceptionImpact,DAOWorkShiftExceptionManagement,DAOWorkShiftExceptionType,DAOWorkShiftExceptionWorkShift,DAOWorkShiftType,DAOWorkShiftType,DAOWorkShiftTypeClass,DAOWOTimePrediction,DAOWOTimePredictionView,DAOWoTypeAdmittedMaterial,DAOZone,DAOZone,DAOZoneMicroclusterAggregate,ReadOnlyDAO,overit.geocallapp.wfm.core.data.ReadOnlyDAO
public class DAO
extends Object
implements DBFieldMapper, DBObjectMapper, overit.geocall.marks.FieldExposer, overit.geocall.marks.NameExposer, Serializable, Tool, EDMConfigurableBean
Class to extend when you want to create an object that accesses a table of the database.
The goal of the class is to avoid writing SQL and going to build inferential rules that, based on the parameter map passed,
can deduce the SQL code to be created.
To use the class you need to extend it and using the annotation that gives the fundamental information of the table that you want to map.
This class implements some basic functions such the selection of one or all the table records or the deletion, insertion or updating of a record.
The methods that can be extended to create the desired logic are:
This class implements some basic functions such the selection of one or all the table records or the deletion, insertion or updating of a record.
The methods that can be extended to create the desired logic are:
validate(CommandContext, PoolKit)
to perform a validation on the data, defineValues(CommandContext, PoolKit) to set up the values,
getFilterCriterion(overit.geocall.da.CommandContext) to insert the Criteria that will build the SQL code and
feedback(CommandContext, PoolKit, DBStatement) to manage the results.- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic @interfaceAnnotation used to set the field of the table in which is stored the "branch id" value.static @interfaceAnnotation used to set the name of the field used ascode(capable of uniquely identifying each record) for the specific table on which theDAOacts.static @interfaceAnnotation used to insert the DISTINCT clause for the queries.static @interfaceAnnotation to mark aDAOso that it automatically handles encryption on fields of the related table.static @interfaceAnnotation used to set the field of the table in which is stored the "factory id" value.static @interfaceAnnotation used to define the names of the columns on which we want to group the reults of the queries.static @interfaceAnnotation to mark aDAOso that it automatically manages the optimistic lock on the related table.static @interfaceAnnotation used to define the names of the columns on which we want to make the sorting of the results of the queries.static @interfaceAnnotation used to set the name of the primary keys of the specific table on which the DAO acts.static @interfaceAnnotation used to set the name of the pool from which the specific DAO extracts the connections when they are not explicitly passed to methods.static @interfaceAnnotation used to set the name of the field used as sequence for the insert commands on the specific table on which the DAO acts.static @interfaceAnnotation used to allow customization of service mode for the connection extraction.static @interfaceAnnotation used to define the field list for all the select queries.static @interfaceAnnotation used to set the name of the table on which the specific DAO acts.static @interfaceAnnotation used to set the name of the transaction. -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected DBFieldMapprotected DBObjectMapstatic final CommandStandardCommandthat deletes a record, using the filter passed to theCommandContextstatic final CommandStandardCommandthat deletes a record, using the primary key field passed to theCommandContextstatic final CommandDeprecated.static final CommandStandardCommandthat inserts a new recordstatic final CommandStandardCommandthat tries to insert a new record; if the insert fails, returns the value 0 and not an errorstatic final CommandStandardCommandthat implements the query: SELECT * FROM TABLE WHERE ... = ?static final CommandStandardCommandthat implements the empty query: SELECT * FROM TABLE WHERE 1 = 0static final CommandStandardCommandthat implements the query: SELECT * FROM TABLE WHERE PRIMARY_KEY = ?static final CommandStandardCommandthat updates a record, using the filter passed to theCommandContextstatic final CommandStandardCommandthat updates a record, using the primary key passed to theCommandContextstatic final CommandStandard UPSERTCommand: tries to make an update, if fails do an insertprotected static final String -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintExecutes the command defined by theCommandContextpassed as parameterintcommand(CommandContext cc, PoolKit pk) Executes the command defined by theCommandContextpassed as parameterfinal CommandcommandForName(String name) Returns theCommandthat corresponds to the query or command name passed as parameterprotected voiddefineParams(CommandContext cc, PoolKit pk) The method performs a cloning of the maps of the filters and of the values and makes a merge, putting before the filter field names the string F: and before the value field names the string V: to avoid possible conflicts; this is necessary because the same field can be used with different semantics, as a filter and as a value, for example for theUPDATE_FILTERcommandsprotected voiddefineSql(CommandContext cc, PoolKit pk) The method creates the SQL command using the language of the criteria, and in particular based on the methodgetFilterCriterion(overit.geocall.da.CommandContext)protected voiddefineStatement(CommandContext cc, PoolKit pk, DBStatement dbs) The method defines theDBStatement, sets the SQL and the parameters for the execution of the commandsprotected voiddefineValues(CommandContext cc, PoolKit pk) Method to extend to go to prepare the values operating Java side, for example making calculations, avoiding to operate SQL side that is much more difficult, inconvenient, difficult to maintain and not portable.voidExecutes the command; it extracts a newPooledConnectionfrom the poolvoidexecute(CommandContext cc, PoolKit pk) Executes the commandvoidExecutes the providedBatch; it extracts a newPooledConnectionfrom the pool.voidExecutes the providedBatch.protected voidfeedback(CommandContext cc, PoolKit pk, DBStatement dbs) Method to be extended to carry out operations exploiting the result of the executed command; for example it can be used to implement CASE WHEN logics that can therefore be deleted from the SQL.Returns the name of the field of the table in which is stored the "branch id" value, set with the Branch annotationReturns aStringabout the name of the field of the table containing acodecapable of uniquely identifying each record (useful during the export of the system configuration).Returns theDBFieldMapobjectReturns theDBObjectMapcontained in the instanceString[]Returns aString[] about the fields that need to be encrypted, so that encryption can be handled on those fields.Returns the name of the field of the table in which is stored the "factory id" value, set with the Factory annotationprotected CriterionMethod to extend to go to introduce the inferential rules with which to deduce the SQL automatically based on the context passed as a parameter.String[]Returns the array that contains the names of the columns on which we want to group the reults of the queries.getLevel()Returns the name of the field of the table in which is stored the "level" value, so that the optimistic lock can be managed.String[]Returns the array that contains the names of the columns on which we want to make the sorting of the results of the queries.String[]getPk()Returns the array that contains the primary keys of the specific table on which the DAO acts.getPool()Returns the name of the pool from which the specific DAO extracts the connections when they are not explicitly passed to methods.Returns a string that represent the name of the field used as sequence for the insert commands on the table.String[]Returns the array that contains the field list for all the select queries.Returns the name of the table on which the specific DAO actsReturns theTeacherused for the translations by the DAOGet the name of the transaction to be extracted from the PoolKitprotected CriterionMethod that defines theCriterionused for the different commandsbooleanReturnstruein case thisEDMConfigurableBeanhas not been already decorated withEDMconfiguration;falseotherwise.booleanChecks if there is a correctDBFieldMapobjectbooleanChecks the presence of a validDBObjectMapcontained in the instance.booleanReturns the boolean value that determines whether the queries use the DISTINCT clause or notbooleanbooleanReturns the boolean value that determines whether connection extraction takes place from the standard pool or the service poolvoidMark thisEDMConfigurableBeanas already decorated withEDMconfiguration.query(CommandContext cc) Executes the query defined by theCommandContextpassed as parameterquery(CommandContext cc, PoolKit pk) Executes the query defined by theCommandContextpassed as parametervoidscan(CommandContext cc, PoolKit pk, DBScanner scanner) scans the dataset defined by a DAO Select command with aDBScannervoidsetDataAttributes(List<DataAttribute> dataAttributes) Sets the provideddataAttributes.voidsetDBFieldMap(DBFieldMap dbfm) Sets theDBFieldMapobjectvoidsetDBObjectMap(DBObjectMap dbom) Sets theDBObjectMapcontained in the instanceprotected voidvalidate(CommandContext cc, PoolKit pk) Method to extend if you want to implement some logic of data validation; it can raise a DAException, or better, a DAValidateException.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface overit.geocall.edm.model.DataAttributesHolder
getEntitiesMethods inherited from interface overit.geocall.edm.model.EDMConfigurableBean
getEntity, hasEntity
-
Field Details
-
SELECT_FILTER
StandardCommandthat implements the query: SELECT * FROM TABLE WHERE ... = ? -
SELECT_NONE
StandardCommandthat implements the empty query: SELECT * FROM TABLE WHERE 1 = 0 -
SELECT_PK
StandardCommandthat implements the query: SELECT * FROM TABLE WHERE PRIMARY_KEY = ? -
DELETE_FILTER
StandardCommandthat deletes a record, using the filter passed to theCommandContext -
DELETE_PK
StandardCommandthat deletes a record, using the primary key field passed to theCommandContext -
UPDATE_FILTER
StandardCommandthat updates a record, using the filter passed to theCommandContext -
UPDATE_PK
StandardCommandthat updates a record, using the primary key passed to theCommandContext -
INSERT
StandardCommandthat inserts a new record -
INSERT_ATTEMPT
StandardCommandthat tries to insert a new record; if the insert fails, returns the value 0 and not an error -
UPSERT
Standard UPSERTCommand: tries to make an update, if fails do an insert -
INSATE
Deprecated.Standard INSATECommand: tries to make an insert with theINSERT_ATTEMPT, if obtains 0 (meaning that the insert has failed) do an update -
V_LEVEL_ENABLED
- See Also:
-
_dbfm
-
_dbom
-
-
Constructor Details
-
DAO
public DAO()Creates a newDAOinstance.
-
-
Method Details
-
commandForName
Returns theCommandthat corresponds to the query or command name passed as parameter- Parameters:
name- The string that defines the name of a query or command- Returns:
- The instance of
Commandthat corresponds to the string passed as parameter ornullif there isn't such Command, or an exception occurs
-
getTeacher
Returns theTeacherused for the translations by the DAO- Returns:
- The
Teacherinstance associated to the DAO
-
getDBFieldMap
Description copied from interface:DBFieldMapperReturns theDBFieldMapobject- Specified by:
getDBFieldMapin interfaceDBFieldMapper- Returns:
- The map used for the transformations of fields names
-
setDBFieldMap
Description copied from interface:DBFieldMapperSets theDBFieldMapobject- Specified by:
setDBFieldMapin interfaceDBFieldMapper- Parameters:
dbfm- The map used for the transformations of fields names
-
haveDBFieldMap
public boolean haveDBFieldMap()Description copied from interface:DBFieldMapperChecks if there is a correctDBFieldMapobject- Specified by:
haveDBFieldMapin interfaceDBFieldMapper- Returns:
trueif there is a correct DBFieldMap,falseotherwise
-
getDBObjectMap
Description copied from interface:DBObjectMapperReturns theDBObjectMapcontained in the instance- Specified by:
getDBObjectMapin interfaceDBObjectMapper- Returns:
- The map of objects used in this instance
-
setDBObjectMap
Description copied from interface:DBObjectMapperSets theDBObjectMapcontained in the instance- Specified by:
setDBObjectMapin interfaceDBObjectMapper- Parameters:
dbom- The map of objects used in this instance
-
haveDBObjectMap
public boolean haveDBObjectMap()Description copied from interface:DBObjectMapperChecks the presence of a validDBObjectMapcontained in the instance.- Specified by:
haveDBObjectMapin interfaceDBObjectMapper- Returns:
- true if the instance contains a map of object that is not null, false otherwise
-
getFactory
Returns the name of the field of the table in which is stored the "factory id" value, set with the Factory annotation- Returns:
- The string that represents the name of the field of the table in which is stored the "factory id" value, that is, the foreign key to the factories table
-
getBranch
Returns the name of the field of the table in which is stored the "branch id" value, set with the Branch annotation- Returns:
- The string that represents the name of the field of the table in which is stored the "branch id" value, that is, the foreign key to the branches table
-
getPool
Returns the name of the pool from which the specific DAO extracts the connections when they are not explicitly passed to methods.- Returns:
- The name of the pool, as indicated in the configuration file, from which the specific DAO extracts the connections.
-
getTransaction
Get the name of the transaction to be extracted from the PoolKit- Returns:
- name of the transaction to be extracted from the PoolKit
-
getPk
Returns the array that contains the primary keys of the specific table on which the DAO acts.- Returns:
- Array that contains the names of the fields that are primary keys of the specific table
-
getSequence
Returns a string that represent the name of the field used as sequence for the insert commands on the table.- Returns:
- The name of the sequence field or null if there isn't a defined sequence
-
isService
public boolean isService()Returns the boolean value that determines whether connection extraction takes place from the standard pool or the service pool- Returns:
falsefor ordinary connection extraction,truefor ServicePool extraction
-
isDistinct
Returns the boolean value that determines whether the queries use the DISTINCT clause or not- Parameters:
cc- TheCommandContextassociated to the DAO- Returns:
trueif the queries use the DISTINCT,falseotherwise
-
getStar
Returns the array that contains the field list for all the select queries.- Parameters:
cc- TheCommandContextassociated to the DAO- Returns:
- The array of strings that represents the names of the columns to be extracted;
the default value is the array consisting of a single element, the character
*
-
getTable
Returns the name of the table on which the specific DAO acts- Parameters:
cc- TheCommandContextassociated to the DAO- Returns:
- The string that represents the name of the table on which the DAO want to access and operate
-
getLevel
Returns the name of the field of the table in which is stored the "level" value, so that the optimistic lock can be managed.- Returns:
- The
Stringabout the name of the field of the table in which is stored the "level" value, so that the optimistic lock can be managed.
-
getEncrypt
Returns aString[] about the fields that need to be encrypted, so that encryption can be handled on those fields.- Returns:
- a
String[] about the fields that need to be encrypted, so that encryption can be handled on those fields.
-
isEncrypted
public boolean isEncrypted()- Returns:
trueif thisDAOinstance requires the encryption mechanism;falseotherwise.
-
getCode
Returns aStringabout the name of the field of the table containing acodecapable of uniquely identifying each record (useful during the export of the system configuration).- Parameters:
cc- theCommandContextassociated to theDAO.- Returns:
- a
Stringabout the name of the field of the table containing acodecapable of uniquely identifying each record (useful during the export of the system configuration).
-
getDataAttributes
Description copied from interface:DataAttributesHolder- Specified by:
getDataAttributesin interfaceDataAttributesHolder- Returns:
- a
List<DataAttribute> about theEDMdata attributes.
-
setDataAttributes
Description copied from interface:DataAttributesHolderSets the provideddataAttributes.- Specified by:
setDataAttributesin interfaceDataAttributesHolder- Parameters:
dataAttributes-List<DataAttribute> about theEDMdata attributes to be set.
-
markAsDecorated
public void markAsDecorated()Description copied from interface:EDMConfigurableBeanMark thisEDMConfigurableBeanas already decorated withEDMconfiguration.- Specified by:
markAsDecoratedin interfaceEDMConfigurableBean
-
hasNotBeenDecorated
public boolean hasNotBeenDecorated()Description copied from interface:EDMConfigurableBeanReturnstruein case thisEDMConfigurableBeanhas not been already decorated withEDMconfiguration;falseotherwise.- Specified by:
hasNotBeenDecoratedin interfaceEDMConfigurableBean- Returns:
truein case thisEDMConfigurableBeanhas not been already decorated withEDMconfiguration;falseotherwise.
-
getOrder
Returns the array that contains the names of the columns on which we want to make the sorting of the results of the queries.
The method checks for the presence of a sort string in theCommandContext, the one returned by theCommandContext.getOrder()method; the default implementation interprets the string as a comma-separated list of field names on which you want to sort query results. The presence of the exclamation point in front of a field name defines the will to order in a descending direction with respect to that field.
The extensions of this method can define their own grammar for the received string.
If there is no sort string in the CommandContext, the fields are searched using the annotation Group- Parameters:
cc- The {CommandContext} associated to the DAO- Returns:
- The array of strings that represents the name of the columns, and the corresponding sorting verse, used for the sorting of the results of the queries;
-
getGroup
Returns the array that contains the names of the columns on which we want to group the reults of the queries.- Parameters:
cc- TheCommandContextassociated to the DAO- Returns:
- The array of strings that represents the name of the columns used for the grouping of the results of the queries
-
getFilterCriterion
Method to extend to go to introduce the inferential rules with which to deduce the SQL automatically based on the context passed as a parameter.- Parameters:
cc- TheCommandContextassociated to the DAO- Returns:
- The
Criterionused to create the SQL By default the method returns theCriteria.SEARCH_STRONGfor the commands that refers to key fields and theCriteria.SEARCHfor all the other commands.
-
getValuesCriterion
Method that defines theCriterionused for the different commands- Parameters:
cc- TheCommandContextassociated to the DAO- Returns:
Criteria.INSERT_ASSIGNfor theCommand.Type.INSERTcommands,Criteria.UPDATE_ASSIGNfor theCommand.Type.UPDATEcommands
-
execute
Executes the command; it extracts a newPooledConnectionfrom the pool- Parameters:
cc- TheCommandContextassociated to the DAO- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
execute
Executes the command- Parameters:
cc- TheCommandContextassociated to the DAO; it can't be nullpk- ThePoolKitused to connect to the database; it can't be null- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
execute
Executes the providedBatch; it extracts a newPooledConnectionfrom the pool.- Parameters:
batch- TheBatchcontaining a list ofCommandContexts associated to theDAO; it can't be null.- Throws:
DAException- If there is a (blocking) data-access error, aDAExceptionmust be thrown.DAValidateException- If there are error in the validation phase, aDAValidateExceptionmust be thrown.
-
execute
Executes the providedBatch.- Parameters:
batch- TheBatchcontaining a list ofCommandContexts associated to theDAO; it can't be null.pk- ThePoolKitused to connect to the database; it can't be null.- Throws:
DAException- If there is a (blocking) data-access error, aDAExceptionmust be thrown.DAValidateException- If there are error in the validation phase, aDAValidateExceptionmust be thrown.
-
scan
public void scan(CommandContext cc, PoolKit pk, DBScanner scanner) throws DAException, DAValidateException scans the dataset defined by a DAO Select command with aDBScanner- Parameters:
cc- TheCommandContextassociated to the DAO; it can't be nullpk- ThePoolKitused to connect to the database; it can't be nullscanner- a DBCursor/ResultSet scanner- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
query
Executes the query defined by theCommandContextpassed as parameter- Parameters:
cc- TheCommandContextassociated to the DAO;- Returns:
- The
DBViewthat contains the records extracted - Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
query
Executes the query defined by theCommandContextpassed as parameter- Parameters:
cc- TheCommandContextassociated to the DAO;pk- ThePoolKitused to connect to the database;- Returns:
- The
DBViewthat contains the records extracted - Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
command
Executes the command defined by theCommandContextpassed as parameter- Parameters:
cc- TheCommandContextassociated to the DAO;pk- ThePoolKitused to connect to the database;- Returns:
- The number of records that have been entered, modified or deleted
- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
command
Executes the command defined by theCommandContextpassed as parameter- Parameters:
cc- TheCommandContextassociated to the DAO;- Returns:
- The number of records that have been entered, modified or deleted
- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
validate
Method to extend if you want to implement some logic of data validation; it can raise a DAException, or better, a DAValidateException. By default the method verifies that, if the command requested is a command that refers to a key field, that key field has been defined for the DAO and that the key field is among those passed as filter.- Parameters:
cc- TheCommandContextassociated to the DAOpk- ThePoolKitfrom which extract the connections- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
defineValues
Method to extend to go to prepare the values operating Java side, for example making calculations, avoiding to operate SQL side that is much more difficult, inconvenient, difficult to maintain and not portable. Changing the values in this method can have a return in the application mask, since the same map of values is used, and not a clone of it. By default the method sets the correct values for the sequence, the datastamp and login, where necessary.- Parameters:
cc- TheCommandContextassociated to the DAOpk- ThePoolKitfrom which extract the connections- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
defineParams
The method performs a cloning of the maps of the filters and of the values and makes a merge, putting before the filter field names the string F: and before the value field names the string V: to avoid possible conflicts; this is necessary because the same field can be used with different semantics, as a filter and as a value, for example for theUPDATE_FILTERcommands- Parameters:
cc- TheCommandContextassociated to the DAOpk- ThePoolKitfrom which extract the connections- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
defineSql
The method creates the SQL command using the language of the criteria, and in particular based on the methodgetFilterCriterion(overit.geocall.da.CommandContext)- Parameters:
cc- TheCommandContextassociated to the DAOpk- ThePoolKitfrom which extract the connections- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
defineStatement
protected void defineStatement(CommandContext cc, PoolKit pk, DBStatement dbs) throws DAException, DAValidateException The method defines theDBStatement, sets the SQL and the parameters for the execution of the commands- Parameters:
cc- TheCommandContextassociated to the DAOpk- ThePoolKitfrom which extract the connectionsdbs- TheDBStatementthat is used to access the database- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
feedback
protected void feedback(CommandContext cc, PoolKit pk, DBStatement dbs) throws DAException, DAValidateException Method to be extended to carry out operations exploiting the result of the executed command; for example it can be used to implement CASE WHEN logics that can therefore be deleted from the SQL. The standard makes recursive calls for the correct execution of theUPSERTandINSATEoperations- Parameters:
cc- TheCommandContextassociated to the DAOpk- ThePoolKitfrom which extract the connectionsdbs- TheDBStatementthat is used to access the database- Throws:
DAException- If there is a (blocking) data-access error, a DAException must be thrownDAValidateException- If there are error in the validation phase, a DAValidateException must be thrown
-
UPSERT,INSERTorUPDATE_PKaccording to your needs.