/** * Copy constructor. */ public PropertyImpl(Property<T> property) { if (property == null) { throw new IllegalArgumentException("Source must be set!"); } propertyDefinition = property.getDefinition(); initialize(property.getDefinition()); setValues(new ArrayList<T>(property.getValues())); }
public static void printProperty(Property<?> prop, PrintStream out) { out.println(prop.getId() + ": " + prop.getValuesAsString()); } }
@Override @SuppressWarnings("unchecked") public <T> T getPropertyValue(String id) { Property<T> property = getProperty(id); if (property == null) { return null; } // explicit cast needed by the Sun compiler return (T) property.getValue(); }
if (!id.equals(p.getId())) { throw new IllegalArgumentException("Property id mismatch: '" + id + "' != '" + p.getId() + "'!"); value = (p.getDefinition().getCardinality() == Cardinality.SINGLE ? p.getFirstValue() : p.getValues());
addResult(results, assertStringNotEmpty(property.getId(), null, f)); addResult(results, assertNotNull(property.getDisplayName(), null, f)); addResult(results, assertNotNull(property.getQueryName(), null, f)); addResult(results, assertNotNull(property.getLocalName(), null, f)); addResult(results, assertListNotEmpty(property.getValues(), null, f)); } else if (propertyCheck == PropertyCheckEnum.STRING_SHOULD_NOT_BE_EMPTY) { f = createResult(WARNING, "Property has no value!"); addResult(results, assertListNotEmpty(property.getValues(), null, f)); } else if (propertyCheck == PropertyCheckEnum.MUST_NOT_BE_SET) { f = createResult(FAILURE, "Property has a value!"); addResult(results, assertIsTrue(property.getValues().isEmpty(), null, f)); boolean isString = ((property.getDefinition().getPropertyType() == PropertyType.STRING) || (property.getDefinition().getPropertyType() == PropertyType.ID) || (property.getDefinition().getPropertyType() == PropertyType.URI) || (property.getDefinition().getPropertyType() == PropertyType.HTML)); for (Object value : property.getValues()) { if (value == null) { addResult(results, createResult(FAILURE, "Property values contain a null value!")); if (property.getDefinition().getCardinality() == Cardinality.SINGLE) { f = createResult(FAILURE, "Property cardinality is SINGLE but property has more than one value!"); addResult(results, assertIsTrue(property.getValues().size() <= 1, null, f)); if (property.getDefinition().isRequired() == null) {
if (prop.getDefinition().getUpdatability() == Updatability.READWRITE || prop.getDefinition().getUpdatability() == Updatability.ONCREATE) { newProperties.put(prop.getId(), prop.getValue());
} else if (typeId instanceof Property<?>) Object propValue = ((Property<?>) typeId).getFirstValue(); typeIdStr = (propValue == null ? null : propValue.toString());
if (!properties.contains(prop.getDefinition().getQueryName())) { addResult(createResult(CmisTestResultStatus.WARNING, "getObject() delivered the property '" + prop.getId() + "', although it has not been requested.")); if (!properties.contains(prop.getDefinition().getQueryName())) { addResult(createResult(CmisTestResultStatus.WARNING, "getChildren() delivered the property '" + prop.getId() + "', although it has not been requested."));
/** * Converts CMIS object's properties to JCR node properties. * * @param object CMIS object * @param writer JCR node representation. */ private void cmisProperties( CmisObject object, DocumentWriter writer ) { // convert properties List<Property<?>> list = object.getProperties(); for (Property<?> property : list) { String pname = properties.findJcrName(property.getId()); if (pname != null) { writer.addProperty(pname, properties.jcrValues(property)); } } }
value = ((Property<?>) value).getValues();
if (!id.equals(p.getId())) { throw new IllegalArgumentException("Property id mismatch: '" + id + "' != '" + p.getId() + "'!"); value = (p.getDefinition().getCardinality() == Cardinality.SINGLE ? p.getFirstValue() : p.getValues());
if (prop.getDefinition().getUpdatability() == Updatability.READWRITE || prop.getDefinition().getUpdatability() == Updatability.ONCREATE) { newProperties.put(prop.getId(), prop.getValue());
Calendar doc1LastModifiedBefore = (Calendar)doc1.getProperty(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue(); assertNotNull(doc1LastModifiedBefore); Calendar doc2LastModifiedBefore = (Calendar)doc2.getProperty(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue(); assertNotNull(doc2LastModifiedBefore); Calendar doc1LastModifiedAfter = (Calendar)doc1.getProperty(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue(); assertNotNull(doc1LastModifiedAfter); Calendar doc2LastModifiedAfter = (Calendar)doc2.getProperty(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue(); assertNotNull(doc2LastModifiedAfter);
secondaryTypeProperties.remove(prop.getId());
if (property.getDefinition().getUpdatability() == Updatability.READWRITE) { writableProperties.put(property.getId(), property.getValue());
/** * Copy constructor. */ public PropertyImpl(Property<T> property) { if (property == null) { throw new IllegalArgumentException("Source must be set!"); } propertyDefinition = property.getDefinition(); initialize(property.getDefinition()); setValues(new ArrayList<T>(property.getValues())); }
if (PropertyIds.PATH.equals(propId) && prop.getFirstValue() != null) { Object path = prop.getFirstValue(); if (path instanceof String) { f = createResult(FAILURE, "Path does not start with '/': " + path); creationDate = (GregorianCalendar) prop.getFirstValue(); lastModificationDate = (GregorianCalendar) prop.getFirstValue();
public static void printProperty(Property<?> prop, PrintStream out) { out.println(prop.getId() + ": " + prop.getValuesAsString()); } }
if (!primaryType.getPropertyDefinitions().containsKey(prop.getId())) { f = createResult(FAILURE, "Property '" + prop.getId() + "' is neither defined by the primary type nor by a secondary type!"); for (SecondaryType secondaryType : secondaryTypes) { if (secondaryType.getPropertyDefinitions() != null && secondaryType.getPropertyDefinitions().containsKey(prop.getId())) { foundProperty = true; break;