Class AbstractCommand
java.lang.Object
org.deltava.commands.AbstractCommand
- All Implemented Interfaces:
Command
- Direct Known Subclasses:
AbstractAcademyHistoryCommand
,AbstractCalendarCommand
,AbstractFormCommand
,AbstractLibraryCommand
,AbstractTestHistoryCommand
,AbstractViewCommand
,ACARSDeleteCommand
,AccomplishmentAirportMapCommand
,AccomplishmentCheckCommand
,AccomplishmentDeleteCommand
,AccomplishmentEligibilityCommand
,AccomplishmentUpdateCommand
,AirlineInformationListCommand
,AirlineListCommand
,AirlineTotalsCommand
,AirportDeleteCommand
,AirportExportCommand
,AirportInformationCommand
,APIStatsCommand
,ApplicantApproveCommand
,ApplicantDeleteCommand
,ApplicantFindCommand
,ApplicantRejectCommand
,ApplicationCommand
,AssignmentCommand
,AssignmentDeleteCommand
,AssignmentReleaseCommand
,AssignmentReserveCommand
,AssignmentSaveCommand
,AUSOTPlotCommand
,BlacklistDeleteCommand
,BriefingCommand
,BuildCommand
,CenturyClubCommand
,CertificationDeleteCommand
,CertificationListCommand
,ChannelAdminCommand
,ChannelDeleteCommand
,ChannelListCommand
,ChartDeleteCommand
,CharterRequestDeleteCommand
,CharterRequestDisposeCommand
,ChartsCommand
,CheckRideCommand
,CheckRidePIREPApprovalCommand
,CheckRidePIREPCommand
,CheckRideScoreCommand
,CheckRideScriptDeleteCommand
,ClientStatsCommand
,CommandStatsCommand
,ConnectionInfoDeleteCommand
,ContentOverrideCommand
,ContentReportCommand
,CookieCheckCommand
,CookieDataCommand
,CourseAssignCommand
,CourseCheckRideCommand
,CourseCommentCommand
,CourseDeleteCommand
,CourseDisposalCommand
,CourseProgressCommand
,DashboardCommand
,DiagnosticCommand
,DiscordRegistrationCommand
,DispatcherStatsCommand
,DispatchRouteUpdateCommand
,DuplicatePilotCommand
,DuplicatePilotMergeCommand
,DuplicatePilotSearchCommand
,EliteInfoCommand
,EliteLevelSetCommand
,EliteLifetimeDeleteCommand
,ElitePilotsCommand
,EliteRolloverCommand
,EliteStatsCommand
,EliteStatusCalculateCommand
,EmoticonHelperCommand
,ErrorLogDeleteCommand
,ErrorLogEntryCommand
,ErrorLogPurgeCommand
,EventAssignCommand
,EventBalanceCommand
,EventCancelCommand
,EventCommand
,EventDeleteCommand
,EventEditCommand
,EventReleaseCommand
,EventSaveCommand
,EventSignupCommand
,ExamCommand
,ExamDeleteCommand
,ExamProfileDeleteCommand
,ExamProfilesCommand
,ExamScoreCommand
,ExamSubmitCommand
,ExternalPIREPApprovalCommand
,ExternalPIREPCommand
,FAAChartDownloadCommand
,FindFlightCommand
,FlightBoardCommand
,FlightBoardMapCommand
,FlightInfoCommand
,FlightInfoDeleteCommand
,FlightPreapproveCommand
,ForgetUserCommand
,GalleryDeleteCommand
,GateCalculateCommand
,GateInformationCommand
,HelpDeskSearchCommand
,HomeCommand
,IMAPDeleteCommand
,ImportStatusCommand
,InactivityListCommand
,InstallerStatsCommand
,InstructionCancelCommand
,InstructorBusyDeleteCommand
,InstructorBusySaveCommand
,InvalidateEmailCommand
,IPBlockImportCommand
,IPGeoImportCommand
,IssueCloseCommand
,IssueCommentCommand
,IssueCommentCommand
,IssueConvertCommand
,IssueConvertCommand
,IssueSearchCommand
,IssueUpdateCommand
,JobApproveCommand
,JobCloneCommand
,JobCommentCommand
,JobCompleteCommand
,JobDeleteCommand
,JobResetCommand
,LeaveCommand
,LinkImageCommand
,LiveryDeleteCommand
,LoadCalculateCommand
,LoadInfoCommand
,LoginCommand
,LogoutCommand
,ManualDeleteCommand
,MapCommand
,MapCommand
,MassMailingCommand
,MembershipStatsCommand
,MessageTemplateDeleteCommand
,NATPlotCommand
,NavaidSearchCommand
,NavDataImportCommand
,NavigationCycleCommand
,NetworkServersCommand
,NewAirportListCommand
,NewsDeleteCommand
,NewsEditCommand
,NewsSaveCommand
,NominationCenterCommand
,NominationDisposeCommand
,NominationPostponeCommand
,NominationPurgeCommand
,NominationRescoreCommand
,NOTAMEditCommand
,NOTAMSaveCommand
,NotificationClearCommand
,NotificationListUpdateCommand
,NotificationToggleCommand
,OfflineFlightCommand
,PACOTPlotCommand
,PartnerDeleteCommand
,PasswordResetCommand
,PilotActivationCommand
,PilotBoardCommand
,PilotLocationCommand
,PilotRecognitionCommand
,PilotRouteMapCommand
,PilotSearchCommand
,PIREPDeleteCommand
,PIREPDisposalCommand
,PIREPEliteScoreCommand
,PIREPReleaseCommand
,PIREPSubmitCommand
,PIREPWithdrawCommand
,PostDeleteCommand
,PrivacyInfoCommand
,PromotionToggleCommand
,QuestionDeleteCommand
,QuestionIncludeCommand
,QuestionnaireCommand
,QuestionnaireScoreCommand
,QuestionnaireSubmitCommand
,QuestionProfileSearchCommand
,RatingCountCommand
,RedirectCommand
,RegisterCommand
,ResendValidationCommand
,ResendValidationCommand
,ResetCommand
,ResourceDeleteCommand
,ResourceJumpCommand
,ResponseTemplateDeleteCommand
,RestoreImageLinksCommand
,RetireUserCommand
,ReturnCharterCommand
,RideScriptDeleteCommand
,RideScriptsCommand
,RouteAssignmentBuildCommand
,RouteAssignmentSearchCommand
,RouteCommand
,RouteCommand
,RouteDeleteCommand
,RouteMapCommand
,RoutePlotCommand
,RoutePlotCommand
,RouteSaveCommand
,RouteSearchCommand
,RouteToggleCommand
,RunwayCalculateCommand
,RunwayChoiceCommand
,ScheduleDeleteCommand
,ScheduleExportCommand
,ScheduleFilterCommand
,ScheduleImportCommand
,ScheduleSyncCommand
,SecurityRoleMembersCommand
,SELCALReserveCommand
,ServiceEntryDeleteCommand
,ShortListCommand
,SignatureApproveCommand
,SignatureUpdateCommand
,SingleAssignmentBuildCommand
,SingleAssignmentSearchCommand
,StaffProfileCommand
,StaffRosterCommand
,StatusCommentCommand
,SuspendUserCommand
,TaskExecuteCommand
,ThreadCommand
,ThreadDeleteCommand
,ThreadLockCommand
,ThreadMoveCommand
,ThreadPostCommand
,ThreadReplyCommand
,ThreadStickCommand
,ThreadSubjectEditCommand
,ThreadUnlockCommand
,ThreadUnstickCommand
,TourDeleteCommand
,TrackMapCommand
,TransferAirlineCommand
,TransferApproveCommand
,TransferConvertCommand
,TransferDeleteCommand
,TransferProcessCommand
,TransferRejectCommand
,UnlinkImageCommand
,UnreadClearCommand
,UnservicedAirportsCommand
,UpdateCommentsCommand
,UpdateEmailCommand
,UpdateEventCommand
,UpdateRunwayCommand
,UpdateTouchdownCommand
,UpdateTourCommand
,UserFileDeleteCommand
,UserListCommand
,UserSwitchCommand
,ValidateEmailCommand
,ValidateEMailCommand
,VideoDeleteCommand
,WeatherCenterCommand
,WeatherFinderCommand
,WelcomeMessageCommand
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.deltava.commands.Command
Command.Scope
-
Field Summary
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected static CommandException
Helper method to generate a content blocked exception.final String
getID()
Return the ID of the command.final String
getName()
Return the name of the command.final Collection
<String> getRoles()
Return the roles authorized to execute this command.void
Initializes this command.protected static CommandException
notFoundException
(String msg) Helper method to generate an "item not found" exception.protected static Instant
parseDateTime
(CommandContext ctx, String paramHdr) Parses one or two HTTP request parameters into a date/time value, using the user's format patterns or the default format patterns if the user is not authenticated.protected static Instant
parseDateTime
(CommandContext ctx, String paramHdr, String dfmt, String tfmt) Parses one or two HTTP request parameters into a date/time value.protected static CommandException
securityException
(String msg) Helper method to generate a security exception.final void
setRoles
(Collection<String> roles) Updates the roles authorized to execute this command.
-
Constructor Details
-
AbstractCommand
public AbstractCommand()
-
-
Method Details
-
init
Initializes this command.- Specified by:
init
in interfaceCommand
- Parameters:
id
- the command IDcmdName
- the name of the command- Throws:
IllegalStateException
- if the command has already been initialized
-
securityException
Helper method to generate a security exception.- Parameters:
msg
- the exception message- Returns:
- a CommandException
-
forgottenException
Helper method to generate a content blocked exception.- Returns:
- a CommandException
-
notFoundException
Helper method to generate an "item not found" exception.- Parameters:
msg
- the exception message- Returns:
- a CommandException
-
getName
-
getID
-
getRoles
Return the roles authorized to execute this command. If setRoles() has not been called, this will return an empty Set. Commands defined to be executed by all users should have a wildcard entry (*) as an authorized role. -
setRoles
Updates the roles authorized to execute this command. This will make a copy of the List object provided (ie. making it immutable) for security reasons.- Specified by:
setRoles
in interfaceCommand
- Parameters:
roles
- the List of role names- Throws:
IllegalStateException
- if setRoles() has already been called- See Also:
-
parseDateTime
protected static Instant parseDateTime(CommandContext ctx, String paramHdr, String dfmt, String tfmt) Parses one or two HTTP request parameters into a date/time value. The parameter name header is used to construct the request parameter names. If the request contains a parameter called "$HDR$dateTime", then the parameter will be parsed as a date/time value. If the request contains two parameters named "$HDR$date" and "$HDR$time", then they will be appended and parsed together. If only a single parameter is found, it is parsed appropriately.- Parameters:
ctx
- the Command ContextparamHdr
- the parameter name headerdfmt
- the date format patterntfmt
- time time format pattern- Returns:
- a date/time value, or null if not found or unparseable
-
parseDateTime
Parses one or two HTTP request parameters into a date/time value, using the user's format patterns or the default format patterns if the user is not authenticated.- Parameters:
ctx
- the Command ContextparamHdr
- the parameter name header- Returns:
- a date/time value, or null if not found or unparseable
- See Also:
-