Search in sources :

Example 1 with CmisProperty

use of org.pentaho.commons.util.repository.type.CmisProperty in project pentaho-platform by pentaho.

the class BiPlatformRepositoryClientNavigationService method createCmisObjectFromElement.

private CmisObject createCmisObjectFromElement(Element element, int depth) {
    CmisObject object = new CmisObjectImpl();
    CmisProperties properties = new CmisProperties();
    List<CmisProperty> propList = properties.getProperties();
    // is this a folder or a file?
    boolean isDirectory = false;
    // $NON-NLS-1$
    Attribute attr = element.attribute("isDirectory");
    if (attr != null) {
        // $NON-NLS-1$
        isDirectory = "true".equalsIgnoreCase(attr.getText());
    }
    // set the base properties
    String objectId = getObjectId(element);
    Calendar lastModifiedDate = getLastModifiedDate(element);
    String name = getName(element);
    String localizedName = getLocalizedName(element);
    String extension = getExtension(element);
    boolean visible = getVisible(element);
    propList.add(new PropertyId(PropertiesBase.OBJECTID, objectId));
    propList.add(new PropertyDateTime(PropertiesBase.LASTMODIFICATIONDATE, lastModifiedDate));
    if (isDirectory) {
        propList.add(new PropertyString(PropertiesBase.OBJECTTYPEID, CmisObject.OBJECT_TYPE_FOLDER));
    } else {
        propList.add(new PropertyString(PropertiesBase.OBJECTTYPEID, extension));
        propList.add(new PropertyBoolean(PropertiesDocument.CONTENTSTREAMALLOWED, true));
    }
    propList.add(new PropertyString(CmisObject.NAME, name));
    propList.add(new PropertyString(CmisObject.LOCALIZEDNAME, localizedName));
    propList.add(new PropertyBoolean(CmisObject.VISIBLE, visible));
    object.setProperties(properties);
    return object;
}
Also used : CmisObjectImpl(org.pentaho.commons.util.repository.type.CmisObjectImpl) PropertyString(org.pentaho.commons.util.repository.type.PropertyString) PropertyBoolean(org.pentaho.commons.util.repository.type.PropertyBoolean) Attribute(org.dom4j.Attribute) Calendar(java.util.Calendar) CmisProperties(org.pentaho.commons.util.repository.type.CmisProperties) CmisProperty(org.pentaho.commons.util.repository.type.CmisProperty) PropertyString(org.pentaho.commons.util.repository.type.PropertyString) PropertyId(org.pentaho.commons.util.repository.type.PropertyId) CmisObject(org.pentaho.commons.util.repository.type.CmisObject) PropertyDateTime(org.pentaho.commons.util.repository.type.PropertyDateTime)

Aggregations

Calendar (java.util.Calendar)1 Attribute (org.dom4j.Attribute)1 CmisObject (org.pentaho.commons.util.repository.type.CmisObject)1 CmisObjectImpl (org.pentaho.commons.util.repository.type.CmisObjectImpl)1 CmisProperties (org.pentaho.commons.util.repository.type.CmisProperties)1 CmisProperty (org.pentaho.commons.util.repository.type.CmisProperty)1 PropertyBoolean (org.pentaho.commons.util.repository.type.PropertyBoolean)1 PropertyDateTime (org.pentaho.commons.util.repository.type.PropertyDateTime)1 PropertyId (org.pentaho.commons.util.repository.type.PropertyId)1 PropertyString (org.pentaho.commons.util.repository.type.PropertyString)1