@Override public <T> List<T> getPropertyMultivalueByQueryName(String queryName) { PropertyData<T> property = getPropertyByQueryName(queryName); if (property == null) { return null; } return property.getValues(); }
@Override public <T> List<T> getPropertyMultivalueById(String id) { PropertyData<T> property = getPropertyById(id); if (property == null) { return null; } return property.getValues(); }
@Override public <T> List<T> getPropertyMultivalueByQueryName(String queryName) { PropertyData<T> property = getPropertyByQueryName(queryName); if (property == null) { return null; } return property.getValues(); }
@Override public <T> List<T> getPropertyMultivalueById(String id) { PropertyData<T> property = getPropertyById(id); if (property == null) { return null; } return property.getValues(); }
public void validate(PropertyDefinition<T> propDef, PropertyData<T> prop) { // check general constraints for all property types if (propDef.getCardinality() == Cardinality.SINGLE) { if (prop.getValues() != null && prop.getValues().size() > 1) { throw new CmisConstraintException("The property with id " + propDef.getId() + " is single valued, but multiple values are passed " + prop.getValues()); } } if (isNotEmpty(propDef.getChoices())) { validateChoices(propDef, prop); } }
if (entry.getValue().getValues().size() > 1) { if (entry.getValue().getFirstValue() instanceof GregorianCalendar) { for (Object obj : entry.getValue().getValues()) { GregorianCalendar cal = (GregorianCalendar) obj; valueStr.append(df.format(cal.getTime())).append(", "); valueStr = new StringBuilder(entry.getValue().getValues().toString());
public void addPropertiesParameters(Properties properties, DateTimeFormat dateTimeFormat) { if (properties == null) { return; } int idx = 0; for (PropertyData<?> prop : properties.getPropertyList()) { if (prop == null) { continue; } String idxStr = "[" + idx + "]"; addParameter(Constants.CONTROL_PROP_ID + idxStr, prop.getId()); if (isNotEmpty(prop.getValues())) { if (prop.getValues().size() == 1) { addParameter(Constants.CONTROL_PROP_VALUE + idxStr, convertPropertyValue(prop.getFirstValue(), dateTimeFormat)); } else { int vidx = 0; for (Object obj : prop.getValues()) { String vidxStr = "[" + vidx + "]"; addParameter(Constants.CONTROL_PROP_VALUE + idxStr + vidxStr, convertPropertyValue(obj, dateTimeFormat)); vidx++; } } } idx++; } }
public void addPropertiesParameters(Properties properties, DateTimeFormat dateTimeFormat) { if (properties == null) { return; } int idx = 0; for (PropertyData<?> prop : properties.getPropertyList()) { if (prop == null) { continue; } String idxStr = "[" + idx + "]"; addParameter(Constants.CONTROL_PROP_ID + idxStr, prop.getId()); if (isNotEmpty(prop.getValues())) { if (prop.getValues().size() == 1) { addParameter(Constants.CONTROL_PROP_VALUE + idxStr, convertPropertyValue(prop.getFirstValue(), dateTimeFormat)); } else { int vidx = 0; for (Object obj : prop.getValues()) { String vidxStr = "[" + vidx + "]"; addParameter(Constants.CONTROL_PROP_VALUE + idxStr + vidxStr, convertPropertyValue(obj, dateTimeFormat)); vidx++; } } } idx++; } }
List<?> actualValues = prop.getValues(); for (Choice<?> allowedValue : propDef.getChoices()) { if (allowedValue.getValue().size() == actualValues.size()) { for (Object actualValue : prop.getValues()) { if (!allowedValues.contains(actualValue)) { isAllowedValue = false; + " has a fixed set of values. Value(s) " + prop.getValues() + " are not listed.");
@Override public TypeDefinition getTypeDefinitionForObject(String objectId) { TypeDefinition type = objectToTypeDefinitions.get(objectId); if (type == null) { ObjectData obj = service.getObject(repositoryId, objectId, "cmis:objectId,cmis:objectTypeId,cmis:baseTypeId,cmis:secondaryObjectTypeIds", false, IncludeRelationships.NONE, "cmis:none", false, false, null); if (obj != null && obj.getProperties() != null) { PropertyData<?> typeProp = obj.getProperties().getProperties().get(PropertyIds.OBJECT_TYPE_ID); if (typeProp instanceof PropertyId) { String typeId = ((PropertyId) typeProp).getFirstValue(); if (typeId != null) { type = getTypeDefinition(typeId); } } PropertyData<?> secTypeProp = obj.getProperties().getProperties() .get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS); if ((secTypeProp instanceof PropertyId) && (secTypeProp.getValues() != null)) { for (String secTypeId : ((PropertyId) secTypeProp).getValues()) { if (secTypeId != null) { getTypeDefinition(secTypeId); } } } } objectToTypeDefinitions.put(objectId, type); } return type; }
properties.put(property.getId(), property.getValues());
private void assertChildren(final Pair<FileInfo, FileInfo> folderAndDocument, ObjectInFolderList children) { assertNotNull(children); assertTrue(1 == children.getNumItems().longValue()); PropertyData<?> nameData = children.getObjects().iterator().next().getObject().getProperties().getProperties().get("cmis:name"); assertNotNull(nameData); Object name = nameData.getValues().iterator().next(); assertEquals(folderAndDocument.getSecond().getName(), name); } }, CmisVersion.CMIS_1_0);
@Override public Void execute(CmisService cmisService) { String repositoryId = cmisService.getRepositoryInfos(null).get(0).getId(); ObjectData data = cmisService.getObjectOfLatestVersion(repositoryId, nodeRef.toString(), null, Boolean.FALSE, null, null, null, null, null, null, null); assertNotNull(data); PropertyData<?> prop = data.getProperties().getProperties().get(PropertyIds.VERSION_LABEL); Object versionLabelCmisValue = prop.getValues().get(0); assertEquals(expectedVersionLabel, versionLabelCmisValue); return null; } }, CmisVersion.CMIS_1_1);
properties.put(property.getId(), property.getValues());
Object objectId = od.getProperties().getProperties().get("cmis:objectId").getValues().get(0);
@Override public String execute(CmisService cmisService) { List<RepositoryInfo> repositories = cmisService.getRepositoryInfos(null); assertTrue(repositories.size() > 0); RepositoryInfo repo = repositories.get(0); String repositoryId = repo.getId(); String objectId = cmisService.create(repositoryId, properties, repositoryHelper.getCompanyHome().getId(), contentStream, VersioningState.MINOR, null, null); ObjectData cmidDoc = cmisService.getObject(repositoryId, objectId, null, true, IncludeRelationships.NONE, null, false, false, null); List<PropertyData<?>> properties = cmidDoc.getProperties().getPropertyList(); boolean found = false; PropertyData<?> propIsLatestMajorVersion = null; for (PropertyData<?> property : properties) { if (property.getId().equals(PropertyIds.IS_LATEST_MAJOR_VERSION)) { found = true; propIsLatestMajorVersion = property; break; } } //properties..contains(CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION); assertTrue("The CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION property was not found", found); if (found) { assertFalse("The CMISDictionaryModel.PROP_IS_LATEST_MAJOR_VERSION should be false as minor version was created", (Boolean) propIsLatestMajorVersion.getValues().get(0)); } return objectId; } });
List aspects = propAspects.getValues(); aspects.add("P:sctst:clientRelated"); cmisService.updateProperties(repositoryId, new Holder<String>(contentData.getId()), null, properties, null); aspects = cmisService.getProperties(repositoryId, contentData.getId(), null, null).getProperties().get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues(); assertTrue("P:sctst:clientRelated excpected", aspects.contains("P:sctst:clientRelated"));