Content of file DIDLAdapterSupport.java.html

<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"><html xmlns="http://www.w3.org/1999/xhtml" lang="en"><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/><link rel="stylesheet" href="../../jacoco-resources/report.css" type="text/css"/><link rel="shortcut icon" href="../../jacoco-resources/report.gif" type="image/gif"/><title>DIDLAdapterSupport.java</title><link rel="stylesheet" href="../../jacoco-resources/prettify.css" type="text/css"/><script type="text/javascript" src="../../jacoco-resources/prettify.js"></script></head><body onload="window['PR_TAB_WIDTH']=4;prettyPrint()"><div class="breadcrumb" id="breadcrumb"><span class="info"><a href="../../jacoco-sessions.html" class="el_session">Sessions</a></span><a href="../../index.html" class="el_report">blueMarine II :: Application :: JavaFX</a> &gt; <a href="../index.html" class="el_bundle">it-tidalwave-bluemarine2-upnp-mediaserver</a> &gt; <a href="index.source.html" class="el_package">it.tidalwave.bluemarine2.upnp.mediaserver.impl.didl</a> &gt; <span class="el_source">DIDLAdapterSupport.java</span></div><h1>DIDLAdapterSupport.java</h1><pre class="source lang-java linenums">/*
 * *********************************************************************************************************************
 *
 * blueMarine II: Semantic Media Centre
 * http://tidalwave.it/projects/bluemarine2
 *
 * Copyright (C) 2015 - 2021 by Tidalwave s.a.s. (http://tidalwave.it)
 *
 * *********************************************************************************************************************
 *
 * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
 * an &quot;AS IS&quot; BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations under the License.
 *
 * *********************************************************************************************************************
 *
 * git clone https://bitbucket.org/tidalwave/bluemarine2-src
 * git clone https://github.com/tidalwave-it/bluemarine2-src
 *
 * *********************************************************************************************************************
 */
package it.tidalwave.bluemarine2.upnp.mediaserver.impl.didl;

import javax.annotation.Nonnull;
import java.util.Collections;
import org.fourthline.cling.support.model.DIDLObject;
import org.fourthline.cling.support.model.container.Container;
import it.tidalwave.util.As;
import it.tidalwave.bluemarine2.rest.spi.ResourceServer;
import lombok.RequiredArgsConstructor;
import static it.tidalwave.role.Identifiable._Identifiable_;
import static it.tidalwave.role.SimpleComposite._SimpleComposite_;
import static it.tidalwave.role.ui.Displayable._Displayable_;
import static it.tidalwave.bluemarine2.upnp.mediaserver.impl.UpnpUtilities.externalized;

/***********************************************************************************************************************
 *
 * @author  Fabrizio Giudici
 *
 **********************************************************************************************************************/
<span class="fc" id="L46">@RequiredArgsConstructor</span>
public abstract class DIDLAdapterSupport&lt;T extends As&gt; implements DIDLAdapter
  {
    @Nonnull
    protected final T datum;

    @Nonnull
    protected final ResourceServer server;

    /*******************************************************************************************************************
     *
     *
     *
     ******************************************************************************************************************/
    protected &lt;D extends DIDLObject&gt; D setCommonFields (@Nonnull final D didlObject)
      {
<span class="fc" id="L62">        didlObject.setRestricted(false);</span>
<span class="fc" id="L63">        didlObject.setCreator(&quot;blueMarine II&quot;); // FIXME</span>
<span class="fc" id="L64"> datum.maybeAs(_Identifiable_).ifPresent(identifiable -&gt; didlObject.setId(externalized(identifiable.getId().stringValue())));</span> <span class="fc" id="L65"> datum.maybeAs(_Displayable_).map(displayable -&gt; didlObject.setTitle(displayable.getDisplayName()));</span> <span class="fc bfc" id="L67" title="All 2 branches covered."> if (didlObject instanceof Container)</span> { <span class="fc" id="L69"> final Container container = (Container)didlObject;</span> <span class="fc" id="L70"> datum.maybeAs(_SimpleComposite_).ifPresent(c -&gt; container.setChildCount(c.findChildren().count()));</span> <span class="fc" id="L71"> container.setItems(Collections.emptyList());</span> } <span class="fc" id="L74"> return didlObject;</span> } } </pre><div class="footer"><span class="right">Created with <a href="http://www.jacoco.org/jacoco">JaCoCo</a> 0.8.7.202105040129</span></div></body></html>