Package org.wso2.carbon.registry.core

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


                        adminUser = true;
                    }


                    if (adminUser) {
                        ResourceImpl resource = tagsDAO.getResourceWithMinimumData(path);
                        tagsDAO.removeTags(resource, tag);
                    } else {
                        ResourceImpl resource = (ResourceImpl) repository.getMetaData(path);

                        String author = resource.getAuthorUserName();
                        if (user.equals(author)) {
                            tagsDAO.removeTags(resource, tag);
                        } else {
                            tagsDAO.removeTags(resource, tag, user);
                        }
View Full Code Here


                        log.error(msg);
                        throw new RegistryException(msg);
                    }

                    try {
                        ResourceImpl resource =
                                commentsDAO.getResourceWithMinimumData(resourcePath);
                        if (resource == null) {
                            String msg =
                                    "Failed to add comment " + comment.getText() + " to resource " +
                                            resourcePath + ". Resource " + resourcePath +
View Full Code Here

                Comment temp = commentsDAO.getComment(Long.parseLong(commentId),
                        processedPath.getPath());
                if (adminUser) {
                    commentsDAO.deleteComment(Long.parseLong(commentId));
                } else {
                    ResourceImpl resource =
                            (ResourceImpl) repository.getMetaData(processedPath.getPath());

                    String author = resource.getAuthorUserName();
                    if (user.equals(author)) {
                        commentsDAO.deleteComment(Long.parseLong(commentId));
                    } else {
                        if (temp != null && user.equals(temp.getUser())) {
                            commentsDAO.deleteComment(Long.parseLong(commentId));
View Full Code Here

            Comment[] output = registryContext.getHandlerManager().getComments(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {

                    VersionedPath versionedPath = RegistryUtils.getVersionedPath(resourcePath);
                    ResourceImpl resourceImpl;
                    if (versionedPath.getVersion() == -1) {
                        resourceImpl =
                                commentsDAO.getResourceWithMinimumData(resourcePath.getPath());
                    } else {
                        resourceImpl = (ResourceImpl) versionRepository.getMetaData(versionedPath);
View Full Code Here

                        throw new RegistryException(msg);
                    }

                    resourcePath = processedPath.getPath();

                    ResourceImpl resourceImpl = ratingsDAO.getResourceWithMinimumData(resourcePath);

                    if (resourceImpl != null) {

                        if (!AuthorizationUtils.authorize(resourcePath, ActionConstants.GET)) {
                            String msg =
View Full Code Here

            float rating = registryContext.getHandlerManager().getAverageRating(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {

                    VersionedPath versionedPath = RegistryUtils.getVersionedPath(resourcePath);
                    ResourceImpl resourceImpl;
                    if (versionedPath.getVersion() == -1) {
                        resourceImpl =
                                ratingsDAO.getResourceWithMinimumData(resourcePath.getPath());
                    } else {
                        resourceImpl = (ResourceImpl) versionRepository.getMetaData(versionedPath);
View Full Code Here

            int rating = registryContext.getHandlerManager().getRating(context);
            if (!context.isSimulation()) {
                if (!context.isProcessingComplete()) {

                    VersionedPath versionedPath = RegistryUtils.getVersionedPath(resourcePath);
                    ResourceImpl resourceImpl;
                    if (versionedPath.getVersion() == -1) {
                        resourceImpl =
                                ratingsDAO.getResourceWithMinimumData(resourcePath.getPath());
                    } else {
                        resourceImpl = (ResourceImpl) versionRepository.getMetaData(versionedPath);
View Full Code Here

                resource.addProperty(RegistryConstants.REGISTRY_EXISTING_RESOURCE, "true");
            } else if (oldResource != null) {
                if (oldResource instanceof Collection) {
                    resource = new CollectionImpl();
                } else {
                    resource = new ResourceImpl();
                }
            } else {
                resource = new CollectionImpl();
            }
            resource.addProperty(RegistryConstants.REGISTRY_NON_RECURSIVE, "true");
View Full Code Here

            String path = resourcePath.getPath();
            String tagStr = "";

            ResourceIDImpl resourceIDImpl = resourceDAO.getResourceID(path);
            if (resourceIDImpl != null) {
                ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourceIDImpl);
                if (resourceImpl != null) {
                    String[] tags = tagsDAO.getTags(resourceImpl);
                    StringBuffer sb = new StringBuffer(tagStr);
                    for (String tag : tags) {
                        sb.append(tag);
                    }
                    tagStr = sb.toString();
                }
            }

            ResourceImpl resource = new ResourceImpl();
            resource.setMediaType(RegistryConstants.TAG_MEDIA_TYPE);
            resource.setContent(tagStr);
            resource.setPath(resourcePath.getCompletePath());
            resource.addProperty("resourcePath", path);

            requestContext.setProcessingComplete(true);
            return resource;
        }
View Full Code Here

        ResourcePath resourcePath = requestContext.getResourcePath();

        if (resourcePath.parameterExists("ratings") &&
                resourcePath.getParameterValue("ratings") == null) {
            ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourcePath.getPath());
            String[] ratedUserNames = ratingsDAO.getRatedUserNames(resourceImpl);

            CollectionImpl resource = new CollectionImpl();
            resource.setPath(resourcePath.getCompletePath());
            List<String> ratingPaths = new ArrayList<String>();
View Full Code Here

TOP

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

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.