Package org.exoplatform.portal.config.model

Examples of org.exoplatform.portal.config.model.RedirectCondition


        }
        return devicePropertyConditionData;
    }

    public RedirectCondition build() {
        RedirectCondition redirectCondition = new RedirectCondition();
        redirectCondition.setName(redirectName);
        redirectCondition.setStorageName(getStorageName());

        if (devicePropertyConditionData != null) {
            ArrayList<DevicePropertyCondition> devicePropertyConditions = new ArrayList<DevicePropertyCondition>();
            for (RedirectDevicePropertyConditionData conditionData : devicePropertyConditionData) {
                devicePropertyConditions.add(conditionData.build());
            }
            redirectCondition.setDeviceProperties(devicePropertyConditions);
        }

        if (userAgentConditionData != null) {
            redirectCondition.setUserAgentConditions(userAgentConditionData.build());
        }
        return redirectCondition;
    }
View Full Code Here


    protected RedirectCondition readElement(StaxNavigator<Element> navigator) {
        if (navigator.getName() != Element.CONDITION) {
            throw expectedElement(navigator, Element.CONDITION);
        }

        RedirectCondition condition = new RedirectCondition();
        Element element = navigator.child();
        if (element != Element.NAME) {
            throw expectedElement(navigator, Element.NAME);
        }
        condition.setName(getRequiredContent(navigator, true));

        boolean userAgent = false;
        boolean deviceProperties = false;
        while (navigator.sibling() != null) {
            switch (navigator.getName()) {
                case USER_AGENT:
                    if (userAgent || deviceProperties) {
                        throw unexpectedElement(navigator);
                    }
                    userAgent = true;
                    condition.setUserAgentConditions(userAgentXmlHandler.read(navigator.fork()));
                    break;
                case DEVICE_PROPERTIES:
                    if (deviceProperties) {
                        throw unexpectedElement(navigator);
                    }
                    deviceProperties = true;
                    condition.setDeviceProperties((ArrayList<DevicePropertyCondition>) devicePropertyXmlHandler.read(navigator.fork()));
                    break;
                case UNKNOWN:
                    throw unknownElement(navigator);
                default:
                    throw unexpectedElement(navigator);
View Full Code Here

     * Removes a Redirect Condition entry from the edited redirect.
     *
     * @param index the index of the entry to remove
     */
    public void removeCondition(Integer index) {
        RedirectCondition rc = pr.getConditions().remove((int) index);
    }
View Full Code Here

     * etc.
     *
     * @return
     */
    private RedirectCondition createNewCondition() {
        RedirectCondition newRC = new RedirectCondition();
        newRC.setName(this.siteName + "_" + redirectName +"_condition" + (pr.getConditions().size()+1));
        newRC.setDeviceProperties(new ArrayList<DevicePropertyCondition>());
        UserAgentConditions newUAC = new UserAgentConditions();
        ArrayList<String> emptyContains = new ArrayList<String>();
        emptyContains.add("");
        newUAC.setContains(emptyContains);
        ArrayList<String> emptyDoesNotContain = new ArrayList<String>();
        emptyDoesNotContain.add("");
        newUAC.setDoesNotContain(emptyDoesNotContain);
        newRC.setUserAgentConditions(newUAC);
        deviceProperties = new ArrayList<DevicePropertyConditionWrapper>();

        return newRC;
    }
View Full Code Here

TOP

Related Classes of org.exoplatform.portal.config.model.RedirectCondition

Copyright © 2018 www.massapicom. 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.