本文整理汇总了Java中org.apache.chemistry.opencmis.commons.data.Properties类的典型用法代码示例。如果您正苦于以下问题:Java Properties类的具体用法?Java Properties怎么用?Java Properties使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Properties类属于org.apache.chemistry.opencmis.commons.data包,在下文中一共展示了Properties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createFolder
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的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);
}
示例2: getNodeProperties
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的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;
}
示例3: getAssocProperties
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
public Properties getAssocProperties(CMISNodeInfo info, String filter)
{
PropertiesImpl result = new PropertiesImpl();
Set<String> filterSet = splitFilter(filter);
for (PropertyDefinitionWrapper propDefWrap : info.getType().getProperties())
{
PropertyDefinition<?> propDef = propDefWrap.getPropertyDefinition();
if ((filterSet != null) && (!filterSet.contains(propDef.getQueryName())))
{
// skip properties that are not in the filter
continue;
}
CMISPropertyAccessor cmisPropertyAccessor = propDefWrap.getPropertyAccessor();
Serializable value = cmisPropertyAccessor.getValue(info);
PropertyType propType = propDef.getPropertyType();
PropertyData<?> propertyData = getProperty(propType, propDefWrap, value);
result.addProperty(propertyData);
}
return result;
}
示例4: getStringProperty
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
/**
* Returns the value of the given property if it exists and is of the
* correct type.
*/
public String getStringProperty(Properties properties, String propertyId)
{
if ((properties == null) || (properties.getProperties() == null))
{
return null;
}
PropertyData<?> property = properties.getProperties().get(propertyId);
if (!(property instanceof PropertyString))
{
return null;
}
return ((PropertyString) property).getFirstValue();
}
示例5: getIdProperty
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
/**
* Returns the value of the given property if it exists and is of the
* correct type.
*/
public String getIdProperty(Properties properties, String propertyId)
{
if ((properties == null) || (properties.getProperties() == null))
{
return null;
}
PropertyData<?> property = properties.getProperties().get(propertyId);
if (!(property instanceof PropertyId))
{
return null;
}
return ((PropertyId) property).getFirstValue();
}
示例6: getNameProperty
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的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;
}
示例7: createPolicy
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
@Override
public String createPolicy(
String repositoryId, Properties properties, String folderId, List<String> policies,
Acl addAces, Acl removeAces, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// get the parent folder
getOrCreateFolderInfo(folderId, "Parent Folder");
String objectTypeId = connector.getObjectTypeIdProperty(properties);
connector.getTypeForCreate(objectTypeId, BaseTypeId.CMIS_POLICY);
// we should never get here - policies are not creatable!
throw new CmisRuntimeException("Polcies cannot be created!");
}
示例8: getProperties
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
@Override
public Properties getProperties(String repositoryId, String objectId, String filter, ExtensionsData extension)
{
checkRepositoryId(repositoryId);
// what kind of object is it?
CMISNodeInfo info = getOrCreateNodeInfo(objectId, "Object");
boolean isObjectInfoRequired = getContext().isObjectInfoRequired();
if (isObjectInfoRequired)
{
getObjectInfo(repositoryId, info.getObjectId(), IncludeRelationships.NONE);
}
if (info.isVariant(CMISObjectVariant.ASSOC))
{
return connector.getAssocProperties(info, filter);
}
else
{
return connector.getNodeProperties(info, filter);
}
}
示例9: create
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
@Override
public String create(String repositoryId, Properties properties, String folderId,
ContentStream contentStream, VersioningState versioningState,
List<String> policies, ExtensionsData extension)
{
FileFilterMode.setClient(Client.cmis);
try
{
return super.create(
repositoryId,
properties,
folderId,
contentStream,
versioningState,
policies,
extension);
}
finally
{
FileFilterMode.clearClient();
}
}
示例10: createDocument
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
/**
* Overridden to capture content upload for publishing to analytics service.
*/
@Override
public String createDocument(String repositoryId, Properties properties, String folderId,
ContentStream contentStream, VersioningState versioningState,
List<String> policies, Acl addAces, Acl removeAces, ExtensionsData extension)
{
String newId = super.createDocument(
repositoryId,
properties,
folderId,
contentStream,
versioningState,
policies,
addAces,
removeAces,
extension);
return newId;
}
示例11: getDocument
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
public FavouriteDocument getDocument(String networkId, final NodeRef nodeRef)
{
return TenantUtil.runAsSystemTenant(new TenantRunAsWork<FavouriteDocument>()
{
@Override
public FavouriteDocument doWork() throws Exception
{
FavouriteDocument document = null;
QName type = nodeService.getType(nodeRef);
if(dictionaryService.isSubClass(type, ContentModel.TYPE_CONTENT))
{
Properties properties = getProperties(nodeRef);
document = FavouriteDocument.getDocument(nodeRef.getId(), nodeRef.getId(), properties);
}
else
{
throw new IllegalArgumentException("Not a document node");
}
return document;
}
}, networkId);
}
示例12: getFolder
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
public FavouriteFolder getFolder(String networkId, final NodeRef nodeRef)
{
return TenantUtil.runAsSystemTenant(new TenantRunAsWork<FavouriteFolder>()
{
@Override
public FavouriteFolder doWork() throws Exception
{
FavouriteFolder folder = null;
QName type = nodeService.getType(nodeRef);
if(dictionaryService.isSubClass(type, ContentModel.TYPE_FOLDER))
{
Properties properties = getProperties(nodeRef);
folder = FavouriteFolder.getFolder(nodeRef.getId(), nodeRef.getId(), properties);
}
else
{
throw new IllegalArgumentException("Not a folder node");
}
return folder;
}
}, networkId);
}
示例13: getDocument
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的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;
}
示例14: getFolder
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的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;
}
示例15: create
import org.apache.chemistry.opencmis.commons.data.Properties; //导入依赖的package包/类
/**
* Create* dispatch for AtomPub.
*/
public ObjectData create(CallContext context, Properties properties, String folderId, ContentStream contentStream,
VersioningState versioningState, ObjectInfoHandler objectInfos) {
log.debug("create({}, {})", properties, folderId);
String typeId = getTypeId(properties);
TypeDefinition type = types.getType(typeId);
if (type == null) {
throw new CmisObjectNotFoundException("Type '" + typeId + "' is unknown!");
}
String objectId = null;
if (type.getBaseTypeId() == BaseTypeId.CMIS_DOCUMENT) {
objectId = createDocument(context, properties, folderId, contentStream, versioningState);
} else if (type.getBaseTypeId() == BaseTypeId.CMIS_FOLDER) {
objectId = createFolder(context, properties, folderId);
} else {
throw new CmisObjectNotFoundException("Cannot create object of type '" + typeId + "'!");
}
return compileObjectType(context, getNode(objectId), null, false, false, objectInfos);
}