Package org.apache.slide.content

Examples of org.apache.slide.content.NodeProperty


            nat.begin();

            NodeRevisionDescriptors revisions = content.retrieve(slideToken,userUri);
            NodeRevisionDescriptor revision = content.retrieve(slideToken,revisions);
            revision.setLastModified(new Date());
            revision.setProperty(new NodeProperty("password", password, NodeProperty.SLIDE_NAMESPACE));
            content.store(slideToken, userUri, revision, null);
           
            nat.commit();
        }
        catch (Exception e) {
View Full Code Here


              res = statement.executeQuery();
           
              while (res.next()) {
                  String propertyName = res.getString(PROPERTY_NAME);
                  String propertyNamespace = res.getString(PROPERTY_NAMESPACE);
                  NodeProperty property =
                      new NodeProperty(propertyName,
                                       res.getString(PROPERTY_VALUE),
                                       propertyNamespace,
                                       res.getString(PROPERTY_TYPE),
                                       (res.getInt(PROPERTY_PROTECTED) == 1));
                  properties.put(propertyNamespace + propertyName, property);
View Full Code Here

              // Creating associated properties
              statement = null;
              Enumeration properties = revisionDescriptor.enumerateProperties();
              while (properties.hasMoreElements()) {
                  NodeProperty property =
                      (NodeProperty) properties.nextElement();
                  int protectedProperty = 0;
                  if (property.isProtected()) {
                      protectedProperty = 1;
                  }
                  if (statement == null){
                      statement = connection.prepareStatement
                          ("insert into property values(?,?,?,?,?,?,?)");
                  }
                  statement.setString(1, uri.toString());
                  statement.setString
                      (2, revisionDescriptor.getRevisionNumber().toString());
                  statement.setString(3, property.getName());
                  statement.setString(4, property.getValue().toString());
                  statement.setString(5, property.getNamespace());
                  statement.setString(6, property.getType());
                  statement.setInt(7, protectedProperty);
                  statement.execute();
              }
              closeStatement(statement);
           
View Full Code Here

                    versioningHelper.setWorkspaceProperty( resourcePath, revisionDescriptor );
                }
                // Added for DeltaV --end--
               
                if (isMsProprietarySupport()) {
                    NodeProperty property = null;
                    // Is hidden
                    property = new NodeProperty("ishidden", "0", "MICROSOFT");
                    revisionDescriptor.setProperty(property);
                   
                    // Is collection
                    property = new NodeProperty("iscollection", "0",
                                                "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);
                   
                }
View Full Code Here

                (Configuration) propertyDefinitions.nextElement();
            String propertyName = propertyDefinition.getAttribute("name");
            String propertyValue = propertyDefinition.getValue();
            String propertyNamespace = propertyDefinition.getAttribute
                ("namespace", NodeProperty.DEFAULT_NAMESPACE);
            NodeProperty property = revisionDescriptor.getProperty
                (propertyName, propertyNamespace);
            if (property == null)
                revisionDescriptor.setProperty(propertyName, propertyNamespace,
                                               propertyValue);
        }
View Full Code Here

                                       (WebdavStatus.SC_OK));
       
        while (propertyIterator.hasNext()) {
           
            RequestedProperty property = (RequestedProperty)propertyIterator.next();
            NodeProperty currentProperty = null;
            Integer errorCode = null;
            try {
                currentProperty = requestedResource.getProperty(property.getName(),
                                                                property.getNamespace());
                if (currentProperty == null) {
View Full Code Here

                   ) {
                    // skip properties from specification extensions
                    continue;
                }
               
                NodeProperty currentProperty = null;
                Integer errorCode = null;
                try {
                    currentProperty = requestedResource.getProperty(currentPropertyName);
                    if (currentProperty == null) {
                        errorCode = new Integer(WebdavStatus.SC_NOT_FOUND);
View Full Code Here

       
        if (!liveOnly) {
            // add this resource's dead properties
            Enumeration props = nrd.enumerateProperties();
            while (props.hasMoreElements()) {
                NodeProperty np = (NodeProperty)props.nextElement();
                if (!result.contains(np)) {
                    result.addProperty(new RequestedPropertyImpl(np.getName(), np.getNamespace()));
                }
            }
        }
        return result;
    }
View Full Code Here

            }
            else {
                Uri aUri = token.getUri(slideToken, aUriAsString);
                NodeRevisionDescriptors nrds = aUri.getStore().retrieveRevisionDescriptors(aUri);
                NodeRevisionDescriptor latestNrd = aUri.getStore().retrieveRevisionDescriptor(aUri, nrds.getLatestRevision());
                NodeProperty aNamespaceAsNode = latestNrd.getProperty(AclConstants.P_PRIVILEGE_NAMESPACE, WebdavConstants.S_DAV);
                String aNamespace = aNamespaceAsNode == null ? null : aNamespaceAsNode.getValue().toString();
                String aUriLastSegment = aUriAsString.substring(aUriAsString.lastIndexOf('/') + 1);
                if (aUriLastSegment.equals(privilegeName)
                        && ((aNamespace != null && privilegeNamespace.equals(aNamespace))
                                || (aNamespace == null && privilegeNamespace.equals(WebdavConstants.S_DAV)))) {
                    result = aNode;
View Full Code Here

            }
        } else {

            NodeRevisionDescriptors hpathNrds = content.retrieve(sToken, hpath);
            NodeRevisionDescriptor hpathNrd = content.retrieve(sToken, hpathNrds);
            NodeProperty nextHnProp = hpathNrd.getProperty(I_NEXT_HISTORY_NAME, NamespaceCache.SLIDE_URI);

            if (UriHandler.useHistoryCollectionHack) {

                if (nextHnProp == null || nextHnProp.getValue() == null) {
                    // XXX start with historyCollectionHackChildren to assure no
                    // resources are created directly in history folder
                    nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME, "10", NamespaceCache.SLIDE_URI);
                    nextHnProp.setKind(NodeProperty.Kind.PROTECTED);
                    hpathNrd.setProperty(nextHnProp);
                }

                String nextHnStr = (String) nextHnProp.getValue();
                long nextHnLong = Long.parseLong(nextHnStr);

                if (nextHnLong % 10 == 0) {
                    // create parent collection
                    long dirNum = nextHnLong / 10;
                    char dirChar[] = Long.toString(dirNum).toCharArray();
                    StringBuffer buf = new StringBuffer();
                    for (int i = 0; i < dirChar.length - 1; i++) {
                        buf.append(dirChar[i]);
                        buf.append('/');
                    }
                    buf.append(dirChar[dirChar.length - 1]);
                    String dirPath = hpath + "/" + buf.toString();

                    try {
                        structure.create(sToken, new SubjectNode(), dirPath);
                        //content.create(sToken,dirPath,true);
                        //NodeRevisionDescriptors dnrds =
                        // structure.retrieve(stoken,dirPath);
                        content.create(sToken, dirPath, new NodeRevisionDescriptor(0), null);
                    } catch (ObjectAlreadyExistsException oae) {
                        Domain.warn("Object " + dirPath + " already exists.");
                    } catch (RevisionAlreadyExistException rae) {
                        Domain.warn("Revision " + dirPath + " already exists.");
                    }
                }

                StringBuffer buf = new StringBuffer();
                char nextHnChar[] = nextHnStr.toCharArray();
                for (int i = 0; i < nextHnChar.length - 1; i++) {
                    buf.append(nextHnChar[i]);
                    buf.append('/');
                }
                buf.append('h');
                buf.append(nextHnChar[nextHnChar.length - 1]);

                result = new UriHandler(hpath + "/" + buf.toString());
               
                nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME, String.valueOf(nextHnLong + 1),
                        NamespaceCache.SLIDE_URI);
                hpathNrd.setProperty(nextHnProp);

            } else {

                if (nextHnProp == null) {
                    // convert to slide namespace if this property is still
                    // in DAV: namespace
                    nextHnProp = hpathNrd.getProperty(I_NEXT_HISTORY_NAME);
                    if (nextHnProp != null) {
                        hpathNrd.removeProperty(nextHnProp);
                        nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME, nextHnProp.getValue(),
                                NamespaceCache.SLIDE_URI);
                        nextHnProp.setKind(NodeProperty.Kind.PROTECTED);
                        hpathNrd.setProperty(nextHnProp);
                    }
                }
                if (nextHnProp == null || nextHnProp.getValue() == null) {
                    nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME, I_INITIAL_HISTORY_NAME, NamespaceCache.SLIDE_URI);
                    nextHnProp.setKind(NodeProperty.Kind.PROTECTED);
                    hpathNrd.setProperty(nextHnProp);
                }

                String nextHnStr = (String) nextHnProp.getValue();
                result = new UriHandler(hpath + "/" + nextHnStr);

                long nextHnLong = Long.parseLong(nextHnStr);
                nextHnProp = new NodeProperty(I_NEXT_HISTORY_NAME, String.valueOf(nextHnLong + 1),
                        NamespaceCache.SLIDE_URI);
                hpathNrd.setProperty(nextHnProp);

            }
            content.store(sToken, hpath, hpathNrd, null); //revisionContent = null
View Full Code Here

TOP

Related Classes of org.apache.slide.content.NodeProperty

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.