Class PageModel

    • Field Detail

      • PAGE

        public static final java.lang.ThreadLocal<PageModel> PAGE
      • gson

        public final com.inductiveautomation.ignition.common.gson.Gson gson
      • id

        protected final java.lang.String id
        identifier of this view group. will be unique per tab open for a project
      • created

        protected final long created
      • syncManager

        protected final com.inductiveautomation.perspective.gateway.model.PropertySyncManager syncManager
      • channel

        protected final java.util.concurrent.atomic.AtomicReference<MessageChannel> channel
      • viewConfigLoader

        protected final java.util.function.Function<java.lang.String,​java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>> viewConfigLoader
      • lastKeepalive

        protected volatile long lastKeepalive
      • roundtrip

        protected volatile long roundtrip
    • Constructor Detail

      • PageModel

        public PageModel​(@Nonnull
                         InternalSession session,
                         @Nonnull
                         com.inductiveautomation.ignition.common.gson.Gson gson,
                         @Nonnull
                         LoggerEx log,
                         @Nonnull
                         java.lang.String pageId)
    • Method Detail

      • getPage

        @Nullable
        public Page getPage()
        Specified by:
        getPage in interface PerspectiveElement
        Returns:
        The Page that this element is part of. Will return null if this is the Session
      • getView

        @Nullable
        public View getView()
        Specified by:
        getView in interface PerspectiveElement
        Returns:
        The view within which this element exists, or null if this is a Page or Session
      • getName

        @Nonnull
        public java.lang.String getName()
        Specified by:
        getName in interface PerspectiveElement
        Returns:
        The name of the element. If this is a component, it will be the name of the component. If this is a View, the name will be "view". If this is a Page, the name will be "page". If this is the session, the name will be "session".
      • getPageEventBus

        public com.google.common.eventbus.EventBus getPageEventBus()
        Specified by:
        getPageEventBus in interface Page
      • createViewConfigLoader

        protected java.util.function.Function<java.lang.String,​java.util.concurrent.CompletableFuture<java.util.Optional<ViewConfig>>> createViewConfigLoader()
      • createHandlers

        protected PageModel.Handlers createHandlers​(com.inductiveautomation.ignition.common.gson.Gson gson,
                                                    LoggerEx log)
      • getId

        public java.lang.String getId()
        Specified by:
        getId in interface Page
      • getCreated

        public long getCreated()
        Specified by:
        getCreated in interface Page
      • getViewCount

        public int getViewCount()
      • getComponentCount

        public int getComponentCount()
      • getBindingCount

        public int getBindingCount()
      • mdcTeardown

        public void mdcTeardown()
        Description copied from interface: LoggingContext
        Tear down the MDC keys that are added in #mdcSetup
        Specified by:
        mdcTeardown in interface LoggingContext
      • notifyProjectUpdated

        public void notifyProjectUpdated()
      • send

        public void send​(java.lang.String protocol,
                         com.inductiveautomation.ignition.common.gson.JsonElement payload)
                  throws java.io.IOException
        Throws:
        java.io.IOException
      • send

        public void send​(java.lang.String protocol,
                         java.lang.String payload)
                  throws java.io.IOException
        Specified by:
        send in interface Page
        Throws:
        java.io.IOException
      • receive

        public void receive​(MessageChannel channel,
                            java.lang.String protocol,
                            java.io.Reader payload)
      • isConnected

        public boolean isConnected()
        Specified by:
        isConnected in interface Page
      • notifyConnected

        public void notifyConnected​(MessageChannel channel)
      • notifyDisconnected

        public void notifyDisconnected​(MessageChannel channel)
      • setPageTimeout

        public void setPageTimeout​(java.util.concurrent.ScheduledFuture<?> pageTimeout)
      • report

        public com.inductiveautomation.ignition.common.gson.JsonObject report()
        Generates a full report of the current views and their values.
        Returns:
        a json object containing the full property tree for the current executing project/session
      • briefReport

        public com.inductiveautomation.ignition.common.gson.JsonObject briefReport()
        Generates a brief report of the current views and their values for status pages.
        Returns:
        a json array containing brief info on the current executing project/session
      • sendKeepalive

        public void sendKeepalive()
        Sends a keepalive message down the websocket channel. This will provoke the page's frontend code to HTTP GET the route at /data/perspective/keepalive
      • sendGatewayLastActiveTime

        public void sendGatewayLastActiveTime​(long timestamp,
                                              long idleTime)
      • onKeepaliveReceived

        public void onKeepaliveReceived​(long timestamp)
        When the route /data/perspective/keepalive is fetched, it will route back to here
      • isViewAuthorized

        protected boolean isViewAuthorized​(@Nonnull
                                           ViewInstanceId viewInstanceId,
                                           @Nonnull
                                           ViewConfig viewConfig)
      • updateModulesInfo

        public void updateModulesInfo​(java.util.List<GatewayModule> modules)
      • disconnect

        public void disconnect()
      • close

        public void close​(@Nullable
                          java.lang.String message)
        Specified by:
        close in interface Page
      • newAuthChallenge

        public void newAuthChallenge​(AuthChallengeRequest authChallengeRequest)
                              throws java.lang.Exception
        Description copied from interface: Page
        Trigger a new authentication challenge. Sends a message to the client to open the authentication challenge workflow using whatever framing option was specified in the auth challenge request.
        Specified by:
        newAuthChallenge in interface Page
        Parameters:
        authChallengeRequest - the AuthChallengeRequest
        Throws:
        java.lang.Exception - if the client identifier associated with the auth challenge request is blank, or if the message channel between the Gateway and the Client is not currently open
      • newAuthChallengeInternal

        public void newAuthChallengeInternal​(AuthChallengeRequest authChallengeRequest)
                                      throws java.lang.Exception
        Throws:
        java.lang.Exception