org.apache.chemistry.opencmis.commons.data.PropertyId Java Examples
The following examples show how to use
org.apache.chemistry.opencmis.commons.data.PropertyId.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 6 votes |
/** * Returns the first value of an string property. */ private static String getStringProperty(Properties properties, String name) { PropertyData<?> property = properties.getProperties().get(name); if (property == null) { return null; } if (property instanceof PropertyId) { return ((PropertyId) property).getFirstValue(); } if (!(property instanceof PropertyString)) { return null; } return ((PropertyString) property).getFirstValue(); }
Example #2
Source File: CMISConnector.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Returns the value of the given property if it exists and is of the * correct type. */ public String getIdProperty(Properties properties, String propertyId) { if ((properties == null) || (properties.getProperties() == null)) { return null; } PropertyData<?> property = properties.getProperties().get(propertyId); if (!(property instanceof PropertyId)) { return null; } return ((PropertyId) property).getFirstValue(); }
Example #3
Source File: LDRepository.java From document-management-software with GNU Lesser General Public License v3.0 | 5 votes |
/** * Gets the type id from a set of properties. */ private static String getTypeId(Properties properties) { PropertyData<?> typeProperty = properties.getProperties().get(PropertyIds.OBJECT_TYPE_ID); if (!(typeProperty instanceof PropertyId)) { throw new CmisInvalidArgumentException("Type id must be set!"); } String typeId = ((PropertyId) typeProperty).getFirstValue(); if (typeId == null) { throw new CmisInvalidArgumentException("Type id must be set!"); } return typeId; }
Example #4
Source File: Converter.java From document-management-software with GNU Lesser General Public License v3.0 | 4 votes |
/** * Converts a property object * * @param property the property * * @return the conversion */ public static CmisProperty convert(PropertyData<?> property) { if (property == null) { return null; } CmisProperty result = null; if (property instanceof PropertyString) { result = new CmisPropertyString(); ((CmisPropertyString) result).getValue().addAll(((PropertyString) property).getValues()); } else if (property instanceof PropertyId) { result = new CmisPropertyId(); ((CmisPropertyId) result).getValue().addAll(((PropertyId) property).getValues()); } else if (property instanceof PropertyInteger) { result = new CmisPropertyInteger(); ((CmisPropertyInteger) result).getValue().addAll(((PropertyInteger) property).getValues()); } else if (property instanceof PropertyDecimal) { result = new CmisPropertyDecimal(); ((CmisPropertyDecimal) result).getValue().addAll(((PropertyDecimal) property).getValues()); } else if (property instanceof PropertyBoolean) { result = new CmisPropertyBoolean(); ((CmisPropertyBoolean) result).getValue().addAll(((PropertyBoolean) property).getValues()); } else if (property instanceof PropertyDateTime) { result = new CmisPropertyDateTime(); ((CmisPropertyDateTime) result).getValue() .addAll(convertCalendar(((PropertyDateTime) property).getValues())); } else if (property instanceof PropertyHtml) { result = new CmisPropertyHtml(); ((CmisPropertyHtml) result).getValue().addAll(((PropertyHtml) property).getValues()); } else if (property instanceof PropertyUri) { result = new CmisPropertyUri(); ((CmisPropertyUri) result).getValue().addAll(((PropertyUri) property).getValues()); } else { return null; } result.setPropertyDefinitionId(property.getId()); result.setLocalName(property.getLocalName()); result.setQueryName(property.getQueryName()); result.setDisplayName(property.getDisplayName()); return result; }