Class ActivationKey

  • public class ActivationKey
    extends Object
    • Field Detail

      • NO_LIMIT

        public static final Long NO_LIMIT
    • Constructor Detail

      • ActivationKey

        public ActivationKey​(String publicKey,
                             String activationKey)
    • Method Detail

      • getInstance

        public static ActivationKey getInstance​(boolean refreshIfNeeded)
        Obtains the ActivationKey instance. Instances should be get in this way, rather than creating a new one. If refreshIfNeeded parameter is true, license is tried to be refreshed if it is needed to.
        refreshIfNeeded - refresh license if needed to
      • setInstance

        public static void setInstance​(ActivationKey ak)
      • reload

        public static ActivationKey reload()
        Reloads ActivationKey instance from information in DB.
      • getOpsLogId

        public String getOpsLogId()
        Returns a CRC hash of the public key
      • getPublicKey

        public String getPublicKey()
      • isActive

        public boolean isActive()
        Returns true when the instance currently is OBPS active, this is when it has a valid activation key.
      • isActiveInstance

        public static boolean isActiveInstance()
        Returns true when the instance currently is OBPS active. It is similar as isActive, but it is static and is initialized whenever the ActivationKey class is instantiated.
      • isOPSInstance

        public boolean isOPSInstance()
        Returns true when the instance has a activation key and the activation file has been loaded. It doesn't verify is still valid.
      • hasActivationKey

        public boolean hasActivationKey()
        Returns true in case the instance has activation key though it might not be valid or activated
      • getErrorMessage

        public String getErrorMessage()
      • getMessageType

        public String getMessageType()
      • getInstanceActivationExtraActionsHtml

        public String getInstanceActivationExtraActionsHtml​(XmlEngine xmlEngine)
        gets HTML to be injected in Instance Activation window with additional actions to be performed
      • checkOPSLimitations

        public ActivationKey.LicenseRestriction checkOPSLimitations​(String currentSession,
                                                                    String sessionType)
        Checks the current activation key
        currentSession - Current session, used for checking the concurrent users limitation.
        sessionType - Successful session type: if the session is finally successful this is the type that will be marked with in AD_Session, it is used to determine whether it should or not count for CU limitation. In case it is null it will be counted.
        ActivationKey.LicenseRestriction with the status of the restrictions
      • consumesConcurrentUser

        public static boolean consumesConcurrentUser​(String sessionType)
        Returns whether a session type is counted for concurrent users
      • isHeartbeatActive

        public boolean isHeartbeatActive()
        Checks if heartbeat is active and a beat has been sent during last days.
      • getPOSTerminalsExplanation

        public String getPOSTerminalsExplanation()
        Returns a message for POS Terminals limitations
      • hasExpirationDate

        public boolean hasExpirationDate()
      • getProperty

        public String getProperty​(String propName)
      • getPendingDays

        public Long getPendingDays()
      • isSubscriptionConverted

        public boolean isSubscriptionConverted()
      • hasExpired

        public boolean hasExpired()
      • isNotActiveYet

        public boolean isNotActiveYet()
      • hasUnlimitedWsAccess

        public boolean hasUnlimitedWsAccess()
      • getExpiredInstalledModules

        public ArrayList<Module> getExpiredInstalledModules()
        Obtains a List of all the modules that are installed in the instance which license has expired.
        List of the expired modules
      • getSubscribedModules

        public HashMap<String,​ActivationKey.CommercialModuleStatus> getSubscribedModules()
        Obtains a list for modules ID the instance is subscribed to and their statuses
        HashMap<String, CommercialModuleStatus> containing the subscribed modules
      • getActiveSessions

        public int getActiveSessions​(String currentSession)
        Returns the number of current active sessions
      • isModuleEnableable

        public boolean isModuleEnableable​(Module module)
        Checks whether a disabled module can be enabled again. A commercial module cannot be enabled in case its license has expired or the instance is not commercial.
        module -
        true in case the module can be enabled
      • isModuleSubscribed

        public ActivationKey.CommercialModuleStatus isModuleSubscribed​(String moduleId)
        Returns the status for the commercial module passed as parameter. Note that module tier is not checked here, this should be correctly handled in the license itself.
        moduleId -
        the status for the commercial module passed as parameter
      • hasLicenseAccess

        public ActivationKey.FeatureRestriction hasLicenseAccess​(String type,
                                                                 String id)
        Checks whether there is access to an artifact because of license restrictions (checking core advance and premium features).
        type - Type of artifact (Window, Report, Process...)
        id - Id of the Artifact
        true in case it has access, false if not
      • verifyInstalledModules

        public String verifyInstalledModules()
        Verifies all the commercial installed modules are allowed to the instance.
        List of non allowed modules
      • isTrial

        public boolean isTrial()
      • isGolden

        public boolean isGolden()
      • getExpirationMessage

        public org.codehaus.jettison.json.JSONObject getExpirationMessage​(String lang)
        Returns a JSONObject with a message warning about near expiration or already expired instance to be displayed in Login page.
      • checkNewWSCall

        public ActivationKey.WSRestriction checkNewWSCall​(boolean updateCounter)
        This method checks web service can be called. If updateCounter parameter is true number of daily calls is increased by one.
        updateCounter - daily calls should be updated
      • getNumberWSDayCounter

        public int getNumberWSDayCounter()
      • getWsCallsExceededDays

        public int getWsCallsExceededDays()
        Returns the number of days during last 30 days exceeding the maximum allowed number of calls
      • getExtraWsExceededDaysAllowed

        public int getExtraWsExceededDaysAllowed()
        Returns the number of days that can exceed the maximum number of ws calls taking into account the ones that exceeded it during last 30 days.
      • getNumberOfDaysLeftInPeriod

        public int getNumberOfDaysLeftInPeriod()
        Returns the number of days pending till the end of ws calls verification period.
      • getAllowedPosTerminals

        public Long getAllowedPosTerminals()
      • getPosTerminalsWarn

        public Long getPosTerminalsWarn()
      • forceSysAdminLogin

        public boolean forceSysAdminLogin​(javax.servlet.http.HttpSession session)
        Returns whether only System Admin should be allowed, because it is already set in session or there are license restrictions.
      • isStatelessRequestAllowed

        public boolean isStatelessRequestAllowed()
        Returns whether the stateless request is allowed or not due to any license limitation.
      • getInstanceProperties

        public Properties getInstanceProperties()
        all license's properties
      • getStartDate

        public Date getStartDate()
        starting valid date for license
      • getEndDate

        public Date getEndDate()
        license's expiration date
      • getMaxUsers

        public Long getMaxUsers()
        maximum allowed concurrent users