Package org.drools.guvnor.server.jaxrs.jaxb

Examples of org.drools.guvnor.server.jaxrs.jaxb.Asset


        ret.setVersion(p.getVersionNumber());
        Iterator<AssetItem> iter = p.getAssets();
        Set<URI> assets = new HashSet<URI>();
        while (iter.hasNext()) {
            AssetItem a = iter.next();
            Asset asset = ToAsset(a, uriInfo);
            assets.add(asset.getRefLink());
        }

        ret.setAssets(assets);
        return ret;
    }
View Full Code Here


    @GET
    @Path("{packageName}/assets/{assetName}")
    @Produces({MediaType.APPLICATION_JSON, MediaType.APPLICATION_XML})
    public Asset getAssetAsJaxB(@PathParam ("packageName") String packageName, @PathParam("assetName") String assetName) {
        Asset ret = null;
        PackageItem item = repository.loadPackage(packageName);
        Iterator<AssetItem> iter = item.getAssets();
        while (iter.hasNext()) {
            AssetItem a = iter.next();
            if (a.getName().equals(assetName)) {
View Full Code Here

        assertEquals (200, connection.getResponseCode());

        BufferedReader br = new BufferedReader(new InputStreamReader(connection.getInputStream()));
        JAXBContext context = JAXBContext.newInstance(Asset.class);
        Unmarshaller un = context.createUnmarshaller();
        Asset a = (Asset) un.unmarshal(br);
        a.setDescription("An updated description.");
        a.getMetadata().setLastModified(new Date(System.currentTimeMillis()));
        connection.disconnect();

        HttpURLConnection conn2 = (HttpURLConnection)url.openConnection();
        Marshaller ma = context.createMarshaller();
        conn2.setRequestMethod("PUT");
        conn2.setRequestProperty("Content-Type", MediaType.APPLICATION_XML);
        conn2.setRequestProperty("Content-Length", Integer.toString(a.toString().getBytes().length));
        conn2.setUseCaches (false);
        conn2.setDoInput(true);
        conn2.setDoOutput(true);
        ma.marshal(a, conn2.getOutputStream());
        assertEquals (200, connection.getResponseCode());
View Full Code Here

        int counter = 0;
        for (CategoryItem c : categories) {
            cats[counter++] = c.getName();
        }

        Asset ret = new Asset();
        ret.setMetadata(metadata);
        ret.setType(a.getType());
        ret.setCheckInComment(a.getCheckinComment());
        ret.setDescription(a.getDescription());
        ret.setRefLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}")
                .build(a.getPackage().getName(), a.getName()));
        ret.setBinaryLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}/binary")
                .build(a.getPackage().getName(), a.getName()));
        ret.setSourceLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}/source")
                .build(a.getPackage().getName(), a.getName()));
        ret.setVersion(a.getVersionNumber());
        return ret;
    }
View Full Code Here

        ret.setVersion(p.getVersionNumber());
        Iterator<AssetItem> iter = p.getAssets();
        Set<URI> assets = new HashSet<URI>();
        while (iter.hasNext()) {
            AssetItem a = iter.next();
            Asset asset = toAsset(a, uriInfo);
            assets.add(asset.getRefLink());
        }

        ret.setAssets(assets);
        return ret;
    }
View Full Code Here

TOP

Related Classes of org.drools.guvnor.server.jaxrs.jaxb.Asset

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.