Package com.microsoft.windowsazure.services.media.implementation.atom

Examples of com.microsoft.windowsazure.services.media.implementation.atom.ContentType


    @SuppressWarnings({ "unchecked", "rawtypes" })
    protected ODataEntity(T content) {
        this.content = content;

        ContentType contentElement = new ContentType();
        contentElement.getContent().add(
                new JAXBElement(Constants.ODATA_PROPERTIES_ELEMENT_NAME,
                        content.getClass(), content));
        entry = new EntryType();
        entry.getEntryChildren().add(
                new JAXBElement(Constants.ATOM_CONTENT_ELEMENT_NAME,
View Full Code Here


                stream);
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    private JAXBElement<EntryType> createEntry(Object content) {
        ContentType atomContent = new ContentType();
        EntryType atomEntry = new EntryType();

        atomContent.setType("application/xml");
        atomContent.getContent().add(
                new JAXBElement(new QName(Constants.ODATA_METADATA_NS,
                        "properties"), content.getClass(), content));

        atomEntry.getEntryChildren().add(
                new JAXBElement(new QName(Constants.ATOM_NS, "content"),
View Full Code Here

        return this.verb;
    }

    @SuppressWarnings({ "unchecked", "rawtypes" })
    public EntityBatchOperation addContentObject(Object contentObject) {
        ContentType atomContent = new ContentType();
        atomContent.setType("application/xml");
        atomContent
                .getContent()
                .add(new JAXBElement(new QName(Constants.ODATA_METADATA_NS,
                        "properties"), contentObject.getClass(), contentObject));

        this.entryType.getEntryChildren().add(
View Full Code Here

        MediaProcessorType payload = new MediaProcessorType().setId("DummyId")
                .setName("Dummy Name").setVersion("0.0.0").setVendor("Contoso")
                .setSku("sku skiddo").setDescription("For testing links only");

        ContentType contentElement = new ContentType();
        contentElement.getContent().add(
                new JAXBElement<MediaProcessorType>(
                        Constants.ODATA_PROPERTIES_ELEMENT_NAME,
                        MediaProcessorType.class, payload));

        entry.getEntryChildren().add(
View Full Code Here

        entry.getEntryChildren().add(linkElement);
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    private ContentType addEntryContent(EntryType entry, Object content) {
        ContentType contentWrapper = new ContentType();
        contentWrapper.getContent().add(
                new JAXBElement(Constants.ODATA_PROPERTIES_ELEMENT_NAME,
                        content.getClass(), content));

        entry.getEntryChildren().add(
                new JAXBElement<ContentType>(
View Full Code Here

        for (Object child : entryType.getEntryChildren()) {
            if (child instanceof JAXBElement) {
                @SuppressWarnings("rawtypes")
                JAXBElement element = (JAXBElement) child;
                if (element.getDeclaredType() == ContentType.class) {
                    ContentType contentType = (ContentType) element.getValue();
                    for (Object grandChild : contentType.getContent()) {
                        if (grandChild instanceof JAXBElement) {
                            @SuppressWarnings("rawtypes")
                            JAXBElement contentElement = (JAXBElement) grandChild;
                            TaskType taskType = (TaskType) contentElement
                                    .getValue();
View Full Code Here

        JAXBContext context = JAXBContext.newInstance(EntryType.class,
                AssetType.class);
        Marshaller m = context.createMarshaller();

        EntryType e = new EntryType();
        ContentType c = new ContentType();
        c.getContent().add(
                new JAXBElement(Constants.ODATA_PROPERTIES_ELEMENT_NAME,
                        AssetType.class, a));
        e.getEntryChildren().add(
                new JAXBElement(Constants.ATOM_CONTENT_ELEMENT_NAME,
                        ContentType.class, c));
View Full Code Here

        entry.getEntryChildren().add(linkElement);
    }

    @SuppressWarnings({ "rawtypes", "unchecked" })
    private ContentType addEntryContent(EntryType entry, Object content) {
        ContentType contentWrapper = new ContentType();
        contentWrapper.getContent().add(
                new JAXBElement(Constants.ODATA_PROPERTIES_ELEMENT_NAME,
                        content.getClass(), content));

        entry.getEntryChildren().add(
                new JAXBElement<ContentType>(
View Full Code Here

    @SuppressWarnings("rawtypes")
    private <T extends ODataEntity> T contentFromEntry(Class<T> contentType,
            Class<?> marshallingContentType, EntryType entry)
            throws JAXBException, ServiceException {
        unmarshalODataContent(entry, contentType);
        ContentType contentElement = getFirstOfType(ContentType.class,
                entry.getEntryChildren());
        Object contentObject = getFirstOfType(marshallingContentType,
                contentElement.getContent());
        return constructResultObject(contentType, entry, contentObject);
    }
View Full Code Here

    @SuppressWarnings("rawtypes")
    private void unmarshalEntryContent(EntryType entry, Class<?> contentType)
            throws JAXBException {
        Class<?> marshallingContentType = getMarshallingContentType(contentType);
        ContentType contentElement = getFirstOfType(ContentType.class,
                entry.getEntryChildren());
        List<Object> contentChildren = contentElement.getContent();
        for (int i = 0; i < contentChildren.size(); ++i) {
            Object child = contentChildren.get(i);
            if (child instanceof Element) {
                Element e = (Element) child;
                if (qnameFromElement(e).equals(
View Full Code Here

TOP

Related Classes of com.microsoft.windowsazure.services.media.implementation.atom.ContentType

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.