Package org.apache.wink.example.qadefect.legacy

Examples of org.apache.wink.example.qadefect.legacy.DefectBean


                && row[2].equals("Severity")
                && row[3].equals("Status")
                && row[4].equals("Author")) {
                continue;
            }
            DefectBean defect = new DefectBean();
            defect.setId(row[0]);
            defect.setName(row[1]);
            defect.setSeverity(row[2]);
            defect.setStatus(row[3]);
            defect.setAuthor(row[4]);
            defects.add(defect);
        }
    }
View Full Code Here


        // so we need to guess it
        body = body.trim();
        DefectAsset asset = new DefectAsset();
        if (body.startsWith("<defect")) {
            // read the incoming entity as xml
            DefectBean defect =
                ProviderUtils.readFromString(providers,
                                             body,
                                             DefectBean.class,
                                             MediaType.APPLICATION_XML_TYPE);
            asset.setDefect(defect);
View Full Code Here

        }

        // add the defect to the defects store and set it a new ID
        DataStore store = DataStore.getInstance();
        String id = store.getDefectUniqueId();
        DefectBean defect = asset.getDefect();
        defect.setId(id);
        store.putDefect(id, defect);

        // return the defect and set the status code to created (201)
        URI location = uriInfo.getAbsolutePathBuilder().segment(id).build();
        return Response.created(location).entity(asset).build();
View Full Code Here

        MediaType.APPLICATION_XML, MediaType.TEXT_HTML})
    public DefectAsset getDefect(@PathParam("defect") String defectId) {
        // fetch the defect bean from the store, throw 404 in case it does not
        // exist
        DataStore store = DataStore.getInstance();
        DefectBean defect = store.getDefect(defectId);
        if (defect == null) {
            logger.info("Defect {} does not exist", defectId);
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }
View Full Code Here

    public InputStream getDefectAttachement(@PathParam("defect") String defectId) {

        DataStore store = DataStore.getInstance();

        // create data object (populated with store data)
        DefectBean defect = store.getDefect(defectId);
        if (defect == null) {
            logger.info("Defect {} does not exist", defectId);
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        String path = defect.getPathToAttachment();
        if (path == null) {
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        InputStream attachmentStream =
View Full Code Here

                                    @Context LinkBuilders linkProcessor,
                                    @PathParam("defect") String defectId) {

        DataStore store = DataStore.getInstance();
        // verify Defect exist in the store, return 404 otherwise
        DefectBean bean = store.getDefect(defectId);
        if (bean == null) {
            logger.info("Defect {} does not exist", defectId);
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        // set Id in the resources data for cases that element <id> is missing
        // in the request body
        DefectBean defect = asset.getDefect();
        defect.setId(defectId);

        // update defect legacy bean to the store
        store.putDefect(defectId, defect);
        return asset;
    }
View Full Code Here

    @DELETE
    @Produces( {MediaType.APPLICATION_ATOM_XML, MediaType.APPLICATION_JSON,
        MediaType.APPLICATION_XML})
    public DefectAsset deleteDefect(@PathParam("defect") String defectId) {
        DataStore store = DataStore.getInstance();
        DefectBean defect = store.getDefect(defectId);
        store.removeDefect(defectId);
        return new DefectAsset(defect);
    }
View Full Code Here

        // initialize memory store
        DataStore store = DataStore.getInstance();

        // create data object (populated with store data)
        DefectBean defect = store.getDefect(defectId);
        if (defect == null) {
            logger.error("Defect {} was not found", defectId);
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }

        List<TestBean> tests = defect.getTests();
        if (tests == null || tests.isEmpty()) {
            logger.error("Defect {} has not tests", defectId);
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }
View Full Code Here

        }

        // add the defect to the defects store and set it a new ID
        DataStore store = DataStore.getInstance();
        String id = store.getDefectUniqueId();
        DefectBean defect = asset.getDefect();
        defect.setId(id);
        store.putDefect(id, defect);

        // return the defect and set the status code to created (201)
        URI location = uriInfo.getAbsolutePathBuilder().segment(id).build();
        return Response.created(location).entity(asset).build();
View Full Code Here

        MediaType.APPLICATION_XML, MediaType.TEXT_HTML})
    public DefectAsset getDefect(@PathParam("defect") String defectId) {
        // fetch the defect bean from the store, throw 404 in case it does not
        // exist
        DataStore store = DataStore.getInstance();
        DefectBean defect = store.getDefect(defectId);
        if (defect == null) {
            logger.info("Defect {} does not exist", defectId);
            throw new WebApplicationException(Response.Status.NOT_FOUND);
        }
View Full Code Here

TOP

Related Classes of org.apache.wink.example.qadefect.legacy.DefectBean

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.