当前位置: 首页>>代码示例>>Java>>正文


Java PropertyIds类代码示例

本文整理汇总了Java中org.apache.chemistry.opencmis.commons.PropertyIds的典型用法代码示例。如果您正苦于以下问题:Java PropertyIds类的具体用法?Java PropertyIds怎么用?Java PropertyIds使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


PropertyIds类属于org.apache.chemistry.opencmis.commons包,在下文中一共展示了PropertyIds类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createFolder

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
/**
 * Creates a new folder with the given name under the given folder.
 * 
 * @param name
 *            the name of the folder.
 * @param rootFolder
 *            the root folder.
 * @return the created folder.
 */
public Folder createFolder(String name, Folder folder) {
	logger.debug(DEBUG_CREATING_NEW_FOLDER, name, folder.getName());

	Folder newFolder = null;

	Map<String, String> newFolderProps = new HashMap<String, String>();
	newFolderProps.put(PropertyIds.OBJECT_TYPE_ID, CMIS_FOLDER_TYPE);
	newFolderProps.put(PropertyIds.NAME, name);
	try {
		newFolder = folder.createFolder(newFolderProps);
	} catch (CmisNameConstraintViolationException e) {
		String errorMessage = MessageFormat.format(ERROR_FOLDER_ALREADY_EXISTS, name);
		logger.error(errorMessage);
		throw new IllegalArgumentException(errorMessage, e);
	}
	logger.debug(DEBUG_FOLDER_CREATED, name);

	return newFolder;
}
 
开发者ID:SAP,项目名称:cloud-ariba-partner-flow-extension-ext,代码行数:29,代码来源:EcmRepository.java

