Java Code Examples for org.apache.chemistry.opencmis.commons.data.PropertyString
The following examples show how to use
org.apache.chemistry.opencmis.commons.data.PropertyString. These examples are extracted from open source projects.
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 Project: document-management-software Source File: LDRepository.java License: 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 Project: alfresco-repository Source File: CMISConnector.java License: 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 getStringProperty(Properties properties, String propertyId) { if ((properties == null) || (properties.getProperties() == null)) { return null; } PropertyData<?> property = properties.getProperties().get(propertyId); if (!(property instanceof PropertyString)) { return null; } return ((PropertyString) property).getFirstValue(); }
Example 3
Source Project: document-management-software Source File: Converter.java License: 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; }