Package org.exoplatform.portal.config.model

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


    public void setMatches(Pattern matches) {
        this.matches = matches;
    }

    public DevicePropertyCondition build() {
        DevicePropertyCondition devicePropertyCondition = new DevicePropertyCondition();

        devicePropertyCondition.setPropertyName(propertyName);
        devicePropertyCondition.setEquals(equals);
        devicePropertyCondition.setGreaterThan(greaterThan);
        devicePropertyCondition.setLessThan(lessThan);
        if (matches != null) {
            devicePropertyCondition.setMatches(matches.toString());
        }
        devicePropertyCondition.setStorageName(getStorageName());

        return devicePropertyCondition;
    }
View Full Code Here


    protected DevicePropertyCondition readElement(StaxNavigator<Element> navigator) {
        if (navigator.getName() != Element.DEVICE_PROPERTY) {
            throw unexpectedElement(navigator);
        }

        DevicePropertyCondition condition = new DevicePropertyCondition();

        // property-name
        String propertyName = getRequiredContent(child(navigator, Element.PROPERTY_NAME), true);
        condition.setPropertyName(propertyName);

        // greater-than
        while (navigator.sibling() != null) {
            switch (navigator.getName()) {
                case GREATER_THAN:
                    if (condition.getGreaterThan() != null || condition.getLessThan() != null ||
                            condition.getMatches() != null || condition.getEquals() != null) {
                        throw unexpectedElement(navigator);
                    }
                    condition.setGreaterThan(parseRequiredContent(navigator, FLOAT_VALUE_TYPE));
                    break;
                case LESS_THAN:
                    if (condition.getLessThan() != null || condition.getMatches() != null || condition.getEquals() != null) {
                        throw unexpectedElement(navigator);
                    }
                    condition.setLessThan(parseRequiredContent(navigator, FLOAT_VALUE_TYPE));
                    break;
                case MATCHES:
                    if (condition.getMatches() != null || condition.getEquals() != null) {
                        throw unexpectedElement(navigator);
                    }
                    condition.setMatches(getRequiredContent(navigator, false));
                    break;
                case EQUALS:
                    if (condition.getEquals() != null) {
                        throw unexpectedElement(navigator);
                    }
                    condition.setEquals(getRequiredContent(navigator, false));
                    break;
                case UNKNOWN:
                    throw unknownElement(navigator);
                default:
                    throw unexpectedElement(navigator);
View Full Code Here

        // Since we don't use the DeviceProperties directly but a wrapper, we create it at this point
        this.deviceProperties = new ArrayList<DevicePropertyConditionWrapper>();
        if (editedCondition.getDeviceProperties() != null) {
            for (DevicePropertyCondition prop : editedCondition.getDeviceProperties()) {
                DevicePropertyCondition newProp = new DevicePropertyCondition();
                newProp.setPropertyName(prop.getPropertyName());
                newProp.setEquals(prop.getEquals());
                newProp.setMatches(prop.getMatches());
                newProp.setLessThan(prop.getLessThan());
                newProp.setGreaterThan(prop.getGreaterThan());
                this.deviceProperties.add(new DevicePropertyConditionWrapper(newProp));
            }
        }
    }
View Full Code Here

    public void addProperty() {
        if (editedCondition.getDeviceProperties() == null) {
            editedCondition.setDeviceProperties(new ArrayList<DevicePropertyCondition>());
        }

        DevicePropertyCondition dpc = new DevicePropertyCondition();
        // FIXME: Workaround for GTNPORTAL-3073, remove when not needed
        dpc.setEquals(null);
        dpc.setGreaterThan(null);
        dpc.setLessThan(null);
        dpc.setMatches(null);
        deviceProperties.add(new DevicePropertyConditionWrapper(dpc));
    }
View Full Code Here

TOP

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

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.