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

public abstract class AbstractCommand extends Object implements Command
A class to support Web Site Commands.
Since:
1.0
Version:
11.2
Author:
Luke
  • Constructor Details

    • AbstractCommand

      public AbstractCommand()
  • Method Details

    • init

      public void init(String id, String cmdName)
      Initializes this command.
      Specified by:
      init in interface Command
      Parameters:
      id - the command ID
      cmdName - the name of the command
      Throws:
      IllegalStateException - if the command has already been initialized
    • securityException

      protected static CommandException securityException(String msg)
      Helper method to generate a security exception.
      Parameters:
      msg - the exception message
      Returns:
      a CommandException
    • forgottenException

      protected static CommandException forgottenException()
      Helper method to generate a content blocked exception.
      Returns:
      a CommandException
    • notFoundException

      protected static CommandException notFoundException(String msg)
      Helper method to generate an "item not found" exception.
      Parameters:
      msg - the exception message
      Returns:
      a CommandException
    • getName

      public final String getName()
      Description copied from interface: Command
      Return the name of the command.
      Specified by:
      getName in interface Command
      Returns:
      the command name
    • getID

      public final String getID()
      Description copied from interface: Command
      Return the ID of the command. This is usually set by the command factory.
      Specified by:
      getID in interface Command
      Returns:
      the command ID
    • getRoles

      public final Collection<String> 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.
      Specified by:
      getRoles in interface Command
      Returns:
      a Collection of role names
      See Also:
    • setRoles

      public final void setRoles(Collection<String> roles)
      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 interface Command
      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 Context
      paramHdr - the parameter name header
      dfmt - the date format pattern
      tfmt - time time format pattern
      Returns:
      a date/time value, or null if not found or unparseable
    • parseDateTime

      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.
      Parameters:
      ctx - the Command Context
      paramHdr - the parameter name header
      Returns:
      a date/time value, or null if not found or unparseable
      See Also: