Package org.apache.ace.client.repository

Examples of org.apache.ace.client.repository.RepositoryObject


            if (ARTIFACT2FEATURE.equals(entityType) || FEATURE2DISTRIBUTION.equals(entityType) || DISTRIBUTION2TARGET.equals(entityType)) {

                String leftAttribute = attributes.get("left");
                String rightAttribute = attributes.get("right");

                RepositoryObject left = null;
                if(leftAttribute != null) {
                    left = getLeft(entityType, leftAttribute);
                }

                RepositoryObject right = null;
                if(rightAttribute != null) {
                    right = getRight(entityType, rightAttribute);
                }


                if (left != null) {
                    if (left instanceof StatefulTargetObject) {
                        if (((StatefulTargetObject) left).isRegistered()) {
                            attributes.put("leftEndpoint", ((StatefulTargetObject) left).getTargetObject().getAssociationFilter(attributes));
                        }
                    }
                    else {
                        attributes.put("leftEndpoint", left.getAssociationFilter(attributes));
                    }
                }
                if (right != null) {
                    if (right instanceof StatefulTargetObject) {
                        if (((StatefulTargetObject) right).isRegistered()) {
                            attributes.put("rightEndpoint", ((StatefulTargetObject) right).getTargetObject().getAssociationFilter(attributes));
                        }
                    }
                    else {
                        attributes.put("rightEndpoint", right.getAssociationFilter(attributes));
                    }
                }
            }
            return getObjectRepository(entityType).create(attributes, tags);
        }
View Full Code Here


        targetObject.register();
        return targetObject;
    }
   
    public void updateObjectWithData(String entityType, String entityId, RepositoryValueObject valueObject) {
        RepositoryObject repositoryObject = getRepositoryObject(entityType, entityId);
        // first handle the attributes
        for (Entry<String, String> attribute : valueObject.attributes.entrySet()) {
            String key = attribute.getKey();
            String value = attribute.getValue();
            // only add/update the attribute if it actually changed
            if (!value.equals(repositoryObject.getAttribute(key))) {
                repositoryObject.addAttribute(key, value);
            }
        }
        Enumeration<String> keys = repositoryObject.getAttributeKeys();
        while (keys.hasMoreElements()) {
            String key = keys.nextElement();
            if (!valueObject.attributes.containsKey(key)) {
                // TODO since we cannot remove keys right now, we null them
                repositoryObject.addAttribute(key, null);
            }
        }
        if (ARTIFACT2FEATURE.equals(entityType) || FEATURE2DISTRIBUTION.equals(entityType) || DISTRIBUTION2TARGET.equals(entityType)) {
            String leftAttribute = repositoryObject.getAttribute("left");
            String rightAttribute = repositoryObject.getAttribute("right");

            RepositoryObject left = null;
            if (leftAttribute != null) {
                left = getLeft(entityType, leftAttribute);
            }

            RepositoryObject right = null;
            if (rightAttribute != null) {
                right = getRight(entityType, rightAttribute);
            }

            if (left != null) {
                if (left instanceof StatefulTargetObject) {
                    if (((StatefulTargetObject) left).isRegistered()) {
                        repositoryObject.addAttribute("leftEndpoint", ((StatefulTargetObject) left).getTargetObject().getAssociationFilter(getAttributes(((StatefulTargetObject) left).getTargetObject())));
                    }
                }
                else {
                    repositoryObject.addAttribute("leftEndpoint", left.getAssociationFilter(getAttributes(left)));
                }
            }
            if (right != null) {
                if (right instanceof StatefulTargetObject) {
                    if (((StatefulTargetObject) right).isRegistered()) {
                        repositoryObject.addAttribute("rightEndpoint", ((StatefulTargetObject) right).getTargetObject().getAssociationFilter(getAttributes(((StatefulTargetObject) right).getTargetObject())));
                    }
                }
                else {
                    repositoryObject.addAttribute("rightEndpoint", right.getAssociationFilter(getAttributes(right)));
                }
            }
        }
        // now handle the tags in a similar way
        for (Entry<String, String> attribute : valueObject.tags.entrySet()) {
View Full Code Here

        return null;
    }
   
    public void deleteRepositoryObject(String entityType, String entityId) {
        ObjectRepository objectRepository = getObjectRepository(entityType);
        RepositoryObject repositoryObject = objectRepository.get(entityId);
        // ACE-239: avoid null entities being passed in...
        if (repositoryObject == null) {
            throw new IllegalArgumentException("Could not find repository object!");
        }
View Full Code Here

     * @param resp the servlet response to write the response data to.
     * @throws IOException in case of I/O errors.
     */
    private void createRepositoryObject(Workspace workspace, String entityType, RepositoryValueObject data, HttpServletRequest req, HttpServletResponse resp) throws IOException {
        try {
            RepositoryObject object = workspace.addRepositoryObject(entityType, data.attributes, data.tags);

            resp.sendRedirect(req.getServletPath() + "/" + buildPathFromElements(WORK_FOLDER, workspace.getSessionID(), entityType, object.getDefinition()));
        }
        catch (IllegalArgumentException e) {
            m_logger.log(LogService.LOG_WARNING, "Failed to add entity of type: " + entityType, e);
            resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Could not add entity of type " + entityType);
        }
View Full Code Here

     * @param req the servlet request to read the request data from;
     * @param resp the servlet response to write the response data to.
     * @throws IOException
     */
    private void handleWorkspaceAction(Workspace workspace, String entityType, String entityId, String action, HttpServletRequest req, HttpServletResponse resp) throws IOException {
        RepositoryObject repositoryObject = workspace.getRepositoryObject(entityType, entityId);
        if (repositoryObject == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Repository object of type " + entityType + " and identity " + entityId + " not found.");
            return;
        }

View Full Code Here

     * @param action the (name of the) action to apply;
     * @param resp the servlet response to write the response data to.
     * @throws IOException in case of I/O errors.
     */
    private void performWorkspaceAction(Workspace workspace, String entityType, String entityId, String action, HttpServletResponse resp) throws IOException {
        RepositoryObject repositoryObject = workspace.getRepositoryObject(entityType, entityId);
        if (repositoryObject == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Repository object of type " + entityType + " and identity " + entityId + " not found.");
            return;
        }

View Full Code Here

     * @param entityId the identifier of the repository object to read;
     * @param resp the servlet response to write the response data to.
     * @throws IOException in case of I/O problems.
     */
    private void readRepositoryObject(Workspace workspace, String entityType, String entityId, HttpServletResponse resp) throws IOException {
        RepositoryObject repositoryObject = workspace.getRepositoryObject(entityType, entityId);
        if (repositoryObject == null) {
            resp.sendError(HttpServletResponse.SC_NOT_FOUND, "Repository object of type " + entityType + " and identity " + entityId + " not found.");
        }
        else {
            resp.getWriter().println(m_gson.toJson(repositoryObject));
View Full Code Here

    /**
     * {@inheritDoc}
     */
    public Component create(Map<String, Object> context) {
        final RepositoryObject sgo = getRepositoryObjectFromContext(context);

        Component editor;
        if (sgo instanceof StatefulTargetObject) {
            StatefulTargetObject statefulTarget = (StatefulTargetObject) sgo;
            if (statefulTarget.isRegistered()) {
View Full Code Here

        result.setMargin(true);
        result.setSpacing(true);
        result.setSizeFull();

        RepositoryObject object = getRepositoryObjectFromContext(context);
        if (!(object instanceof StatefulTargetObject)) {
            result.addComponent(new Label("This target is not a stateful gateway object."));
            return result;
        }
View Full Code Here

     * @param resp the servlet response to write the response data to.
     * @throws IOException in case of I/O errors.
     */
    private void createRepositoryObject(Workspace workspace, String entityType, RepositoryValueObject data, HttpServletRequest req, HttpServletResponse resp) throws IOException {
        try {
            RepositoryObject object = workspace.createRepositoryObject(entityType, data.attributes, data.tags);

            resp.sendRedirect(req.getServletPath() + "/" + buildPathFromElements(WORK_FOLDER, workspace.getSessionID(), entityType, object.getDefinition()));
        }
        catch (IllegalArgumentException e) {
            m_logger.log(LogService.LOG_WARNING, "Failed to add entity of type: " + entityType + " with data: " + data);
            resp.sendError(HttpServletResponse.SC_BAD_REQUEST, "Could not add entity of type " + entityType + " with data: " + data);
        }
View Full Code Here

TOP

Related Classes of org.apache.ace.client.repository.RepositoryObject

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.