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

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


        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());
        UriBuilder builder = uriInfo.getBaseUriBuilder();
        ret.setRefLink(
                builder.path("/packages/" + a.getPackage().getName() + "/assets/" + a.getName()).build());
        builder = uriInfo.getBaseUriBuilder();
        ret.setBinaryLink(
                builder.path("/packages/" + a.getPackage().getName() + "/assets/" + a.getName() + "/binary").build());
        builder = uriInfo.getBaseUriBuilder();
        ret.setSourceLink(
                builder.path("/packages/" + a.getPackage().getName() + "/assets/" + a.getName() + "/source").build());
        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

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

        Asset ret = new Asset();
        ret.setMetadata(metadata);
        ret.setCheckInComment(a.getCheckinComment());
        ret.setDescription(a.getDescription());
        ret.setRefLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}")
                .build(a.getModule().getName(), a.getName()));
        ret.setBinaryLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}/binary")
                .build(a.getModule().getName(), a.getName()));
        ret.setSourceLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}/source")
                .build(a.getModule().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

        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.setTitle(a.getTitle());
        ret.setBinaryContentAttachmentFileName(a.getBinaryContentAttachmentFileName());
        ret.setPublished(a.getLastModified().getTime());
        ret.setAuthor(a.getLastContributor());
        ret.setMetadata(metadata);
        ret.setDescription(a.getDescription());
        ret.setRefLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}")
                .build(a.getModule().getName(), a.getName()));
        ret.setBinaryLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}/binary")
                .build(a.getModule().getName(), a.getName()));
        ret.setSourceLink(uriInfo.getBaseUriBuilder()
                .path("/packages/{packageName}/assets/{assetName}/source")
                .build(a.getModule().getName(), a.getName()));
        return ret;
    }
View Full Code Here

        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

        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.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.