本文整理汇总了Java中org.apache.jackrabbit.webdav.client.methods.PropPatchMethod类的典型用法代码示例。如果您正苦于以下问题:Java PropPatchMethod类的具体用法?Java PropPatchMethod怎么用?Java PropPatchMethod使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
PropPatchMethod类属于org.apache.jackrabbit.webdav.client.methods包,在下文中一共展示了PropPatchMethod类的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: setUserName
import org.apache.jackrabbit.webdav.client.methods.PropPatchMethod; //导入依赖的package包/类
private void setUserName(URLFileName fileName, String urlStr)
throws IOException
{
List<DefaultDavProperty> list = new ArrayList<DefaultDavProperty>();
String name = builder.getCreatorName(getFileSystem().getFileSystemOptions());
String userName = fileName.getUserName();
if (name == null)
{
name = userName;
}
else
{
if (userName != null)
{
String comment = "Modified by user " + userName;
list.add(new DefaultDavProperty(DeltaVConstants.COMMENT, comment));
}
}
list.add(new DefaultDavProperty(DeltaVConstants.CREATOR_DISPLAYNAME, name));
PropPatchMethod method = new PropPatchMethod(urlStr, list);
setupMethod(method);
execute(method);
}
示例2: setUserName
import org.apache.jackrabbit.webdav.client.methods.PropPatchMethod; //导入依赖的package包/类
private void setUserName(URLFileName fileName, String urlStr)
throws IOException
{
List list = new ArrayList();
String name = builder.getCreatorName(getFileSystem().getFileSystemOptions());
String userName = fileName.getUserName();
if (name == null)
{
name = userName;
}
else
{
if (userName != null)
{
String comment = "Modified by user " + userName;
list.add(new DefaultDavProperty(DeltaVConstants.COMMENT, comment));
}
}
list.add(new DefaultDavProperty(DeltaVConstants.CREATOR_DISPLAYNAME, name));
PropPatchMethod method = new PropPatchMethod(urlStr, list);
setupMethod(method);
execute(method);
}
示例3: setMeta
import org.apache.jackrabbit.webdav.client.methods.PropPatchMethod; //导入依赖的package包/类
/**
* set meta information on this dav's resource.
* if the property value is null, that property will be removed.
* otherwise, the property will be either added or updated.
* @param metas
* @return
*/
public boolean setMeta(WspaceMeta ... metas) {
if (metas == null) return false;
for(WspaceMeta meta : metas) {
Map<String, String> props = meta.getProperties();
if (props != null && props.size() > 0) {
DavPropertySet newProps=new DavPropertySet();
DavPropertyNameSet removeProps=new DavPropertyNameSet();
for (String key : props.keySet()) {
String v = props.get(key);
if (v == null) {
removeProps.add(DavPropertyName.create(key, IRSA_NS));
} else {
DavProperty p = new DefaultDavProperty(key, props.get(key), IRSA_NS);
newProps.add(p);
}
}
try {
PropPatchMethod proPatch=new PropPatchMethod(getResourceUrl(meta.getRelPath()), newProps, removeProps);
if ( !executeMethod(proPatch)) {
// handle error
System.out.println("Unable to update property:" + newProps.toString() + " -- " + proPatch.getStatusText());
return false;
}
return true;
} catch (IOException e) {
LOG.error(e, "Error while setting property: " + meta);
e.printStackTrace();
}
}
}
return false;
}
示例4: doSetAttribute
import org.apache.jackrabbit.webdav.client.methods.PropPatchMethod; //导入依赖的package包/类
/**
* Sets an attribute of this file. Is only called if {@link #doGetType}
* does not return {@link FileType#IMAGINARY}.
* <p/>
* This implementation throws an exception.
*/
@Override
protected void doSetAttribute(final String attrName, final Object value)
throws Exception
{
try
{
URLFileName fileName = (URLFileName) getName();
String urlStr = urlString(fileName);
DavPropertySet properties = new DavPropertySet();
DavPropertyNameSet propertyNameSet = new DavPropertyNameSet();
DavProperty property = new DefaultDavProperty(attrName, value, Namespace.EMPTY_NAMESPACE);
if (value != null)
{
properties.add(property);
}
else
{
propertyNameSet.add(property.getName()); // remove property
}
PropPatchMethod method = new PropPatchMethod(urlStr, properties, propertyNameSet);
setupMethod(method);
execute(method);
if (!method.succeeded())
{
throw new FileSystemException("Property '" + attrName + "' could not be set.");
}
}
catch (FileSystemException fse)
{
throw fse;
}
catch (Exception e)
{
throw new FileSystemException("vfs.provider.webdav/propfind.error", getName(), e);
}
}
示例5: doSetAttribute
import org.apache.jackrabbit.webdav.client.methods.PropPatchMethod; //导入依赖的package包/类
/**
* Sets an attribute of this file. Is only called if {@link #doGetType}
* does not return {@link FileType#IMAGINARY}.
* <p/>
* This implementation throws an exception.
*/
protected void doSetAttribute(final String attrName, final Object value)
throws Exception
{
try
{
URLFileName fileName = (URLFileName) getName();
String urlStr = urlString(fileName);
DavPropertySet properties = new DavPropertySet();
DavPropertyNameSet propertyNameSet = new DavPropertyNameSet();
DavProperty property = new DefaultDavProperty(attrName, value, Namespace.EMPTY_NAMESPACE);
if (value != null)
{
properties.add(property);
}
else
{
propertyNameSet.add(property.getName()); // remove property
}
PropPatchMethod method = new PropPatchMethod(urlStr, properties, propertyNameSet);
setupMethod(method);
execute(method);
if (!method.succeeded())
{
throw new FileSystemException("Property '" + attrName + "' could not be set.");
}
}
catch (FileSystemException fse)
{
throw fse;
}
catch(Exception e)
{
throw new FileSystemException("vfs.provider.webdav/propfind.error", getName(), e);
}
}