Package org.apache.chemistry.opencmis.commons.impl.dataobjects

Examples of org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl


    public static Properties getPropertiesFromObject(StoredObject so, TypeDefinition td, List<String> requestedIds,
            boolean fillOptionalPropertyData) {
        // build properties collection

        BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
        Map<String, PropertyData<?>> properties = new HashMap<String, PropertyData<?>>();
        so.fillProperties(properties, objectFactory, requestedIds);

        String typeId = so.getTypeId();
        if (FilterParser.isContainedInFilter(PropertyIds.BASE_TYPE_ID, requestedIds)) {
            if (td == null) {
                log.warn("getPropertiesFromObject(), cannot get type definition, a type with id " + typeId
                        + " is unknown");
            } else {
                String baseTypeId = td.getBaseTypeId().value();
                properties.put(PropertyIds.BASE_TYPE_ID,
                        objectFactory.createPropertyIdData(PropertyIds.BASE_TYPE_ID, baseTypeId));
            }
        }

        // fill not-set properties from type definition (as spec requires)
        Map<String, PropertyDefinition<?>> propDefs = td.getPropertyDefinitions();
        for (PropertyDefinition<?> propDef : propDefs.values()) {
            if (!properties.containsKey(propDef.getId()) && FilterParser.isContainedInFilter(propDef.getId(), requestedIds))
                properties.put(propDef.getId(), getEmptyValue(propDef));
        }

        List<PropertyData<?>> propertiesList = new ArrayList<PropertyData<?>>(properties.values());

        if (fillOptionalPropertyData) { // add query name, local name, display
                                        // name
            fillOptionalPropertyData(td, propertiesList);
        }

        Properties props = objectFactory.createPropertiesData(propertiesList);
        return props;
    }
View Full Code Here


    public static Properties getPropertiesFromObject(StoredObject so, TypeDefinition td,
            Map<String, String> requestedIds, Map<String, String> requestedFuncs) {
        // build properties collection

        List<String> idList = new ArrayList<String>(requestedIds.values());
        BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
        Map<String, PropertyData<?>> properties = new HashMap<String, PropertyData<?>>();
        so.fillProperties(properties, objectFactory, idList);

        String typeId = so.getTypeId();
        if (FilterParser.isContainedInFilter(PropertyIds.BASE_TYPE_ID, idList)) {
            if (td == null) {
                log.warn("getPropertiesFromObject(), cannot get type definition, a type with id " + typeId
                        + " is unknown");
            } else {
                String baseTypeId = td.getBaseTypeId().value();
                properties.put(PropertyIds.BASE_TYPE_ID,
                        objectFactory.createPropertyIdData(PropertyIds.BASE_TYPE_ID, baseTypeId));
            }
        }

        Map<String, PropertyData<?>> mappedProperties = new HashMap<String, PropertyData<?>>();
        if (requestedIds.containsValue("*")) {
            for (Map.Entry<String, PropertyData<?>> prop : properties.entrySet()) {
                // map property id to property query name
                String queryName = td.getPropertyDefinitions().get(prop.getKey()).getQueryName();
                String localName = td.getPropertyDefinitions().get(prop.getKey()).getLocalName();
                String displayName = td.getPropertyDefinitions().get(prop.getKey()).getDisplayName();
                AbstractPropertyData<?> ad = clonePropertyData(prop.getValue());
               
                ad.setQueryName(queryName);
                ad.setLocalName(localName);
                ad.setDisplayName(displayName);
                mappedProperties.put(queryName, ad);
            }
        } else {
            // replace all ids with query names or alias:
            for (Entry<String, String> propAlias : requestedIds.entrySet()) {
                String queryNameOrAlias = propAlias.getKey();
                PropertyData<?> prop = properties.get(propAlias.getValue());
                String localName = td.getPropertyDefinitions().get(prop.getId()).getLocalName();
                String displayName = td.getPropertyDefinitions().get(prop.getId()).getDisplayName();
                AbstractPropertyData<?> ad = clonePropertyData(prop);
               
                ad.setQueryName(queryNameOrAlias);
                ad.setLocalName(localName);
                ad.setDisplayName(displayName);
                mappedProperties.put(queryNameOrAlias, ad);
            }
        }
        // add functions:
        BindingsObjectFactory objFactory = new BindingsObjectFactoryImpl();
        for (Entry<String, String> funcEntry : requestedFuncs.entrySet()) {
            PropertyInteger pi = objFactory.createPropertyIntegerData(funcEntry.getValue(), BigInteger.valueOf(100));
            // fixed dummy value
            mappedProperties.put(funcEntry.getKey(), pi);
        }

        Properties props = new PropertiesImpl(mappedProperties.values());
View Full Code Here

    }

    public static Properties getPropertiesFromObject(StoredObject so, TypeDefinition td, List<String> requestedIds) {
        // build properties collection

        BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
        Map<String, PropertyData<?>> properties = new HashMap<String, PropertyData<?>>();
        so.fillProperties(properties, objectFactory, requestedIds);

        String typeId = so.getTypeId();
        // (String) props.getProperties().get(PropertyIds.CMIS_OBJECT_TYPE_ID).
        // getFirstValue();
        if (FilterParser.isContainedInFilter(PropertyIds.BASE_TYPE_ID, requestedIds)) {
            if (td == null) {
                log.warn("getPropertiesFromObject(), cannot get type definition, a type with id " + typeId
                        + " is unknown");
            } else {
                String baseTypeId = td.getBaseTypeId().value();
                properties.put(PropertyIds.BASE_TYPE_ID, objectFactory.createPropertyIdData(PropertyIds.BASE_TYPE_ID,
                        baseTypeId));
            }
        }
        List<PropertyData<?>> propertiesList = new ArrayList<PropertyData<?>>(properties.values());
        Properties props = objectFactory.createPropertiesData(propertiesList);
        return props;
    }
