private String setProperty ( Node node , HierarchicalProperty property ) { String propertyName = WebDavNamespaceContext . createName ( property . getName ( ) ) ; if ( READ_ONLY_PROPS . contains ( property . getName ( ) ) ) { return WebDavConst . getStatusDescription ( HTTPStatus . CONFLICT ) ; } try { Workspace ws = node . getSession ( ) . getWorkspace ( ) ; NodeTypeDataManager nodeTypeHolder = ( ( WorkspaceImpl ) ws ) . getNodeTypesHolder ( ) ; NodeData data = ( NodeData ) ( ( NodeImpl ) node ) . getData ( ) ; InternalQName propName = ( ( SessionImpl ) node . getSession ( ) ) . getLocationFactory ( ) . parseJCRName ( propertyName ) . getInternalName ( ) ; PropertyDefinitionDatas propdefs = nodeTypeHolder . getPropertyDefinitions ( propName , data . getPrimaryTypeName ( ) , data . getMixinTypeNames ( ) ) ; if ( propdefs == null ) { throw new RepositoryException ( ) ; } PropertyDefinitionData propertyDefinitionData = propdefs . getAnyDefinition ( ) ; if ( propertyDefinitionData == null ) { throw new RepositoryException ( ) ; } boolean isMultiValued = propertyDefinitionData . isMultiple ( ) ; if ( node . isNodeType ( WebDavConst . NodeTypes . MIX_VERSIONABLE ) && ! node . isCheckedOut ( ) ) { node . checkout ( ) ; node . save ( ) ; } if ( ! isMultiValued ) { node . setProperty ( propertyName , property . getValue ( ) ) ; } else { String [ ] value = new String [ 1 ] ; value [ 0 ] = property . getValue ( ) ; node . setProperty ( propertyName , value ) ; } node . save ( ) ; return WebDavConst . getStatusDescription ( HTTPStatus . OK ) ; } catch ( AccessDeniedException e ) { return WebDavConst . getStatusDescription ( HTTPStatus . FORBIDDEN ) ; } catch ( ItemNotFoundException e ) { return WebDavConst . getStatusDescription ( HTTPStatus . NOT_FOUND ) ; } catch ( PathNotFoundException e ) { return WebDavConst . getStatusDescription ( HTTPStatus . NOT_FOUND ) ; } catch ( RepositoryException e ) { return WebDavConst . getStatusDescription ( HTTPStatus . CONFLICT ) ; } }
Sets changes the property value .