Examples of RuntimeConfigProperty


Examples of org.apache.roller.planet.pojos.RuntimeConfigProperty

    public String save() {
       
        try {
            // only set values for properties that are already defined
            String propName = null;
            RuntimeConfigProperty updProp = null;
            String incomingProp = null;
            Iterator propsIT = getProperties().keySet().iterator();
            while(propsIT.hasNext()) {
                propName = (String) propsIT.next();
               
                log.debug("Checking property ["+propName+"]");
               
                updProp = (RuntimeConfigProperty) getProperties().get(propName);
                String[] propValues = (String[]) getParameters().get(updProp.getName());
                if(propValues != null && propValues.length > 0) {
                    // we don't deal with multi-valued props
                    incomingProp = propValues[0];
                }
               
                // some special treatment for booleans
                // this is a bit hacky since we are assuming that any prop
                // with a value of "true" or "false" is meant to be a boolean
                // it may not always be the case, but we should be okay for now
                if( updProp.getValue() != null // null check needed w/Oracle
                        && (updProp.getValue().equals("true") || updProp.getValue().equals("false"))) {
                   
                    if(incomingProp == null || !incomingProp.equals("on"))
                        incomingProp = "false";
                    else
                        incomingProp = "true";
                }
               
                // only work on props that were submitted with the request
                if(incomingProp != null) {
                    log.debug("Setting new value for ["+propName+"]");
                   
                    updProp.setValue(incomingProp.trim());
                }
            }
           
            // save it
            PropertiesManager pMgr = PlanetFactory.getPlanet().getPropertiesManager();
View Full Code Here

Examples of org.apache.roller.planet.pojos.RuntimeConfigProperty

        log.debug("Handling update request");
       
        try {
            // only set values for properties that are already defined
            String propName = null;
            RuntimeConfigProperty updProp = null;
            String incomingProp = null;
            Iterator propsIT = this.properties.keySet().iterator();
            while(propsIT.hasNext()) {
                propName = (String) propsIT.next();
               
                log.debug("Checking property ["+propName+"]");
               
                updProp = (RuntimeConfigProperty) this.properties.get(propName);
                String[] propValues = (String[]) this.parameters.get(updProp.getName());
                if(propValues != null && propValues.length > 0) {
                    // we don't deal with multi-valued props
                    incomingProp = propValues[0];
                }
               
                // some special treatment for booleans
                // this is a bit hacky since we are assuming that any prop
                // with a value of "true" or "false" is meant to be a boolean
                // it may not always be the case, but we should be okay for now
                if( updProp.getValue() != null // null check needed w/Oracle
                        && (updProp.getValue().equals("true") || updProp.getValue().equals("false"))) {
                   
                    if(incomingProp == null || !incomingProp.equals("on"))
                        incomingProp = "false";
                    else
                        incomingProp = "true";
                }
               
                // only work on props that were submitted with the request
                if(incomingProp != null) {
                    log.debug("Setting new value for ["+propName+"]");
                   
                    updProp.setValue(incomingProp.trim());
                }
            }
           
            // save it
            PropertiesManager pMgr = PlanetFactory.getPlanet().getPropertiesManager();
View Full Code Here

Examples of org.apache.roller.planet.pojos.RuntimeConfigProperty

       
        // remember, the properties table is initialized during Roller startup
        PropertiesManager mgr = PlanetFactory.getPlanet().getPropertiesManager();
        TestUtils.endSession(true);
       
        RuntimeConfigProperty prop = null;
       
        // get a property by name
        prop = mgr.getProperty("site.name");
        assertNotNull(prop);
       
        // update a property
        prop.setValue("testtest");
        mgr.saveProperty(prop);
        TestUtils.endSession(true);
       
        // make sure property was updated
        prop = null;
        prop = mgr.getProperty("site.name");
        assertNotNull(prop);
        assertEquals("testtest", prop.getValue());
       
        // get all properties
        Map props = mgr.getProperties();
        assertNotNull(props);
        assertTrue(props.containsKey("site.name"));
       
        // update multiple properties
        prop = (RuntimeConfigProperty) props.get("site.name");
        prop.setValue("foofoo");
        prop = (RuntimeConfigProperty) props.get("site.description");
        prop.setValue("blahblah");
        mgr.saveProperties(props);
        TestUtils.endSession(true);
       
        // make sure all properties were updated
        props = mgr.getProperties();
View Full Code Here

Examples of org.apache.roller.planet.pojos.RuntimeConfigProperty

         * for convenience sake we are going to put the list of props
         * into a map for users to access it.  The value element of the
         * hash still needs to be the RuntimeConfigProperty object so that
         * we can save the elements again after they have been updated
         */
        RuntimeConfigProperty prop = null;
        Iterator it = list.iterator();
        while(it.hasNext()) {
            prop = (RuntimeConfigProperty) it.next();
            props.put(prop.getName(), prop);
        }
       
        return props;
    }
View Full Code Here

Examples of org.apache.roller.planet.pojos.RuntimeConfigProperty

                while(propdefs.hasNext()) {
                    propDef = (PropertyDef) propdefs.next();
                   
                    // do we already have this prop?  if not then add it
                    if(!props.containsKey(propDef.getName())) {
                        RuntimeConfigProperty newprop =
                                new RuntimeConfigProperty(propDef.getName(), propDef.getDefaultValue());
                       
                        props.put(propDef.getName(), newprop);
                       
                        log.info("Found uninitialized property "+propDef.getName()+
                                " ... setting value to ["+propDef.getDefaultValue()+"]");
View Full Code Here

Examples of org.apache.roller.planet.pojos.RuntimeConfigProperty

    public String save() {
       
        try {
            // only set values for properties that are already defined
            String propName = null;
            RuntimeConfigProperty updProp = null;
            String incomingProp = null;
            Iterator propsIT = getProperties().keySet().iterator();
            while(propsIT.hasNext()) {
                propName = (String) propsIT.next();
               
                log.debug("Checking property ["+propName+"]");
               
                updProp = (RuntimeConfigProperty) getProperties().get(propName);
                String[] propValues = (String[]) getParameters().get(updProp.getName());
                if(propValues != null && propValues.length > 0) {
                    // we don't deal with multi-valued props
                    incomingProp = propValues[0];
                }
               
                // some special treatment for booleans
                // this is a bit hacky since we are assuming that any prop
                // with a value of "true" or "false" is meant to be a boolean
                // it may not always be the case, but we should be okay for now
                if( updProp.getValue() != null // null check needed w/Oracle
                        && (updProp.getValue().equals("true") || updProp.getValue().equals("false"))) {
                   
                    if(incomingProp == null || !incomingProp.equals("on"))
                        incomingProp = "false";
                    else
                        incomingProp = "true";
                }
               
                // only work on props that were submitted with the request
                if(incomingProp != null) {
                    log.debug("Setting new value for ["+propName+"]");
                   
                    updProp.setValue(incomingProp.trim());
                }
            }
           
            // save it
            PropertiesManager pMgr = PlanetFactory.getPlanet().getPropertiesManager();
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.RuntimeConfigProperty

     */
    public String save() {
       
        // only set values for properties that are already defined
        String propName = null;
        RuntimeConfigProperty updProp = null;
        String incomingProp = null;
        Iterator propsIT = getProperties().keySet().iterator();
        while(propsIT.hasNext()) {
            propName = (String) propsIT.next();
            updProp = (RuntimeConfigProperty) getProperties().get(propName);
            incomingProp = this.getParameter(updProp.getName());
           
            log.debug("Checking property ["+propName+"]");
            log.debug("Request value is ["+incomingProp+"]");
           
            // some special treatment for booleans
            // this is a bit hacky since we are assuming that any prop
            // with a value of "true" or "false" is meant to be a boolean
            // it may not always be the case, but we should be okay for now
            if( updProp.getValue() != null // null check needed w/Oracle
                    && (updProp.getValue().equals("true") || updProp.getValue().equals("false"))) {
               
                if(incomingProp == null || !incomingProp.equals("on"))
                    incomingProp = "false";
                else
                    incomingProp = "true";
            }
           
            // only work on props that were submitted with the request
            if(incomingProp != null) {
                log.debug("Setting new value for ["+propName+"]");
               
                // NOTE: the old way had some locale sensitive way to do this??
                updProp.setValue(incomingProp.trim());
            }
        }
       
        // special handling for comment plugins
        String enabledPlugins = "";
        if(getCommentPlugins().length > 0) {
            enabledPlugins = StringUtils.join(getCommentPlugins(), ",");
        }
        RuntimeConfigProperty prop =
                    (RuntimeConfigProperty) getProperties().get("users.comments.plugins");
        prop.setValue(enabledPlugins);
           
        try {
            // save 'em and flush
            PropertiesManager mgr = WebloggerFactory.getWeblogger().getPropertiesManager();
            mgr.saveProperties(getProperties());
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.RuntimeConfigProperty

            testWeblog = TestUtils.setupWeblog("referTestWeblog1", testUser);
            testWeblog2 = TestUtils.setupWeblog("referTestWeblog2", testUser);
           
            // add "spamtest" to refererSpamWords
            PropertiesManager pmgr = WebloggerFactory.getWeblogger().getPropertiesManager();
            RuntimeConfigProperty spamprop = pmgr.getProperty("spam.blacklist");
            this.origSpamWords = spamprop.getValue();
            spamprop.setValue(spamprop.getValue() + ", spamtest");
            pmgr.saveProperty(spamprop);
           
            // add a number of referers to play with
            RefererManager rmgr = WebloggerFactory.getWeblogger().getRefererManager();
            Calendar lCalendar = Calendar.getInstance();
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.RuntimeConfigProperty

    public void tearDown() throws Exception {
       
        try {
            // reset refererSpamWords to original value
            PropertiesManager pmgr = WebloggerFactory.getWeblogger().getPropertiesManager();
            RuntimeConfigProperty spamprop = pmgr.getProperty("spam.blacklist");
            spamprop.setValue(this.origSpamWords);
            pmgr.saveProperty(spamprop);
           
            TestUtils.teardownWeblog(testWeblog.getId());
            TestUtils.teardownWeblog(testWeblog2.getId());
            TestUtils.teardownUser(testUser.getId());
View Full Code Here

Examples of org.apache.roller.weblogger.pojos.RuntimeConfigProperty

        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        List refs = rmgr.getReferers(testWeblog);
        assertEquals(count, refs.size());
       
        PropertiesManager pmgr = WebloggerFactory.getWeblogger().getPropertiesManager();
        RuntimeConfigProperty spamprop = pmgr.getProperty("spam.blacklist");
        String origWords = spamprop.getValue();
        spamprop.setValue(spamprop.getValue() + ", test");
        pmgr.saveProperty(spamprop);
        TestUtils.endSession(true);
       
        rmgr.applyRefererFilters();
        TestUtils.endSession(true);
       
        testWeblog = TestUtils.getManagedWebsite(testWeblog);
        refs = rmgr.getReferers(testWeblog);
        assertEquals(0, refs.size());
       
        spamprop = pmgr.getProperty("spam.blacklist");
        spamprop.setValue(origWords);
        pmgr.saveProperty(spamprop);
        TestUtils.endSession(true);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.