示例2: testBasicDefaultMetaData

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
public void testBasicDefaultMetaData()
{
    CMISQueryOptions options = new CMISQueryOptions("SELECT * FROM cmis:document", rootNodeRef.getStoreRef());
    CMISResultSet rs = cmisQueryService.query(options);
    CMISResultSetMetaData md = rs.getMetaData();
    assertNotNull(md.getQueryOptions());
    TypeDefinitionWrapper typeDef = cmisDictionaryService.findType(BaseTypeId.CMIS_DOCUMENT.value());
    int count = 0;
    for (PropertyDefinitionWrapper pdef : typeDef.getProperties())
    {            
        count++;   
    }
    assertEquals(count, md.getColumnNames().length);
    assertNotNull(md.getColumn(PropertyIds.OBJECT_ID));
    assertEquals(1, md.getSelectors().length);
    assertNotNull(md.getSelector(""));
    rs.close();
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:19,代码来源:OpenCmisQueryTest.java

示例3: createFolder

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
/**
 * CMIS createFolder.
 */
public String createFolder(CallContext context, Properties properties, String folderId) {
    checkUser(context, true);

    // check properties
    checkNewProperties(properties, BaseTypeId.CMIS_FOLDER);

    // get parent File
    File parent = getFile(folderId);
    if (!parent.isDirectory()) {
        throw new CmisObjectNotFoundException("Parent is not a folder!");
    }

    // create the folder
    String name = FileBridgeUtils.getStringProperty(properties, PropertyIds.NAME);
    File newFolder = new File(parent, name);
    if (!newFolder.mkdir()) {
        throw new CmisStorageException("Could not create folder!");
    }

    return getId(newFolder);
}
 
开发者ID:cmisdocs,项目名称:ServerDevelopmentGuideV2,代码行数:25,代码来源:FileBridgeRepository.java

示例4: createDocument

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
/**
 * Creates a new document with the given name and content under the given
 * folder.
 * 
 * @param name
 *            the name of the document.
 * @param rootFolder
 *            the root folder.
 * @param content
 *            the content of the document.
 * @return the created document.
 */
public Document createDocument(Folder rootFolder, String fileName, InputStream inputStream) {
	logger.debug(DEBUG_CREATING_NEW_DOCUMENT, fileName, rootFolder);

	Document document = null;

	Map<String, Object> properties = new HashMap<String, Object>();
	properties.put(PropertyIds.OBJECT_TYPE_ID, CMIS_DOCUMENT_TYPE);
	properties.put(PropertyIds.NAME, fileName);
	ContentStream contentStream = cmisSession.getObjectFactory().createContentStream(fileName, -1,
			MIME_TYPE_TEXT_PLAIN_UTF_8, inputStream);
	try {
		document = rootFolder.createDocument(properties, contentStream, VersioningState.NONE);
	} catch (CmisNameConstraintViolationException e) {
		String errorMessage = MessageFormat.format(ERROR_FILE_ALREADY_EXISTS, fileName);
		logger.error(errorMessage);
		throw new CmisNameConstraintViolationException(errorMessage, e);
	}
	logger.debug(DEBUG_DOCUMENT_CREATED, fileName);

	return document;
}
 
开发者ID:SAP,项目名称:cloud-ariba-partner-flow-extension-ext,代码行数:34,代码来源:EcmRepository.java

示例5: checkChildObjectType

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
/**
 * Checks if a child of a given type can be added to a given folder.
 */
@SuppressWarnings("unchecked")
public void checkChildObjectType(CMISNodeInfo folderInfo, String childType)
{
    TypeDefinitionWrapper targetType = folderInfo.getType();
    PropertyDefinitionWrapper allowableChildObjectTypeProperty = targetType
            .getPropertyById(PropertyIds.ALLOWED_CHILD_OBJECT_TYPE_IDS);
    List<String> childTypes = (List<String>) allowableChildObjectTypeProperty.getPropertyAccessor().getValue(
            folderInfo);

    if ((childTypes == null) || childTypes.isEmpty())
    {
        return;
    }

    if (!childTypes.contains(childType))
    {
        throw new CmisConstraintException("Objects of type '" + childType + "' cannot be added to this folder!");
    }
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:23,代码来源:CMISConnector.java

示例6: getNodeProperties

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
public Properties getNodeProperties(CMISNodeInfo info, String filter)
{
    PropertiesImpl result = new PropertiesImpl();

    Set<String> filterSet = splitFilter(filter);

    for (PropertyDefinitionWrapper propDef : info.getType().getProperties())
    {
        if (!propDef.getPropertyId().equals(PropertyIds.OBJECT_ID))
        {
            // don't filter the object id
            if ((filterSet != null) && (!filterSet.contains(propDef.getPropertyDefinition().getQueryName())))
            {
                // skip properties that are not in the filter
                continue;
            }
        }

        Serializable value = propDef.getPropertyAccessor().getValue(info);
        result.addProperty(getProperty(propDef.getPropertyDefinition().getPropertyType(), propDef, value));
    }

    addAspectProperties(info, filter, result);

    return result;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:27,代码来源:CMISConnector.java

示例7: getNameProperty

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
public String getNameProperty(Properties properties, String fallback)
{
    String name = getStringProperty(properties, PropertyIds.NAME);
    if ((name == null) || (name.trim().length() == 0))
    {
        if (fallback == null)
        {
            throw new CmisInvalidArgumentException("Property " + PropertyIds.NAME + " must be set!");
        }
        else
        {
            name = fallback;
        }
    }

    return name;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:18,代码来源:CMISConnector.java

示例8: createDocument

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
private static Document createDocument(Folder target, String newDocName, Session session)
{
    Map<String, String> props = new HashMap<String, String>();
    props.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
    props.put(PropertyIds.NAME, newDocName);
    String content = "aegif Mind Share Leader Generating New Paradigms by aegif corporation.";
    byte[] buf = null;
    try
    {
        buf = content.getBytes("ISO-8859-1"); // set the encoding here for the content stream
    }
    catch (UnsupportedEncodingException e)
    {
        e.printStackTrace();
    }

    ByteArrayInputStream input = new ByteArrayInputStream(buf);

    ContentStream contentStream = session.getObjectFactory().createContentStream(newDocName, buf.length,
            "text/plain; charset=UTF-8", input); // additionally set the charset here
    // NOTE that we intentionally specified the wrong charset here (as UTF-8)
    // because Alfresco does automatic charset detection, so we will ignore this explicit request
    return target.createDocument(props, contentStream, VersioningState.MAJOR);
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:25,代码来源:OpenCmisLocalTest.java

示例9: getPropIsLatestMajorVersion

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
private PropertyData<?> getPropIsLatestMajorVersion(ObjectData objectData)
{
    List<PropertyData<?>> properties = objectData.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(PropertyIds.IS_LATEST_MAJOR_VERSION);
    assertTrue("The PropertyIds.IS_LATEST_MAJOR_VERSION property was not found", found);
    if (found)
    {
        return propIsLatestMajorVersion;
    }
    
    return null;
}
 
开发者ID:Alfresco,项目名称:alfresco-repository,代码行数:24,代码来源:CMISTest.java

示例10: assertIsPwcProperty

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
private void assertIsPwcProperty(CmisObject pwc, boolean nullExpected)
{
    boolean isPwcFound = false;
    Boolean isPwcValueTrue = null;
    for (Property<?> property : pwc.getProperties())
    {
        if ((null != property) && PropertyIds.IS_PRIVATE_WORKING_COPY.equals(property.getId()))
        {
            isPwcFound = true;
            isPwcValueTrue = property.getValue();
            break;
        }
    }

    if (nullExpected)
    {
        assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property is not null!"), !isPwcFound || (null == isPwcValueTrue));
        return;
    }

    assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property has not been found!"), isPwcFound);
    assertNotNull(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property value must not be null!"), isPwcValueTrue);
    assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property value must be equal to 'true'!"), isPwcValueTrue);
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:25,代码来源:TestCMIS.java

示例11: getDocument

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
public static FavouriteDocument getDocument(String id, String guid, Properties props)
{
    FavouriteDocument document = new FavouriteDocument(id, guid);

    Map<String, PropertyData<?>> properties = props.getProperties();
    document.setName((String)properties.get(PropertyIds.NAME).getFirstValue());
    document.setTitle((String)properties.get(ContentModel.PROP_TITLE.toString()).getFirstValue());
    document.setCreatedBy((String)properties.get(PropertyIds.CREATED_BY).getFirstValue());
    document.setModifiedBy((String)properties.get(PropertyIds.LAST_MODIFIED_BY).getFirstValue());
    GregorianCalendar modifiedAt = (GregorianCalendar)properties.get(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
    document.setModifiedAt(modifiedAt.getTime());
    GregorianCalendar createdAt = (GregorianCalendar)properties.get(PropertyIds.CREATION_DATE).getFirstValue();
    document.setCreatedAt(createdAt.getTime());
    //document.setDescription((String)props.get(PropertyIds.DE).getFirstValue());
    document.setMimeType((String)properties.get(PropertyIds.CONTENT_STREAM_MIME_TYPE).getFirstValue());
    document.setSizeInBytes((BigInteger)properties.get(PropertyIds.CONTENT_STREAM_LENGTH).getFirstValue());
    document.setVersionLabel((String)properties.get(PropertyIds.VERSION_LABEL).getFirstValue());
    return document;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:20,代码来源:FavouriteDocument.java

示例12: getFolder

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
public static FavouriteFolder getFolder(String id, String guid, Properties props)
{
    FavouriteFolder folder = new FavouriteFolder(id, guid);

    Map<String, PropertyData<?>> properties = props.getProperties();
    folder.setName((String)properties.get(PropertyIds.NAME).getFirstValue());
    folder.setTitle((String)properties.get(ContentModel.PROP_TITLE.toString()).getFirstValue());
    folder.setCreatedBy((String)properties.get(PropertyIds.CREATED_BY).getFirstValue());
    folder.setModifiedBy((String)properties.get(PropertyIds.LAST_MODIFIED_BY).getFirstValue());
    GregorianCalendar modifiedAt = (GregorianCalendar)properties.get(PropertyIds.LAST_MODIFICATION_DATE).getFirstValue();
    folder.setModifiedAt(modifiedAt.getTime());
    GregorianCalendar createdAt = (GregorianCalendar)properties.get(PropertyIds.CREATION_DATE).getFirstValue();
    folder.setCreatedAt(createdAt.getTime());
    //document.setDescription((String)props.get(PropertyIds.DE).getFirstValue());
    return folder;
}
 
开发者ID:Alfresco,项目名称:alfresco-remote-api,代码行数:17,代码来源:FavouriteFolder.java

示例13: updatePropertiesWithAspects

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
private static void updatePropertiesWithAspects(Session pSession, Map<String, Object> pMapProperties,
        String pStrDocTypeId, Collection<String> pCollectionAspects) {
	// Creazione mappa proprietà secondo la versione CMIS del repository
	if (pSession.getRepositoryInfo().getCmisVersion() == CmisVersion.CMIS_1_1) {
		pMapProperties.put(PropertyIds.SECONDARY_OBJECT_TYPE_IDS, pCollectionAspects);

	} else {
		// Creazione dell'elenco degli aspetti
		StringBuilder lSBAspects = new StringBuilder(pStrDocTypeId);
		for (String aspect : pCollectionAspects) {
			lSBAspects.append(", ").append(aspect);
		}
		mLog.debug("[CMIS 1.0] Aspetti del documento: {}", lSBAspects.toString());

		// XXX (Alessio): funziona senza usare l'estensione Chemistry per Alfresco? In generale,
		// bisognerebbe prevedere la gestione secondo la versione CMIS in tutto l'AlfrescoHelper,
		// per supportare le diverse versioni di Alfresco.
		pMapProperties.put(PropertyIds.OBJECT_TYPE_ID, lSBAspects.toString());
	}

}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:22,代码来源:AlfrescoHelper.java

示例14: renameFolder

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
public static void renameFolder(Session pSession, String pStrNodeRef, String pStrNewName) {
	mLog.debug("ENTER renameFolder(<Session>, " + pStrNodeRef + ", " + pStrNewName + ")");

	Folder lFolder = (Folder) pSession.getObject(pStrNodeRef);

	Map<String, String> lMapProperties = new HashMap<String, String>();
	lMapProperties.put(PropertyIds.NAME, pStrNewName);

	try {
		lFolder.updateProperties(lMapProperties, true);
	} catch (CmisContentAlreadyExistsException e) {
		mLog.error("Impossibile aggiornare le proprietà del documento", e);
		throw new AlfrescoException(e, AlfrescoException.FOLDER_ALREADY_EXISTS_EXCEPTION);
	}

	mLog.debug("EXIT renameFolder(<Session>, " + pStrNodeRef + ", " + pStrNewName + ")");
}
 
开发者ID:MakeITBologna,项目名称:zefiro,代码行数:18,代码来源:AlfrescoHelper.java

示例15: filterTypeProperties

import org.apache.chemistry.opencmis.commons.PropertyIds; //导入依赖的package包/类
private Map<String, Object> filterTypeProperties(Map<String, Object> properties) throws Exception {
    Map<String, Object> result = new HashMap<>(properties.size());

    String objectTypeName = CamelCMISConstants.CMIS_DOCUMENT;
    if (properties.containsKey(PropertyIds.OBJECT_TYPE_ID)) {
        objectTypeName = (String) properties.get(PropertyIds.OBJECT_TYPE_ID);
    }

    Set<String> types = new HashSet<>();
    types.addAll(getSessionFacade().getPropertiesFor(objectTypeName));

    if (getSessionFacade().supportsSecondaries() && properties.containsKey(PropertyIds.SECONDARY_OBJECT_TYPE_IDS)) {
        @SuppressWarnings("unchecked")
        Collection<String> secondaryTypes = (Collection<String>) properties.get(PropertyIds.SECONDARY_OBJECT_TYPE_IDS);
        for (String secondaryType : secondaryTypes) {
            types.addAll(getSessionFacade().getPropertiesFor(secondaryType));
        }
    }

    for (Map.Entry<String, Object> entry : properties.entrySet()) {
        if (types.contains(entry.getKey())) {
            result.put(entry.getKey(), entry.getValue());
        }
    }
    return result;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:27,代码来源:CMISProducer.java


注:本文中的org.apache.chemistry.opencmis.commons.PropertyIds类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。