Package org.apache.wink.common.model.app

Examples of org.apache.wink.common.model.app.AppCategories


            return;
        }

        // Add all categories to ServiceDocument
        for (Categories cats : categories) {
            AppCategories appCategory = new AppCategories();
            if (cats.isOutOfLine()) {
                String href = cats.getHref();
                appCategory.setHref(href);
            } else {
                addInlineCategories(cats, appCategory);
            }
            appCategories.add(appCategory);
        }
View Full Code Here


                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream) throws IOException, WebApplicationException {
        AppCategories catDoc = buildAppCatDoc(categories);
        appCatProvider.writeTo(catDoc, null, null, null, mediaType, httpHeaders, entityStream);
    }
View Full Code Here

        appCatProvider.writeTo(catDoc, null, null, null, mediaType, httpHeaders, entityStream);
    }

    private AppCategories buildAppCatDoc(Categories cats) {

        AppCategories appCategories = new AppCategories();
        List<AtomCategory> categoryList = appCategories.getCategory();

        List<AtomCategory> categories = cats.getCategories();

        for (AtomCategory cat : categories) {
            AtomCategory atomCategory = new AtomCategory();

            String catLabel = cat.getLabel();
            if (catLabel != null) {
                atomCategory.setLabel(catLabel);
            }

            String catScheme = cat.getScheme();
            if (catScheme != null) {
                atomCategory.setScheme(catScheme);
            }

            String catTerm = cat.getTerm();
            if (catTerm != null) {
                atomCategory.setTerm(catTerm);
            }
            categoryList.add(atomCategory);
        }

        String catsScheme = cats.getScheme();
        boolean fixed = cats.isFixed();

        if (catsScheme != null) {
            appCategories.setScheme(catsScheme);
        }
        if (fixed == true) {
            appCategories.setFixed(AppYesNo.YES);
        }

        return appCategories;
    }
View Full Code Here

                        Type genericType,
                        Annotation[] annotations,
                        MediaType mediaType,
                        MultivaluedMap<String, Object> httpHeaders,
                        OutputStream entityStream) throws IOException, WebApplicationException {
        AppCategories catDoc = buildAppCatDoc(categories);
        appCatProvider.writeTo(catDoc, AppCategories.class, AppCategories.class, annotations, mediaType, httpHeaders, entityStream);
    }
View Full Code Here

        appCatProvider.writeTo(catDoc, AppCategories.class, AppCategories.class, annotations, mediaType, httpHeaders, entityStream);
    }

    private AppCategories buildAppCatDoc(Categories cats) {

        AppCategories appCategories = new AppCategories();
        List<AtomCategory> categoryList = appCategories.getCategory();

        List<AtomCategory> categories = cats.getCategories();

        for (AtomCategory cat : categories) {
            AtomCategory atomCategory = new AtomCategory();

            String catLabel = cat.getLabel();
            if (catLabel != null) {
                atomCategory.setLabel(catLabel);
            }

            String catScheme = cat.getScheme();
            if (catScheme != null) {
                atomCategory.setScheme(catScheme);
            }

            String catTerm = cat.getTerm();
            if (catTerm != null) {
                atomCategory.setTerm(catTerm);
            }
            categoryList.add(atomCategory);
        }

        String catsScheme = cats.getScheme();
        boolean fixed = cats.isFixed();

        if (catsScheme != null) {
            appCategories.setScheme(catsScheme);
        }
        if (fixed == true) {
            appCategories.setFixed(AppYesNo.YES);
        }

        return appCategories;
    }
View Full Code Here

            return;
        }

        // Add all categories to ServiceDocument
        for (Categories cats : categories) {
            AppCategories appCategory = new AppCategories();
            if (cats.isOutOfLine()) {
                String href = cats.getHref();
                appCategory.setHref(href);
            } else {
                addInlineCategories(cats, appCategory);
            }
            appCategories.add(appCategory);
        }
View Full Code Here

            + content, diff.similar());
    }

    private static AppCategories buildCategories() {
        // Create CategoriesDocumentResource with Categories data
        AppCategories cats = new AppCategories();
        cats.setScheme("urn:org.apache.wink.example.default.scheme");
        cats.setFixed(AppYesNo.YES);
        // Get category listing for somewhere
        for (int i = 0; i < 4; i++) {
            AtomCategory cb = new AtomCategory();
            cb.setLabel("label" + i);
            cb.setScheme("urn:org.apache.wink.scheme" + i);
            cb.setTerm("term" + i);
            cats.getCategory().add(cb);
        }
        return cats;
    }
View Full Code Here

        AtomJAXBUtils.marshal(m, element, null, os);
        assertEquals(SERVICE_DOCUMENT, os.toString());
    }

    public void testCategories() {
        AppCategories cats = new AppCategories();
        cats.setHref("href");
        try {
            cats.setScheme("scheme");
        } catch (RestException e) {
            assertEquals("cannot mix inline and out-of-line categories attributes", e.getMessage());
        }

        cats = new AppCategories();
        cats.setHref("href");
        try {
            cats.setFixed(AppYesNo.YES);
        } catch (RestException e) {
            assertEquals("cannot mix inline and out-of-line categories attributes", e.getMessage());
        }

        cats = new AppCategories();
        cats.setScheme("scheme");
        cats.setFixed(AppYesNo.YES);
        try {
            cats.setHref("scheme");
        } catch (RestException e) {
            assertEquals("cannot mix inline and out-of-line categories attributes", e.getMessage());
        }

        cats = new AppCategories();
        cats.setHref("href");
        assertFalse(cats.isInline());

        cats = new AppCategories();
        assertFalse(cats.isFixedSet());
        cats.setFixed(AppYesNo.YES);
        assertTrue(cats.isFixedSet());
    }
View Full Code Here

        return col;
    }

    private AppCategories getInlineCategories() {
        AppCategories cats = new AppCategories();
        cats.setScheme("scheme");
        cats.setFixed(AppYesNo.NO);

        AtomCategory cat = new AtomCategory();
        cat.setScheme("scheme1");
        cat.setLabel("label");
        cat.setTerm("term1");
        cats.getCategory().add(cat);

        cat = new AtomCategory();
        cat.setScheme("scheme2");
        cat.setLabel("labe2");
        cat.setTerm("term2");
        cats.getCategory().add(cat);
        return cats;
    }
View Full Code Here

        cats.getCategory().add(cat);
        return cats;
    }

    private AppCategories getOutOfLineCategories() {
        AppCategories cats = new AppCategories();
        cats.setHref("href");
        return cats;
    }
View Full Code Here

TOP

Related Classes of org.apache.wink.common.model.app.AppCategories

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.