Cisco Systems, Inc.

com.pcube.apps.engage.policy
Class SubscriberRedirection

java.lang.Object
  extended by com.pcube.apps.engage.foundations.NamedObjectBase
      extended by com.pcube.apps.engage.policy.SubNotification
          extended by com.pcube.apps.engage.policy.SubscriberRedirection
All Implemented Interfaces:
Formattable, com.pcube.apps.framework.commons.NamedObject, java.io.Serializable

public class SubscriberRedirection
extends SubNotification
implements Formattable, java.io.Serializable

Author:
sneimark
See Also:
Serialized Form

Field Summary
static int ACTIVATION_FREQUENCY_ALWAYS
           
static int ACTIVATION_FREQUENCY_ONCE
           
static int ACTIVATION_FREQUENCY_ONCE_IN_A_DAY
           
static int ACTIVATION_FREQUENCY_ONCE_IN_A_MONTH
           
static int ACTIVATION_FREQUENCY_ONCE_IN_A_WEEK
           
static int ACTIVATION_FREQUENCY_PERIODICALLY_EVENTS
           
static int ACTIVATION_FREQUENCY_PERIODICALLY_KBYTES
           
static int ACTIVATION_FREQUENCY_PERIODICALLY_SECONDS
           
static int ACTIVATION_FREQUENCY_UNTIL_SUBSCRIBER_BROWSES_TO
           
static int DEFAULT_REDIRECT_SET_VALUE
           
static int MAX_NUMBER_ALLOWED_URL
           
static int NOTIFICATION_ACTIVATION_TRIGGER_ANY
           
static int NOTIFICATION_ACTIVATION_TRIGGER_BROWSE_TO_NEW_SITE
           
static int NOTIFICATION_ACTIVATION_TRIGGER_SUBSCRIBER_CLICKS
           
static int NOTIFICATION_TYPE_CONDITIONAL_REDIRECT
           
static int NOTIFICATION_TYPE_NOTIFICATION
           
 
Fields inherited from class com.pcube.apps.engage.policy.SubNotification
DEST_URL_MAX_LENGTH, DEST_URL_VALUE, DISMISSAL_METHOD_DEAC, DISMISSAL_METHOD_DEST, DISMISSAL_METHOD_DISS, DISMISSAL_URL_VALUE, DISS_URL_MAX_LENGTH
 
Constructor Summary
SubscriberRedirection(Policy newPolicy)
           
 
Method Summary
static java.lang.String chopHttpPrefixIfExist(java.lang.String httpUrl)
           
 com.pcube.apps.engage.policy.urlpattern.PrefixSuffixLUT createWhiteListLUT(boolean addNotificationRedirectURL)
          return the whole LUT, adding the dismissal and redirect urls is optional
static java.lang.String extractHost(java.lang.String httpUrl)
          extract host from httpUrl
static java.lang.String extractPath(java.lang.String httpUrl)
          extract path from httpUrl
static com.pcube.apps.engage.policy.urlpattern.UrlPattern findNotificationHttpRedirectURL(Policy myPolicy, int index)
          find notification HTTP redirect URL based on redirect index
 void fromStream(java.io.BufferedReader in, Formatter f)
          Method fromStream
 boolean getAcrossLoginValue()
           
 int getActivationFrequency()
           
 int getActivationTrigger()
          get flow type
 java.net.URL getDestinationURL()
          Deprecated. use {getRedirectSetIndex() instead}
 int getDismissalMethod()
          Deprecated. use {getActivationFrequency() instead}
 com.pcube.apps.engage.policy.urlpattern.UrlPattern getDismissalUrl()
           
 com.pcube.apps.engage.policy.urlpattern.UrlPattern getDismissalURL()
          Deprecated. use {getDismissalUrl()instead}
 boolean getEnableRateLimit()
           
 int getIndex()
          notification's id
 int getPeriodicallyValue()
           
 int getRateLimitValue()
           
 int getRedirectProfileType()
          get notification type - conditional redirect or notification
 int getRedirectSetIndex()
          get redirect set index
 java.util.ArrayList getUrlWhiteList()
          Deprecated. use getWhiteUrlList()instead}
 java.util.ArrayList<com.pcube.apps.engage.policy.urlpattern.UrlPattern> getWhiteUrlList()
          get the white URL list
static boolean isPeriodicallyActivationFrequency(int newActivationFrequency)
           
