Java Code Examples for org.apache.chemistry.opencmis.commons.data.PropertyData#getFirstValue()
The following examples show how to use
org.apache.chemistry.opencmis.commons.data.PropertyData#getFirstValue() .
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: ConformanceCmisServiceWrapper.java From alfresco-repository with GNU Lesser General Public License v3.0 | 6 votes |
/** * Throws an exception if the given property isn't set or of the wrong type. */ protected void checkProperty(Properties properties, String propertyId, Class<?> clazz) { if (properties.getProperties() == null) { throw new CmisInvalidArgumentException("Property " + propertyId + " must be set!"); } PropertyData<?> property = properties.getProperties().get(propertyId); if (property == null) { throw new CmisInvalidArgumentException("Property " + propertyId + " must be set!"); } Object value = property.getFirstValue(); if (value == null) { throw new CmisInvalidArgumentException("Property " + propertyId + " must have a value!"); } if (!clazz.isAssignableFrom(value.getClass())) { throw new CmisInvalidArgumentException("Property " + propertyId + " has the wrong type!"); } }
Example 2
Source File: Node.java From alfresco-remote-api with GNU Lesser General Public License v3.0 | 4 votes |
protected Object getValue(Map<String, PropertyData<?>> props, String name) { PropertyData<?> prop = props.get(name); Object value = (prop != null ? prop.getFirstValue() : null); return value; }