本文整理汇总了Java中org.apache.jackrabbit.webdav.property.DavPropertyNameSet.add方法的典型用法代码示例。如果您正苦于以下问题:Java DavPropertyNameSet.add方法的具体用法?Java DavPropertyNameSet.add怎么用?Java DavPropertyNameSet.add使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.jackrabbit.webdav.property.DavPropertyNameSet
的用法示例。
在下文中一共展示了DavPropertyNameSet.add方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: internalSyncItems
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的package包/类
@Override
DavMethodBase internalSyncItems() throws IOException, DavException {
//Calendar already inited.
DavPropertyNameSet properties = new DavPropertyNameSet();
properties.add(DNAME_GETCTAG);
PropFindMethod method = new PropFindMethod(path, properties, CalDAVConstants.DEPTH_0);
client.executeMethod(method);
if (method.succeeded()) {
for (MultiStatusResponse response : method.getResponseBodyAsMultiStatus().getResponses()) {
DavPropertySet set = response.getProperties(SC_OK);
String ctag = AppointmentManager.getTokenFromProperty(set.get(DNAME_GETCTAG));
if (ctag != null && !ctag.equals(calendar.getToken())) {
EtagsHandler etagsHandler = new EtagsHandler(path, calendar, client, appointmentDao, utils);
etagsHandler.syncItems();
calendar.setToken(ctag);
}
}
} else {
log.error("Error executing PROPFIND Method, with status Code: {}", method.getStatusCode());
}
return method;
}
示例2: MultigetHandler
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的package包/类
public MultigetHandler(List<String> hrefs, boolean onlyEtag, String path, OmCalendar calendar, HttpClient client,
AppointmentDao appointmentDao, IcalUtils utils) {
super(path, calendar, client, appointmentDao, utils);
this.onlyEtag = onlyEtag;
if (hrefs == null || hrefs.isEmpty() || calendar.getSyncType() == SyncType.NONE) {
isMultigetDisabled = true;
} else {
DavPropertyNameSet properties = new DavPropertyNameSet();
properties.add(DavPropertyName.GETETAG);
CalendarData calendarData = null;
if (!onlyEtag) {
calendarData = new CalendarData();
}
CompFilter vcalendar = new CompFilter(Calendar.VCALENDAR);
vcalendar.addCompFilter(new CompFilter(Component.VEVENT));
query = new CalendarMultiget(properties, calendarData, false, false);
query.setHrefs(hrefs);
}
}
示例3: getAllPropSet
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的package包/类
/**
* Builds a DavPropertyNameSet with all prop
* For using instead of DavConstants.PROPFIND_ALL_PROP
* @return
*/
public static DavPropertyNameSet getAllPropSet(){
DavPropertyNameSet propSet = new DavPropertyNameSet();
propSet.add(DavPropertyName.DISPLAYNAME);
propSet.add(DavPropertyName.GETCONTENTTYPE);
propSet.add(DavPropertyName.RESOURCETYPE);
propSet.add(DavPropertyName.GETCONTENTLENGTH);
propSet.add(DavPropertyName.GETLASTMODIFIED);
propSet.add(DavPropertyName.CREATIONDATE);
propSet.add(DavPropertyName.GETETAG);
propSet.add(DavPropertyName.create(WebdavEntry.PROPERTY_QUOTA_USED_BYTES));
propSet.add(DavPropertyName.create(WebdavEntry.PROPERTY_QUOTA_AVAILABLE_BYTES));
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_PERMISSIONS,
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID,
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
return propSet;
}
示例4: getFilePropSet
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的package包/类
/**
* Builds a DavPropertyNameSet with properties for files
* @return
*/
public static DavPropertyNameSet getFilePropSet(){
DavPropertyNameSet propSet = new DavPropertyNameSet();
propSet.add(DavPropertyName.DISPLAYNAME);
propSet.add(DavPropertyName.GETCONTENTTYPE);
propSet.add(DavPropertyName.RESOURCETYPE);
propSet.add(DavPropertyName.GETCONTENTLENGTH);
propSet.add(DavPropertyName.GETLASTMODIFIED);
propSet.add(DavPropertyName.CREATIONDATE);
propSet.add(DavPropertyName.GETETAG);
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_PERMISSIONS,
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_REMOTE_ID,
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
propSet.add(WebdavEntry.EXTENDED_PROPERTY_NAME_SIZE,
Namespace.getNamespace(WebdavEntry.NAMESPACE_OC));
return propSet;
}
示例5: create
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的package包/类
public FileContentInfo create(FileContent fileContent) throws FileSystemException
{
WebdavFileObject file = (WebdavFileObject) (FileObjectUtils
.getAbstractFileObject(fileContent.getFile()));
String contentType = null;
String contentEncoding = null;
DavPropertyNameSet nameSet = new DavPropertyNameSet();
nameSet.add(DavPropertyName.GETCONTENTTYPE);
DavPropertySet propertySet = file.getProperties((URLFileName) file.getName(), nameSet, true);
DavProperty property = propertySet.get(DavPropertyName.GETCONTENTTYPE);
if (property != null)
{
contentType = (String) property.getValue();
}
property = propertySet.get(WebdavFileObject.RESPONSE_CHARSET);
if (property != null)
{
contentEncoding = (String) property.getValue();
}
return new DefaultFileContentInfo(contentType, contentEncoding);
}
示例6: setMeta
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的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;
}
示例7: doSetAttribute
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的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);
}
}
示例8: getProperty
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的package包/类
DavProperty getProperty(URLFileName fileName, DavPropertyName name)
throws FileSystemException
{
DavPropertyNameSet nameSet = new DavPropertyNameSet();
nameSet.add(name);
DavPropertySet propertySet = getProperties(fileName, nameSet, false);
return propertySet.get(name);
}
示例9: doSetAttribute
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的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);
}
}
示例10: parsePropPatchRequest
import org.apache.jackrabbit.webdav.property.DavPropertyNameSet; //导入方法依赖的package包/类
/**
*
* @throws CosmoDavException
*/
private void parsePropPatchRequest() throws CosmoDavException {
Document requestDocument = getSafeRequestDocument();
if (requestDocument == null) {
throw new BadRequestException("PROPPATCH requires entity body");
}
Element root = requestDocument.getDocumentElement();
if (!DomUtil.matches(root, XML_PROPERTYUPDATE, NAMESPACE)) {
throw new BadRequestException("Expected " + QN_PROPERTYUPDATE
+ " root element");
}
ElementIterator sets = DomUtil.getChildren(root, XML_SET, NAMESPACE);
ElementIterator removes = DomUtil.getChildren(root, XML_REMOVE,
NAMESPACE);
if (!(sets.hasNext() || removes.hasNext())) {
throw new BadRequestException("Expected at least one of "
+ QN_REMOVE + " and " + QN_SET + " as a child of "
+ QN_PROPERTYUPDATE);
}
Element prop = null;
ElementIterator i = null;
proppatchSet = new DavPropertySet();
while (sets.hasNext()) {
Element set = sets.nextElement();
prop = DomUtil.getChildElement(set, XML_PROP, NAMESPACE);
if (prop == null) {
throw new BadRequestException("Expected " + QN_PROP
+ " child of " + QN_SET);
}
i = DomUtil.getChildren(prop);
while (i.hasNext()) {
StandardDavProperty p = StandardDavProperty.createFromXml(i
.nextElement());
proppatchSet.add(p);
}
}
proppatchRemove = new DavPropertyNameSet();
while (removes.hasNext()) {
Element remove = removes.nextElement();
prop = DomUtil.getChildElement(remove, XML_PROP, NAMESPACE);
if (prop == null) {
throw new BadRequestException("Expected " + QN_PROP
+ " child of " + QN_REMOVE);
}
i = DomUtil.getChildren(prop);
while (i.hasNext()){
proppatchRemove.add(DavPropertyName.createFromXml(i
.nextElement()));
}
}
}