cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Announcements

Community Helping Community

Counter Element Dynamic Configuration

245
Views
0
Helpful
0
Comments

Subject: RE: Counter Element Dynamic Configuration
Replied by: Janine Graves on 16-04-2013 09:19:11 AM
This is a simply dynamic configuration for a counter element.  It looks for a session variable named 'reset' to have the value 'true', and if found, then it resets the element data 'count' back to the Initial Value.
// These classes are used by dynamic action element configurations.
import com.audium.server.AudiumException;
import com.audium.server.proxy.ActionConfigInterface;
import com.audium.server.session.ActionAPI;
import com.audium.server.xml.ActionElementConfig;

/**
 * This class would be called if the action element Counter needs to be set back to its initital value
 */
public class JaninesDynamicCounterConfig implements ActionConfigInterface

    public ActionElementConfig getConfig(String name,
                                         ActionAPI actionAPI,
                                         ActionElementConfig defaults) throws AudiumException
    {
       
    //look for session data named 'reset' and convert to String
        String reset = actionAPI.getSessionData("reset")+"";
    //if it exists and has the value 'true' the set the element data 'count' to the value
    //of the Setting named 'initial' (which is usually 0)
        if(reset.equalsIgnoreCase("true")){
            int initial = defaults.getIntSettingValue("initial",actionAPI);
            actionAPI.setElementData("count",initial+"");
            //set the Session data named 'reset' to false.
            actionAPI.setSessionData("reset","false");
        }   
        // Alter defaults or create a new configuration and return.
        return defaults;
    }
}
This document was generated from CDN thread

Created by: Scope Future on 16-04-2013 08:38:00 AM
Hi All,
Did anyone use the Dynamic Configuration for the counter element if so, can anyone share a sample code.
 
CreatePlease to create content
Content for Community-Ad
FusionCharts will render here