static boolean isPeriodicallyActivationFrequency(Policy myPolicy, int index)
           
 void setAcrossLoginValue(boolean newAcrossLoginValue)
           
 void setActivationFrequency(java.util.HashMap<Package,java.util.HashMap<java.lang.Integer,java.lang.Integer>> package2countAssignedPeriodicConRedirect, int howToActiveMethod)
          this method should be called while updating the list in background and only after update the policy list accordingly (GUI dialog for instance)
 void setActivationFrequency(int howToActiveMethod)
          each time while set activation frequency, validate periodic condition redirect counter
 void setActivationTrigger(int flowType)
          set flow type NOTIFICATION_FLOW_TYPE_CLICK_STREAM = 2 NOTIFICATION_FLOW_TYPE_CROSS_SITE = 1 NOTIFICATION_FLOW_TYPE_ALWAYS = 0
 void setDestinationURL(java.lang.String newDestination)
          Deprecated. use {SubscriberRedirection#setRedirectSetIndex() instead}
 void setDestinationURL(java.net.URL newDestination)
          Deprecated. use {SubscriberRedirection#setRedirectSetIndex() instead}
 void setDismissalMethod(int dismissalMethod)
          Deprecated. use {SubscriberRedirection#setHowToActiveMethod() instead}
 void setDismissalUrl(com.pcube.apps.engage.policy.urlpattern.UrlPattern newDismissalUrl)
           
 void setDismissalURL(com.pcube.apps.engage.policy.urlpattern.UrlPattern newDissUrl)
          Deprecated. use {SubscriberRedirection#setDismissalUrl()instead}
 void setEnableRateLimit(boolean enableRateLimit)
           
 void setIndex(int index)
          notification's id
 void setPeriodicallyValue(int newPeriodicallyValue)
           
 void setRateLimitValue(int newRateLimitValue)
           
 void setRedirectProfileType(int newNotificationType)
          set notification type - conditional redirect or notification NOTIFICATION_TYPE_CONDITIONAL_REDIRECT = 0; NOTIFICATION_TYPE_NOTIFICATION = 1;
 void setRedirectSetIndex(int newRedirectSetIndex)
          set redirect set index
 void setUrlWhiteList(java.util.ArrayList urlPatterns)
          Deprecated. use SubscriberRedirection#setWhiteUrlList()instead.
 void setWhiteUrlList(java.util.ArrayList<com.pcube.apps.engage.policy.urlpattern.UrlPattern> newWhiteUrlList)
          Set the white URLs list
 void toStream(java.io.PrintStream out, Formatter f)
          Method toStream
 java.lang.String toString()
          Automatically generated method: toString
 
Methods inherited from class com.pcube.apps.engage.policy.SubNotification
convertOldNotifToNewNotif, createDefault, createNetworkAttackNotification, createWhiteListLUT, getId, isTailAppended, setId, setTailAppended
 
Methods inherited from class com.pcube.apps.engage.foundations.NamedObjectBase
addPropertyChangedListener, addVetoableChangeListener, getName, removePropertyChangedListener, removeVetoableChangeListener, setName
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

NOTIFICATION_TYPE_CONDITIONAL_REDIRECT

public static final int NOTIFICATION_TYPE_CONDITIONAL_REDIRECT
See Also:
Constant Field Values

NOTIFICATION_TYPE_NOTIFICATION

public static final int NOTIFICATION_TYPE_NOTIFICATION
See Also:
Constant Field Values

NOTIFICATION_ACTIVATION_TRIGGER_SUBSCRIBER_CLICKS

public static final int NOTIFICATION_ACTIVATION_TRIGGER_SUBSCRIBER_CLICKS
See Also:
Constant Field Values

NOTIFICATION_ACTIVATION_TRIGGER_BROWSE_TO_NEW_SITE

public static final int NOTIFICATION_ACTIVATION_TRIGGER_BROWSE_TO_NEW_SITE
See Also:
Constant Field Values

NOTIFICATION_ACTIVATION_TRIGGER_ANY

public static final int NOTIFICATION_ACTIVATION_TRIGGER_ANY
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_UNTIL_SUBSCRIBER_BROWSES_TO

public static final int ACTIVATION_FREQUENCY_UNTIL_SUBSCRIBER_BROWSES_TO
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_ALWAYS

public static final int ACTIVATION_FREQUENCY_ALWAYS
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_ONCE

public static final int ACTIVATION_FREQUENCY_ONCE
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_PERIODICALLY_SECONDS

public static final int ACTIVATION_FREQUENCY_PERIODICALLY_SECONDS
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_PERIODICALLY_EVENTS

public static final int ACTIVATION_FREQUENCY_PERIODICALLY_EVENTS
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_PERIODICALLY_KBYTES

public static final int ACTIVATION_FREQUENCY_PERIODICALLY_KBYTES
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_ONCE_IN_A_DAY

public static final int ACTIVATION_FREQUENCY_ONCE_IN_A_DAY
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_ONCE_IN_A_WEEK

public static final int ACTIVATION_FREQUENCY_ONCE_IN_A_WEEK
See Also:
Constant Field Values

ACTIVATION_FREQUENCY_ONCE_IN_A_MONTH

public static final int ACTIVATION_FREQUENCY_ONCE_IN_A_MONTH
See Also:
Constant Field Values

DEFAULT_REDIRECT_SET_VALUE

public static final int DEFAULT_REDIRECT_SET_VALUE
See Also:
Constant Field Values

MAX_NUMBER_ALLOWED_URL

public static final int MAX_NUMBER_ALLOWED_URL
See Also:
Constant Field Values
Constructor Detail

SubscriberRedirection

public SubscriberRedirection(Policy newPolicy)
Method Detail

chopHttpPrefixIfExist

public static java.lang.String chopHttpPrefixIfExist(java.lang.String httpUrl)

extractHost

public static java.lang.String extractHost(java.lang.String httpUrl)
extract host from httpUrl


extractPath

public static java.lang.String extractPath(java.lang.String httpUrl)
extract path from httpUrl


findNotificationHttpRedirectURL

public static com.pcube.apps.engage.policy.urlpattern.UrlPattern findNotificationHttpRedirectURL(Policy myPolicy,
                                                                                                 int index)
find notification HTTP redirect URL based on redirect index


createWhiteListLUT

public com.pcube.apps.engage.policy.urlpattern.PrefixSuffixLUT createWhiteListLUT(boolean addNotificationRedirectURL)
return the whole LUT, adding the dismissal and redirect urls is optional

Parameters:
addNotificationRedirectURL - true to add dismissal and destination URLs to LUT
Returns:
allowed URL LUT

fromStream

public void fromStream(java.io.BufferedReader in,
                       Formatter f)
                throws ImportExportException
Description copied from interface: Formattable
Method fromStream

Specified by:
fromStream in interface Formattable
Overrides:
fromStream in class SubNotification
Throws:
ImportExportException
See Also:
Formattable.fromStream(java.io.BufferedReader, com.pcube.apps.engage.common.Formatter)

getActivationFrequency

public int getActivationFrequency()

getActivationTrigger

public int getActivationTrigger()
get flow type

Returns:

getDestinationURL

public java.net.URL getDestinationURL()
Deprecated. use {getRedirectSetIndex() instead}

Overrides:
getDestinationURL in class SubNotification
Returns:
the destination url.

getDismissalMethod

public int getDismissalMethod()
Deprecated. use {getActivationFrequency() instead}

Override super

Overrides:
getDismissalMethod in class SubNotification
Returns:
Returns the dismissalMethod.

getDismissalUrl

public com.pcube.apps.engage.policy.urlpattern.UrlPattern getDismissalUrl()

getDismissalURL

public com.pcube.apps.engage.policy.urlpattern.UrlPattern getDismissalURL()
Deprecated. use {getDismissalUrl()instead}

Override super

Overrides:
getDismissalURL in class SubNotification
Returns:
Returns the dismissalUrl.

getIndex

public int getIndex()
notification's id

Returns:

getPeriodicallyValue

public int getPeriodicallyValue()

getRateLimitValue

public int getRateLimitValue()

getEnableRateLimit

public boolean getEnableRateLimit()

getAcrossLoginValue

public boolean getAcrossLoginValue()

getRedirectProfileType

public int getRedirectProfileType()
get notification type - conditional redirect or notification

Returns:

getRedirectSetIndex

public int getRedirectSetIndex()
get redirect set index

Returns:

getUrlWhiteList

public java.util.ArrayList getUrlWhiteList()
Deprecated. use getWhiteUrlList()instead}

return the list of allowed urls: screens the redirect and dismissal urls. NOTE: this method does not do any validation of list contents. Exception may occur when creating LUT that may corrupt the pqb

Overrides:
getUrlWhiteList in class SubNotification
Returns:
Returns the whiteUrlList.

getWhiteUrlList

public java.util.ArrayList<com.pcube.apps.engage.policy.urlpattern.UrlPattern> getWhiteUrlList()
get the white URL list

Returns:

setActivationFrequency

public void setActivationFrequency(int howToActiveMethod)
each time while set activation frequency, validate periodic condition redirect counter

Parameters:
howToActiveMethod -

setActivationFrequency

public void setActivationFrequency(java.util.HashMap<Package,java.util.HashMap<java.lang.Integer,java.lang.Integer>> package2countAssignedPeriodicConRedirect,
                                   int howToActiveMethod)
this method should be called while updating the list in background and only after update the policy list accordingly (GUI dialog for instance)

Parameters:
package2countAssignedPeriodicConRedirect -
howToActiveMethod -

setActivationTrigger

public void setActivationTrigger(int flowType)
set flow type NOTIFICATION_FLOW_TYPE_CLICK_STREAM = 2 NOTIFICATION_FLOW_TYPE_CROSS_SITE = 1 NOTIFICATION_FLOW_TYPE_ALWAYS = 0

Parameters:
flowType -

setDestinationURL

public void setDestinationURL(java.lang.String newDestination)
                       throws java.net.MalformedURLException
Deprecated. use {SubscriberRedirection#setRedirectSetIndex() instead}

Override super method

Overrides:
setDestinationURL in class SubNotification
Throws:
java.net.MalformedURLException - *

setDestinationURL

public void setDestinationURL(java.net.URL newDestination)
                       throws java.net.MalformedURLException
Deprecated. use {SubscriberRedirection#setRedirectSetIndex() instead}

Override super method

Overrides:
setDestinationURL in class SubNotification
Throws:
java.net.MalformedURLException - *

setDismissalMethod

public void setDismissalMethod(int dismissalMethod)
Deprecated. use {SubscriberRedirection#setHowToActiveMethod() instead}

override the super method for backward compatibility

Overrides:
setDismissalMethod in class SubNotification
Parameters:
dismissalMethod - The dismissalMethod to set.

setDismissalUrl

public void setDismissalUrl(com.pcube.apps.engage.policy.urlpattern.UrlPattern newDismissalUrl)

setDismissalURL

public void setDismissalURL(com.pcube.apps.engage.policy.urlpattern.UrlPattern newDissUrl)
Deprecated. use {SubscriberRedirection#setDismissalUrl()instead}

override the super method for backward compatibility

Overrides:
setDismissalURL in class SubNotification
Parameters:
newDissUrl - The dismissalUrl to set.

setIndex

public void setIndex(int index)
              throws java.beans.PropertyVetoException
notification's id

Throws:
java.beans.PropertyVetoException

setPeriodicallyValue

public void setPeriodicallyValue(int newPeriodicallyValue)

setRateLimitValue

public void setRateLimitValue(int newRateLimitValue)

setEnableRateLimit

public void setEnableRateLimit(boolean enableRateLimit)

setAcrossLoginValue

public void setAcrossLoginValue(boolean newAcrossLoginValue)

setRedirectProfileType

public void setRedirectProfileType(int newNotificationType)
set notification type - conditional redirect or notification NOTIFICATION_TYPE_CONDITIONAL_REDIRECT = 0; NOTIFICATION_TYPE_NOTIFICATION = 1;

Parameters:
newNotificationType -

setRedirectSetIndex

public void setRedirectSetIndex(int newRedirectSetIndex)
set redirect set index

Parameters:
newRedirectSetIndex -

setUrlWhiteList

public void setUrlWhiteList(java.util.ArrayList urlPatterns)
Deprecated. use SubscriberRedirection#setWhiteUrlList()instead.

override super method clears the current LUT contents and puts the contents of the specified list.

Overrides:
setUrlWhiteList in class SubNotification
Parameters:
urlPatterns - list of UrlPattern

setWhiteUrlList

public void setWhiteUrlList(java.util.ArrayList<com.pcube.apps.engage.policy.urlpattern.UrlPattern> newWhiteUrlList)
Set the white URLs list

Parameters:
newWhiteUrlList -

toStream

public void toStream(java.io.PrintStream out,
                     Formatter f)
Description copied from interface: Formattable
Method toStream

Specified by:
toStream in interface Formattable
Overrides:
toStream in class SubNotification
See Also:
Formattable.toStream(java.io.PrintStream, com.pcube.apps.engage.common.Formatter)

isPeriodicallyActivationFrequency

public static boolean isPeriodicallyActivationFrequency(int newActivationFrequency)

isPeriodicallyActivationFrequency

public static boolean isPeriodicallyActivationFrequency(Policy myPolicy,
                                                        int index)

toString

public java.lang.String toString()
Automatically generated method: toString

Overrides:
toString in class SubNotification
See Also:
Object.toString()

Cisco Systems, Inc.

Copyright © 2013 Cisco Systems, Inc. Confidential.