Package org.broadleafcommerce.common.value

Examples of org.broadleafcommerce.common.value.ValueAssignable


            }
            if (valueType == null) {
                throw new IllegalAccessException("Unable to determine the valueType for the rule field (" + populateValueRequest.getProperty().getName() + ")");
            }
            if (ValueAssignable.class.isAssignableFrom(valueType)) {
                ValueAssignable assignableValue;
                try {
                    assignableValue = (ValueAssignable) populateValueRequest.getFieldManager().getFieldValue(instance, populateValueRequest.getProperty().getName());
                } catch (FieldNotAvailableException e) {
                    throw new IllegalArgumentException(e);
                }
                String key = populateValueRequest.getProperty().getName().substring(populateValueRequest.getProperty().getName().indexOf(FieldManager.MAPFIELDSEPARATOR) + FieldManager.MAPFIELDSEPARATOR.length(), populateValueRequest.getProperty().getName().length());
                boolean persistValue = false;
                boolean setOnParent = false;
                if (assignableValue == null) {
                    assignableValue = (ValueAssignable) valueType.newInstance();
                    persistValue = true;
                    setOnParent = true;
                    dirty = true;
                } else {
                    dirty = assignableValue.getValue().equals(populateValueRequest.getProperty().getValue());
                    populateValueRequest.getProperty().setOriginalValue(String.valueOf(assignableValue));
                    populateValueRequest.getProperty().setOriginalDisplayValue(String.valueOf(assignableValue));
                }
                assignableValue.setName(key);
                assignableValue.setValue(populateValueRequest.getProperty().getValue());
                String fieldName = populateValueRequest.getProperty().getName().substring(0, populateValueRequest.getProperty().getName().indexOf(FieldManager.MAPFIELDSEPARATOR));
                Field field = populateValueRequest.getFieldManager().getField(instance.getClass(), fieldName);
                FieldInfo fieldInfo = buildFieldInfo(field);
                String manyToField = null;
                if (populateValueRequest.getMetadata().getManyToField() != null) {
View Full Code Here


    }

    @Override
    public FieldProviderResponse extractValue(ExtractValueRequest extractValueRequest, Property property) throws PersistenceException {
        if (extractValueRequest.getRequestedValue() != null && extractValueRequest.getRequestedValue() instanceof ValueAssignable) {
            ValueAssignable assignableValue = (ValueAssignable) extractValueRequest.getRequestedValue();
            String val = (String) assignableValue.getValue();
            property.setValue(val);
            property.setDisplayValue(extractValueRequest.getDisplayVal());
        } else {
            if (FieldProviderResponse.NOT_HANDLED==super.extractValue(extractValueRequest, property)) {
                return FieldProviderResponse.NOT_HANDLED;
View Full Code Here

TOP

Related Classes of org.broadleafcommerce.common.value.ValueAssignable

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.