View Full Code Here

    public static Properties getPropertiesFromObject(StoredObject so, TypeDefinition td,
            Map<String, String> requestedIds, Map<String, String> requestedFuncs) {
        // build properties collection

        List<String> idList = new ArrayList<String>(requestedIds.keySet());
        BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
        Map<String, PropertyData<?>> properties = new HashMap<String, PropertyData<?>>();
        so.fillProperties(properties, objectFactory, idList);

        String typeId = so.getTypeId();
        if (FilterParser.isContainedInFilter(PropertyIds.BASE_TYPE_ID, idList)) {
            if (td == null) {
                log.warn("getPropertiesFromObject(), cannot get type definition, a type with id " + typeId
                        + " is unknown");
            } else {
                String baseTypeId = td.getBaseTypeId().value();
                properties.put(PropertyIds.BASE_TYPE_ID, objectFactory.createPropertyIdData(PropertyIds.BASE_TYPE_ID,
                        baseTypeId));
            }
        }

        Map<String, PropertyData<?>> mappedProperties = new HashMap<String, PropertyData<?>>();
        if (requestedIds.containsKey("*")) {
            for (Map.Entry<String, PropertyData<?>> prop : properties.entrySet()) {
                // map property id to property query name
                String queryName = td.getPropertyDefinitions().get(prop.getKey()).getQueryName();
                AbstractPropertyData<?> ad = (AbstractPropertyData<?>) prop.getValue(); // a bit dirty
                ad.setQueryName(queryName);
                mappedProperties.put(queryName, prop.getValue());
            }
        } else {
            // replace all ids with query names or alias:
            for (Map.Entry<String, PropertyData<?>> prop : properties.entrySet()) {
                String queryNameOrAlias = requestedIds.get(prop.getKey());
                AbstractPropertyData<?> ad = (AbstractPropertyData<?>) prop.getValue(); // a bit dirty
                ad.setQueryName(queryNameOrAlias);
                mappedProperties.put(queryNameOrAlias, prop.getValue());
            }
        }
        // add functions:
        BindingsObjectFactory objFactory = new BindingsObjectFactoryImpl();
        for (String func : requestedFuncs.keySet()) {
            PropertyInteger pi = objFactory.createPropertyIntegerData(func, BigInteger.valueOf(100)); // fixed
                                                                                                      // dummy
                                                                                                      // value
            mappedProperties.put(requestedFuncs.get(func), pi);

        }
View Full Code Here

    public ObjectStoreImpl getStore(String repositoryId) {
        return (ObjectStoreImpl) fMapRepositoryToObjectStore.get(repositoryId);
    }

    public StoreManagerImpl() {
        fObjectFactory = new BindingsObjectFactoryImpl();
    }
View Full Code Here

        // initialize the SPI
        CmisBindingsHelper.getSPI(session);

        // set up object factory
        objectFactory = new BindingsObjectFactoryImpl();

        // set up repository service
        repositoryServiceWrapper = new RepositoryServiceImpl(session);
    }
View Full Code Here

          // create an initial temporary service instance to fill the repository
         
          InMemoryService svc = new InMemoryService(inMemoryServiceParameters, storeManager);
                 
          BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();

          String levelsStr = parameters.get(ConfigConstants.FILLER_DEPTH);
          int levels = 1;
          if (null != levelsStr)
              levels = Integer.parseInt(levelsStr);
View Full Code Here

    public ObjectStoreImpl getStore(String repositoryId) {
        return (ObjectStoreImpl) fMapRepositoryToObjectStore.get(repositoryId);
    }

    public StoreManagerImpl() {
        fObjectFactory = new BindingsObjectFactoryImpl();
    }
View Full Code Here

          // create an initial temporary service instance to fill the repository

          InMemoryService svc = new InMemoryService(inMemoryServiceParameters, storeManager);

          BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();

          String levelsStr = parameters.get(ConfigConstants.FILLER_DEPTH);
          int levels = 1;
          if (null != levelsStr) {
            levels = Integer.parseInt(levelsStr);
View Full Code Here

    }

    public static Properties getPropertiesFromObject(StoredObject so, TypeDefinition td, List<String> requestedIds, boolean fillOptionalPropertyData) {
        // build properties collection

        BindingsObjectFactory objectFactory = new BindingsObjectFactoryImpl();
        Map<String, PropertyData<?>> properties = new HashMap<String, PropertyData<?>>();
        so.fillProperties(properties, objectFactory, requestedIds);

        String typeId = so.getTypeId();
        // (String) props.getProperties().get(PropertyIds.CMIS_OBJECT_TYPE_ID).
        // getFirstValue();
        if (FilterParser.isContainedInFilter(PropertyIds.BASE_TYPE_ID, requestedIds)) {
            if (td == null) {
                log.warn("getPropertiesFromObject(), cannot get type definition, a type with id " + typeId
                        + " is unknown");
            } else {
                String baseTypeId = td.getBaseTypeId().value();
                properties.put(PropertyIds.BASE_TYPE_ID, objectFactory.createPropertyIdData(PropertyIds.BASE_TYPE_ID,
                        baseTypeId));
            }
        }
        List<PropertyData<?>> propertiesList = new ArrayList<PropertyData<?>>(properties.values());

        if (fillOptionalPropertyData) {  // add query name, local name, display name
            fillOptionalPropertyData(td, propertiesList);
        }

        Properties props = objectFactory.createPropertiesData(propertiesList);
        return props;
    }
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.commons.impl.dataobjects.BindingsObjectFactoryImpl

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.