Package org.apache.chemistry.opencmis.commons.impl.dataobjects

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerImpl


            BigInteger value) {
        if (!checkAddProperty(props, typeId, filter, id)) {
            return;
        }

        props.addProperty(new PropertyIntegerImpl(id, value));
    }
View Full Code Here


                break;
            case ID:
                props.addProperty(new PropertyIdImpl(propDef.getId(), (List<String>) defaultValue));
                break;
            case INTEGER:
                props.addProperty(new PropertyIntegerImpl(propDef.getId(), (List<BigInteger>) defaultValue));
                break;
            case STRING:
                props.addProperty(new PropertyStringImpl(propDef.getId(), (List<String>) defaultValue));
                break;
            case URI:
View Full Code Here

                        }
                        ((PropertyBooleanImpl) property).setValues(propertyValues);
                    }
                    break;
                case INTEGER:
                    property = new PropertyIntegerImpl();
                    {
                        List<BigInteger> propertyValues = null;
                        if (values != null) {
                            propertyValues = new ArrayList<BigInteger>();
                            for (Object obj : values) {
View Full Code Here

                        }
                        ((PropertyBooleanImpl) property).setValues(propertyValues);
                    }
                    break;
                case INTEGER:
                    property = new PropertyIntegerImpl();
                    {
                        List<BigInteger> propertyValues = null;
                        if (values != null) {
                            propertyValues = new ArrayList<BigInteger>();
                            for (Object obj : values) {
                                if (obj instanceof BigInteger) {
                                    propertyValues.add((BigInteger) obj);
                                } else {
                                    throw new CmisRuntimeException("Invalid property value: " + obj);
                                }
                            }
                        }
                        ((PropertyIntegerImpl) property).setValues(propertyValues);
                    }
                    break;
                case DECIMAL:
                    property = new PropertyDecimalImpl();
                    {
                        List<BigDecimal> propertyValues = null;
                        if (values != null) {
                            propertyValues = new ArrayList<BigDecimal>();
                            for (Object obj : values) {
                                if (obj instanceof BigDecimal) {
                                    propertyValues.add((BigDecimal) obj);
                                } else if (obj instanceof BigInteger) {
                                    propertyValues.add(new BigDecimal((BigInteger) obj));
                                } else {
                                    throw new CmisRuntimeException("Invalid property value: " + obj);
                                }
                            }
                        }
                        ((PropertyDecimalImpl) property).setValues(propertyValues);
                    }
                    break;
                case DATETIME:
                    property = new PropertyDateTimeImpl();
                    {
                        List<GregorianCalendar> propertyValues = null;
                        if (values != null) {
                            propertyValues = new ArrayList<GregorianCalendar>();
                            for (Object obj : values) {
                                if (obj instanceof Number) {
                                    GregorianCalendar cal = new GregorianCalendar(TimeZone.getTimeZone("UTC"));
                                    cal.setTimeInMillis(((Number) obj).longValue());
                                    propertyValues.add(cal);
                                } else {
                                    throw new CmisRuntimeException("Invalid property value: " + obj);
                                }
                            }
                        }
                        ((PropertyDateTimeImpl) property).setValues(propertyValues);
                    }
                    break;
                case HTML:
                    property = new PropertyHtmlImpl();
                    {
                        List<String> propertyValues = null;
                        if (values != null) {
                            propertyValues = new ArrayList<String>();
                            for (Object obj : values) {
                                if (obj instanceof String) {
                                    propertyValues.add(obj.toString());
                                } else {
                                    throw new CmisRuntimeException("Invalid property value: " + obj);
                                }
                            }
                        }
                        ((PropertyHtmlImpl) property).setValues(propertyValues);
                    }
                    break;
                case URI:
                    property = new PropertyUriImpl();
                    {
                        List<String> propertyValues = null;
                        if (values != null) {
                            propertyValues = new ArrayList<String>();
                            for (Object obj : values) {
                                if (obj instanceof String) {
                                    propertyValues.add(obj.toString());
                                } else {
                                    throw new CmisRuntimeException("Invalid property value: " + obj);
                                }
                            }
                        }
                        ((PropertyUriImpl) property).setValues(propertyValues);
                    }
                    break;
                }

                property.setId(id);
                property.setDisplayName(propDef.getDisplayName());
                property.setQueryName(propDef.getQueryName());
                property.setLocalName(propDef.getLocalName());
            } else {
                // this else block should only be reached in rare circumstances
                // it may return incorrect types

                if (values == null) {
                    property = new PropertyStringImpl();
                    ((PropertyStringImpl) property).setValues(null);
                } else {
                    Object firstValue = values.get(0);
                    if (firstValue instanceof Boolean) {
                        property = new PropertyBooleanImpl();
                        List<Boolean> propertyValues = new ArrayList<Boolean>();
                        for (Object obj : values) {
                            if (obj instanceof Boolean) {
                                propertyValues.add((Boolean) obj);
                            } else {
                                throw new CmisRuntimeException("Invalid property value: " + obj);
                            }
                        }
                        ((PropertyBooleanImpl) property).setValues(propertyValues);
                    } else if (firstValue instanceof BigInteger) {
                        property = new PropertyIntegerImpl();
                        List<BigInteger> propertyValues = new ArrayList<BigInteger>();
                        for (Object obj : values) {
                            if (obj instanceof BigInteger) {
                                propertyValues.add((BigInteger) obj);
                            } else {
View Full Code Here

            }
        } else if (source instanceof PropertyIntegerDefinition) {
            PropertyIntegerDefinition def = (PropertyIntegerDefinition) source;

            if (def.getDefaultValue() != null) {
                writeProperty(writer, new PropertyIntegerImpl(null, def.getDefaultValue()), true);
            }

            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MAX_VALUE, def.getMaxValue());
            XMLUtils.write(writer, PREFIX_CMIS, NAMESPACE_CMIS, TAG_PROPERTY_TYPE_MIN_VALUE, def.getMinValue());
        } else if (source instanceof PropertyBooleanDefinition) {
View Full Code Here

                case BOOLEAN:
                    property = new PropertyBooleanImpl();
                    ((PropertyBooleanImpl) property).setValues(copyBooleanValues(values));
                    break;
                case INTEGER:
                    property = new PropertyIntegerImpl();
                    ((PropertyIntegerImpl) property).setValues(copyIntegerValues(values));
                    break;
                case DECIMAL:
                    property = new PropertyDecimalImpl();
                    ((PropertyDecimalImpl) property).setValues(copyDecimalValues(values));
View Full Code Here

                case BOOLEAN:
                    property = new PropertyBooleanImpl();
                    ((PropertyBooleanImpl) property).setValues(copyBooleanValues(values));
                    break;
                case INTEGER:
                    property = new PropertyIntegerImpl();
                    ((PropertyIntegerImpl) property).setValues(copyIntegerValues(values));
                    break;
                case DECIMAL:
                    property = new PropertyDecimalImpl();
                    ((PropertyDecimalImpl) property).setValues(copyDecimalValues(values));
                    break;
                case DATETIME:
                    property = new PropertyDateTimeImpl();
                    ((PropertyDateTimeImpl) property).setValues(copyDateTimeValues(values));
                    break;
                case HTML:
                    property = new PropertyHtmlImpl();
                    ((PropertyHtmlImpl) property).setValues(copyStringValues(values));
                    break;
                case URI:
                    property = new PropertyUriImpl();
                    ((PropertyUriImpl) property).setValues(copyStringValues(values));
                    break;
                default:
                    throw new CmisRuntimeException("Unknown property type!");
                }

                property.setId(id);
                property.setDisplayName(propDef.getDisplayName());
                property.setQueryName(propDef.getQueryName());
                property.setLocalName(propDef.getLocalName());
            } else {
                // this else block should only be reached in rare circumstances
                // it may return incorrect types

                if (values == null) {
                    property = new PropertyStringImpl();
                    ((PropertyStringImpl) property).setValues(null);
                } else {
                    Object firstValue = values.get(0);
                    if (firstValue instanceof Boolean) {
                        property = new PropertyBooleanImpl();
                        ((PropertyBooleanImpl) property).setValues(copyBooleanValues(values));
                    } else if (firstValue instanceof BigInteger) {
                        property = new PropertyIntegerImpl();
                        ((PropertyIntegerImpl) property).setValues(copyIntegerValues(values));
                    } else if (firstValue instanceof BigDecimal) {
                        property = new PropertyDecimalImpl();
                        ((PropertyDecimalImpl) property).setValues(copyDecimalValues(values));
                    } else {
View Full Code Here

            result = new PropertyStringImpl(property.getPropertyDefinitionId(),
                    ((CmisPropertyString) property).getValue());
        } else if (property instanceof CmisPropertyId) {
            result = new PropertyIdImpl(property.getPropertyDefinitionId(), ((CmisPropertyId) property).getValue());
        } else if (property instanceof CmisPropertyInteger) {
            result = new PropertyIntegerImpl(property.getPropertyDefinitionId(),
                    ((CmisPropertyInteger) property).getValue());
        } else if (property instanceof CmisPropertyDecimal) {
            result = new PropertyDecimalImpl(property.getPropertyDefinitionId(),
                    ((CmisPropertyDecimal) property).getValue());
        } else if (property instanceof CmisPropertyBoolean) {
View Full Code Here

            result = new PropertyStringImpl(property.getPropertyDefinitionId(),
                    ((CmisPropertyString) property).getValue());
        } else if (property instanceof CmisPropertyId) {
            result = new PropertyIdImpl(property.getPropertyDefinitionId(), ((CmisPropertyId) property).getValue());
        } else if (property instanceof CmisPropertyInteger) {
            result = new PropertyIntegerImpl(property.getPropertyDefinitionId(),
                    ((CmisPropertyInteger) property).getValue());
        } else if (property instanceof CmisPropertyDecimal) {
            result = new PropertyDecimalImpl(property.getPropertyDefinitionId(),
                    ((CmisPropertyDecimal) property).getValue());
        } else if (property instanceof CmisPropertyBoolean) {
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.impl.dataobjects.PropertyIntegerImpl

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.