isLockNull = isLockNull( revisionDescriptor );
}
catch (ServiceAccessException e) {
int statusCode = getErrorCode((Exception)e);
sendError( statusCode, e );
throw new WebdavException( statusCode );
}
catch (SlideException e) {
// ignore silently
}
if (revisionDescriptor == null) {
revisionDescriptor =
new NodeRevisionDescriptor(0);
}
// check destination URI
UriHandler destinationUriHandler = UriHandler.getUriHandler(colName);
if (destinationUriHandler.isRestrictedUri()) {
int statusCode = WebdavStatus.SC_FORBIDDEN;
sendError( statusCode, getClass().getName()+".restrictedDestinationUri", new Object[]{colName} );
throw new WebdavException( statusCode );
}
// Resource type
revisionDescriptor.setResourceType("<collection/>");
// Creation date
revisionDescriptor.setCreationDate(new Date());
// Last modification date
revisionDescriptor.setLastModified(new Date());
// Content length name
revisionDescriptor.setContentLength(0);
// Source
revisionDescriptor.setSource("");
// Owner
try {
String creator = ((SubjectNode)security.getPrincipal(slideToken)).getPath().lastSegment();
revisionDescriptor.setCreationUser(creator);
revisionDescriptor.setOwner(creator);
} catch (Exception e) {
int statusCode = getErrorCode( e );
sendError( statusCode, e );
throw new WebdavException( statusCode );
}
// Added for DeltaV --start--
if( Configuration.useVersionControl() ) {
VersioningHelper vHelp = VersioningHelper.getVersioningHelper(
slideToken, token, req, resp, getConfig() );
// Workspace
vHelp.setWorkspaceProperty( colName, revisionDescriptor );
}
// Added for DeltaV --end--
if (isMsProprietarySupport()) {
NodeProperty property = null;
// Name
/*
property = new NodeProperty("name", colName, "ms", "MICROSOFT");
properties.setProperty(property);
*/
// ParentName
// TODO : Fix this
/*
property = new NodeProperty("parentname", colName, "ms",
"MICROSOFT");
properties.setProperty(property);
*/
// Href
/*
property = new NodeProperty("href", colName, "ms", "MICROSOFT");
properties.setProperty(property);
*/
// Is hidden
property = new NodeProperty("ishidden", "0", "MICROSOFT");
revisionDescriptor.setProperty(property);
// Is collection
property = new NodeProperty("iscollection", "1", "MICROSOFT");
revisionDescriptor.setProperty(property);
// Is read only
property = new NodeProperty("isreadonly", "0", "MICROSOFT");
revisionDescriptor.setProperty(property);
// Last accessed
property = new NodeProperty("lastaccessed",
(new Date()).toString(), "MICROSOFT");
revisionDescriptor.setProperty(property);
}
// If everything is ok : 201 - Created / OK
resp.setStatus(WebdavStatus.SC_CREATED);
try {
if (!isLockNull) {
SubjectNode collection = new SubjectNode();
structure.create(slideToken, collection, colName);
content.create(slideToken, colName, revisionDescriptor, null);
}
else {
content.store(slideToken, colName, revisionDescriptor, null);
}
} catch (Exception e) {
int statusCode = getErrorCode( e );
sendError( statusCode, e );
throw new WebdavException( statusCode );
}
// 415 - Unsupported Media Type
// TODO : Has something to do with the body of the request ...
// WebDAV RFC is vague on the subject.