Java Code Examples for org.fourthline.cling.support.model.item.Item#getParentID()

The following examples show how to use org.fourthline.cling.support.model.item.Item#getParentID() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DIDLParser.java    From TVRemoteIME with GNU General Public License v2.0 4 votes vote down vote up
protected void generateItem(Item item, Document descriptor, Element parent) {

        if (item.getClazz() == null) {
            throw new RuntimeException("Missing 'upnp:class' element for item: " + item.getId());
        }

        Element itemElement = appendNewElement(descriptor, parent, "item");

        if (item.getId() == null)
            throw new NullPointerException("Missing id on item: " + item);
        itemElement.setAttribute("id", item.getId());

        if (item.getParentID() == null)
            throw new NullPointerException("Missing parent id on item: " + item);
        itemElement.setAttribute("parentID", item.getParentID());

        if (item.getRefID() != null)
            itemElement.setAttribute("refID", item.getRefID());
        itemElement.setAttribute("restricted", booleanToInt(item.isRestricted()));

        String title = item.getTitle();
        if (title == null) {
            log.warning("Missing 'dc:title' element for item: " + item.getId());
            title = UNKNOWN_TITLE;
        }

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "dc:title",
                title,
                DIDLObject.Property.DC.NAMESPACE.URI
        );

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "dc:creator",
                item.getCreator(),
                DIDLObject.Property.DC.NAMESPACE.URI
        );

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "upnp:writeStatus",
                item.getWriteStatus(),
                DIDLObject.Property.UPNP.NAMESPACE.URI
        );

        appendClass(descriptor, itemElement, item.getClazz(), "upnp:class", false);

        appendProperties(descriptor, itemElement, item, "upnp", DIDLObject.Property.UPNP.NAMESPACE.class, DIDLObject.Property.UPNP.NAMESPACE.URI);
        appendProperties(descriptor, itemElement, item, "dc", DIDLObject.Property.DC.NAMESPACE.class, DIDLObject.Property.DC.NAMESPACE.URI);
        appendProperties(descriptor, itemElement, item, "sec", DIDLObject.Property.SEC.NAMESPACE.class, DIDLObject.Property.SEC.NAMESPACE.URI);

        for (Res resource : item.getResources()) {
            if (resource == null) continue;
            generateResource(resource, descriptor, itemElement);
        }

        for (DescMeta descMeta : item.getDescMetadata()) {
            if (descMeta == null) continue;
            generateDescMetadata(descMeta, descriptor, itemElement);
        }
    }
 
Example 2
Source File: DIDLParser.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected void generateItem(Item item, Document descriptor, Element parent) {

        if (item.getClazz() == null) {
            throw new RuntimeException("Missing 'upnp:class' element for item: " + item.getId());
        }

        Element itemElement = appendNewElement(descriptor, parent, "item");

        if (item.getId() == null)
            throw new NullPointerException("Missing id on item: " + item);
        itemElement.setAttribute("id", item.getId());

        if (item.getParentID() == null)
            throw new NullPointerException("Missing parent id on item: " + item);
        itemElement.setAttribute("parentID", item.getParentID());

        if (item.getRefID() != null)
            itemElement.setAttribute("refID", item.getRefID());
        itemElement.setAttribute("restricted", booleanToInt(item.isRestricted()));

        String title = item.getTitle();
        if (title == null) {
            log.warning("Missing 'dc:title' element for item: " + item.getId());
            title = UNKNOWN_TITLE;
        }

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "dc:title",
                title,
                DIDLObject.Property.DC.NAMESPACE.URI
        );

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "dc:creator",
                item.getCreator(),
                DIDLObject.Property.DC.NAMESPACE.URI
        );

        appendNewElementIfNotNull(
                descriptor,
                itemElement,
                "upnp:writeStatus",
                item.getWriteStatus(),
                DIDLObject.Property.UPNP.NAMESPACE.URI
        );

        appendClass(descriptor, itemElement, item.getClazz(), "upnp:class", false);

        appendProperties(descriptor, itemElement, item, "upnp", DIDLObject.Property.UPNP.NAMESPACE.class, DIDLObject.Property.UPNP.NAMESPACE.URI);
        appendProperties(descriptor, itemElement, item, "dc", DIDLObject.Property.DC.NAMESPACE.class, DIDLObject.Property.DC.NAMESPACE.URI);
        appendProperties(descriptor, itemElement, item, "sec", DIDLObject.Property.SEC.NAMESPACE.class, DIDLObject.Property.SEC.NAMESPACE.URI);

        for (Res resource : item.getResources()) {
            if (resource == null) continue;
            generateResource(resource, descriptor, itemElement);
        }

        for (DescMeta descMeta : item.getDescMetadata()) {
            if (descMeta == null) continue;
            generateDescMetadata(descMeta, descriptor, itemElement);
        }
    }
 
Example 3
Source File: GenerateXml.java    From DroidDLNA with GNU General Public License v3.0 4 votes vote down vote up
protected void generateItem(Item item, Document descriptor, Element parent) {

		if (item.getClazz() == null) {
			throw new RuntimeException(
					"Missing 'upnp:class' element for item: " + item.getId());
		}

		Element itemElement = appendNewElement(descriptor, parent, "item");

		if (item.getId() == null)
			throw new NullPointerException("Missing id on item: " + item);
		itemElement.setAttribute("id", item.getId());

		if (item.getParentID() == null)
			throw new NullPointerException("Missing parent id on item: " + item);
		itemElement.setAttribute("parentID", item.getParentID());

		if (item.getRefID() != null)
			itemElement.setAttribute("refID", item.getRefID());
		itemElement.setAttribute("restricted",
				booleanToInt(item.isRestricted()));

		String title = item.getTitle();
		if (title == null) {
			log.warning("Missing 'dc:title' element for item: " + item.getId());
			title = UNKNOWN_TITLE;
		}

		appendNewElementIfNotNull(descriptor, itemElement, "dc:title", title,
				DIDLObject.Property.DC.NAMESPACE.URI);

		appendNewElementIfNotNull(descriptor, itemElement, "dc:creator",
				item.getCreator(), DIDLObject.Property.DC.NAMESPACE.URI);

		appendNewElementIfNotNull(descriptor, itemElement, "upnp:writeStatus",
				item.getWriteStatus(), DIDLObject.Property.UPNP.NAMESPACE.URI);

		appendClass(descriptor, itemElement, item.getClazz(), "upnp:class",
				false);

		appendProperties(descriptor, itemElement, item, "upnp",
				DIDLObject.Property.UPNP.NAMESPACE.class,
				DIDLObject.Property.UPNP.NAMESPACE.URI);
		appendProperties(descriptor, itemElement, item, "dc",
				DIDLObject.Property.DC.NAMESPACE.class,
				DIDLObject.Property.DC.NAMESPACE.URI);
		appendProperties(descriptor, itemElement, item, "sec",
				DIDLObject.Property.SEC.NAMESPACE.class,
				DIDLObject.Property.SEC.NAMESPACE.URI);

		for (Res resource : item.getResources()) {
			if (resource == null)
				continue;
			generateResource(resource, descriptor, itemElement);
		}

		for (DescMeta descMeta : item.getDescMetadata()) {
			if (descMeta == null)
				continue;
			generateDescMetadata(descMeta, descriptor, itemElement);
		}
	}