Package org.wso2.carbon.registry.core

Examples of org.wso2.carbon.registry.core.CollectionImpl


        if ((!nodePath.equals("/")) && (((RegistryNode) this.getParent()).getNodetype() != null)) {
            ntName = ((RegistryNode) this.getParent()).getNodetype().getName();
        }

        CollectionImpl subCollection = null;

        try {
            subCollection = (CollectionImpl) registrySession.getUserRegistry().newCollection();
            subCollection.setDescription(ntName);
            subCollection.setProperty("jcr:uuid", absPath)//Here we use node's path as its identifier
            subCollection.setProperty("wso2.registry.jcr.versions", versionList);
            registrySession.getUserRegistry().put(absPath, subCollection);

        } catch (RegistryException e) {
            String msg = "failed to resolve the path of the given node " + this;
            log.debug(msg);
View Full Code Here


        RegistryNode subNode = new RegistryNode(absPath, registrySession);

        ntName = s1;

        CollectionImpl subCollection = null;

        try {

            subCollection = (CollectionImpl) registrySession.getUserRegistry().newCollection();
            subCollection.setDescription(ntName);
            subCollection.setProperty("jcr:uuid", absPath)//Here we use node's path as its identifier
            subCollection.setProperty("wso2.registry.jcr.versions", versionList);

            if (ntName.equals("mix:simpleVersionable")) {

                subCollection.setProperty("jcr:checkedOut", "true");
                subCollection.setProperty("jcr:isCheckedOut", "true");
            }

            if (ntName.startsWith("mix")) {

                addMixin(s1);
View Full Code Here

        } else if (value == null) {

            try {

                CollectionImpl collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
                collec.removeProperty(s);
                registrySession.getUserRegistry().put(nodePath, collec);

            } catch (RegistryException e) {
                String msg = "failed to resolve the path of the given node or violation of repository syntax " + this;
                log.debug(msg);
View Full Code Here

    }

    public Property setProperty(String s, String[] strings) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {

        List<String> properties = new ArrayList<String>();
        CollectionImpl coll = null;
        try {
            if (strings != null) {
                for (String val : strings) {

                    if (val != null) {

                        properties.add(val);
                    }

                }

                coll = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
                coll.setProperty(s, properties);
                registrySession.getUserRegistry().put(nodePath, coll);
            } else {

                coll = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
                coll.removeProperty(s);
                registrySession.getUserRegistry().put(nodePath, coll);


            }
View Full Code Here

        return setProperty(s, strings);
    }

    public Property setProperty(String s, String s1) throws ValueFormatException, VersionException, LockException, ConstraintViolationException, RepositoryException {

        CollectionImpl collc = null;

        try {
            if (s1 != null) {
                collc = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
                List lis = new ArrayList();
                lis.add(s1);
                collc.setProperty(s, lis);
                registrySession.getUserRegistry().put(nodePath, collc);

            } else {

                collc = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
                collc.removeProperty(s);
                registrySession.getUserRegistry().put(nodePath, collc);

            }

        } catch (RegistryException e) {
View Full Code Here

    }

    public NodeIterator getNodes() throws RepositoryException {

        HashSet nodes = new HashSet();
        CollectionImpl tempCollection = null;
        try {

            if (registrySession.getUserRegistry().get(nodePath) instanceof CollectionImpl) {
                tempCollection = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);

                String[] children = tempCollection.getChildren();

                for (int i = 0; i < children.length; i++) {

                    nodes.add(registrySession.getNode(children[i]));
View Full Code Here

        Set nodes = new HashSet();

        try {

            CollectionImpl coll = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);
            String[] childpaths = coll.getChildren();

            for (int i = 0; i < childpaths.length; i++) {
                Node node = new RegistryNode(childpaths[i], registrySession);
                nodes.add(node);
            }
View Full Code Here

        Set<String> propNamesList = new HashSet<String>();
        Set<Property> properties = new HashSet<Property>();

        //
        CollectionImpl coll = null;
        try {
            if (registrySession.getUserRegistry().get(nodePath) instanceof CollectionImpl) {

                coll = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);

                String[] childPaths = coll.getChildren();

                for (int i = 0; i < childPaths.length; i++) {
                    Resource res = registrySession.getUserRegistry().get(childPaths[i]);

                    if ((res instanceof ResourceImpl) && (res.getProperty("registry.jcr.property.type") != null)) {
                        String[] temp = childPaths[i].split("/");
                        propNamesList.add(temp[temp.length - 1]);

                    }
                }

                Properties propyList = coll.getProperties();
                Enumeration en = propyList.propertyNames();
                while (en.hasMoreElements()) {
                    String pName = en.nextElement().toString();
                    if ((pName != null) && (!isImplicitProperty(pName))) {
                        propNamesList.add(pName);
View Full Code Here

        String propName = tempArr[tempArr.length - 1];

        try {

            if (registrySession.getUserRegistry().resourceExists(tempPath)) {
                CollectionImpl c = (CollectionImpl) registrySession.getUserRegistry().get(tempPath);

                if (c.getProperty(propName) != null) {
                    hasProperty = true;

                }

            } else if (registrySession.getUserRegistry().resourceExists(absPath)) {
View Full Code Here

    }

    public boolean hasNodes() throws RepositoryException {

        boolean hasNodes = true;
        CollectionImpl collec = null;
        try {

            if ((registrySession.getUserRegistry().resourceExists(nodePath)) && ((registrySession.getUserRegistry().get(nodePath) instanceof CollectionImpl))) {

                collec = (CollectionImpl) registrySession.getUserRegistry().get(nodePath);

            }

            if (collec != null) {
                String[] children = collec.getChildren();

                if (children != null) {
                    if (children.length == 0) hasNodes = false;
                }
            }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.CollectionImpl

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.