/** * Extracts the resource type from a set of CMIS properties.<p> * * @param properties the CMIS properties * @param defaultValue the default value * * @return the resource type property, or the default value if the property was not found */ protected String getResourceTypeFromProperties(Map<String, PropertyData<?>> properties, String defaultValue) { PropertyData<?> typeProp = properties.get(CmsCmisTypeManager.PROPERTY_RESOURCE_TYPE); String resTypeName = defaultValue; if (typeProp != null) { resTypeName = (String)typeProp.getFirstValue(); } return resTypeName; }
if (source.getId() != null) { writer.writeAttribute(ATTR_PROPERTY_ID, source.getId()); if (source.getDisplayName() != null) { writer.writeAttribute(ATTR_PROPERTY_DISPLAYNAME, source.getDisplayName()); if (source.getLocalName() != null) { writer.writeAttribute(ATTR_PROPERTY_LOCALNAME, source.getLocalName()); if (source.getQueryName() != null) { writer.writeAttribute(ATTR_PROPERTY_QUERYNAME, source.getQueryName()); List<String> values = (List<String>) source.getValues(); if (values != null) { for (String value : values) {
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++; } }
Map<String, PropertyData<?>> propMap; if (mustFetchProperties) { String objId = (String) object.getProperties().getProperties().get(PropertyIds.OBJECT_ID).getFirstValue(); Properties props = fObjSvc.getProperties(fRepositoryId, objId, propertyFilter, null); propMap = props.getProperties(); 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()); Object value = entry.getValue().getFirstValue(); if (null != value) { valueStr = new StringBuilder(value.toString()); if (value instanceof GregorianCalendar) { valueStr = new StringBuilder(df.format(((GregorianCalendar) entry.getValue().getFirstValue()) .getTime()));
public void doQuery(String cql, int maxItems) { Session cmisSession = getCmisSession(); OperationContext oc = new OperationContextImpl(); oc.setMaxItemsPerPage(maxItems); ItemIterable<QueryResult> results = cmisSession.query(cql, false, oc); for (QueryResult result : results) { for (PropertyData<?> prop : result.getProperties()) { System.out.println(prop.getQueryName() + ": " + prop.getFirstValue()); } System.out.println("--------------------------------------"); } System.out.println("--------------------------------------"); System.out.println("Total number: " + results.getTotalNumItems()); System.out.println("Has more: " + results.getHasMoreItems()); System.out.println("--------------------------------------"); }
if (pd.getId() == null || pd.getId().length() == 0) { StringBuilder sb = null; if (isNotEmpty(secondaryTypes)) { "Cannot convert a property because it has no ID! The property is supposed to be part of the type '" + objectType.getId() + "'" + (sb == null ? "" : sb.toString()) + ". The value of this property is: " + pd.getValues()); PropertyDefinition<T> definition = (PropertyDefinition<T>) objectType.getPropertyDefinitions().get(pd.getId()); for (SecondaryType secondaryType : secondaryTypes) { if (secondaryType != null && secondaryType.getPropertyDefinitions() != null) { definition = (PropertyDefinition<T>) secondaryType.getPropertyDefinitions().get(pd.getId()); if (definition != null) { break; definition = (PropertyDefinition<T>) reloadedObjectType.getPropertyDefinitions().get(pd.getId()); if (reloadedSecondaryType.getPropertyDefinitions() != null) { definition = (PropertyDefinition<T>) reloadedSecondaryType.getPropertyDefinitions().get( pd.getId()); if (definition != null) { break; + pd.getId() + "' because it does not exist in the object type. The property is supposed to be part of the type '" + objectType.getId() + "'" + (sb == null ? "" : sb.toString()) + ". The value of this property is: " + pd.getValues());
for (PropertyData pd : prop) map.put(pd.getId(), pd);
assert property.getId() != null; propDef = typeCache.getPropertyDefinition(property.getId()); propDef = type.getPropertyDefinitions().get(property.getId()); propDef = typeCache.getPropertyDefinition(property.getId()); String propId = (propertyMode == PropertyMode.QUERY ? property.getQueryName() : property.getId()); if (propId == null) { throw new CmisRuntimeException("No query name or alias for property '" + property.getId() + "'!");
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++; } }
if (pd.getId() == null || pd.getId().length() == 0) { StringBuilder sb = null; if (isNotEmpty(secondaryTypes)) { "Cannot convert a property because it has no ID! The property is supposed to be part of the type '" + objectType.getId() + "'" + (sb == null ? "" : sb.toString()) + ". The value of this property is: " + pd.getValues()); PropertyDefinition<T> definition = (PropertyDefinition<T>) objectType.getPropertyDefinitions().get(pd.getId()); for (SecondaryType secondaryType : secondaryTypes) { if (secondaryType != null && secondaryType.getPropertyDefinitions() != null) { definition = (PropertyDefinition<T>) secondaryType.getPropertyDefinitions().get(pd.getId()); if (definition != null) { break; definition = (PropertyDefinition<T>) reloadedObjectType.getPropertyDefinitions().get(pd.getId()); if (reloadedSecondaryType.getPropertyDefinitions() != null) { definition = (PropertyDefinition<T>) reloadedSecondaryType.getPropertyDefinitions().get( pd.getId()); if (definition != null) { break; + pd.getId() + "' because it does not exist in the object type. The property is supposed to be part of the type '" + objectType.getId() + "'" + (sb == null ? "" : sb.toString()) + ". The value of this property is: " + pd.getValues());
@Override public void addProperty(PropertyData<?> property) { if (property == null) { return; } propertyList.add(property); properties.put(property.getId(), property); }
List<String> secondaryTypeIds = (List<String>) currentProperties.getProperties().get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues(); secondaryTypeIds = (List<String>) currentProperties1.getProperties().get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS).getValues(); assertEquals(updatedName, currentProperties1.getProperties().get(PropertyIds.NAME).getFirstValue());
assert property.getId() != null; propDef = typeCache.getPropertyDefinition(property.getId()); propDef = type.getPropertyDefinitions().get(property.getId()); propDef = typeCache.getPropertyDefinition(property.getId()); String propId = (propertyMode == PropertyMode.QUERY ? property.getQueryName() : property.getId()); if (propId == null) { throw new CmisRuntimeException("No query name or alias for property '" + property.getId() + "'!");
@Override public <T> T getPropertyValueById(String id) { PropertyData<T> property = getPropertyById(id); if (property == null) { return null; } return property.getFirstValue(); }
if (source.getId() != null) { writer.attribute(null, ATTR_PROPERTY_ID, source.getId()); if (source.getDisplayName() != null) { writer.attribute(null, ATTR_PROPERTY_DISPLAYNAME, source.getDisplayName()); if (source.getLocalName() != null) { writer.attribute(null, ATTR_PROPERTY_LOCALNAME, source.getLocalName()); if (source.getQueryName() != null) { writer.attribute(null, ATTR_PROPERTY_QUERYNAME, source.getQueryName()); List<String> values = (List<String>) source.getValues(); if (values != null) { for (String value : values) {
@Override public void addProperty(PropertyData<?> property) { if (property == null) { return; } propertyList.add(property); properties.put(property.getId(), property); }