private String getBroadcastDate(JsonArray broadcastArray) {
        String broadcastDate = "";
        String broadcastBeginFirst = "";
        String broadcastBeginMajor = "";
        String broadcastBeginMinor = "";

        // nach Priorität der BroadcastTypen den relevanten Eintrag suchen
        // FIRST_BROADCAST => MAJOR_REBROADCAST => MINOR_REBROADCAST
        // dabei die "aktuellste" Ausstrahlung verwenden
        for(int i = 0; i < broadcastArray.size(); i++) {
            JsonObject broadcastObject = broadcastArray.get(i).getAsJsonObject();

            if(broadcastObject.has(JSON_ELEMENT_BROADCASTTYPE) && 
                    broadcastObject.has(JSON_ELEMENT_BROADCAST)) {
                String value = this.getBroadcastDateConsideringCatchupRights(broadcastObject);

                if(!value.isEmpty()) {
                    String type = broadcastObject.get(JSON_ELEMENT_BROADCASTTYPE).getAsString();
                    switch(type) {
                        case BROADCASTTTYPE_FIRST:
                            broadcastBeginFirst = value;
                            break;
                        case BROADCASTTTYPE_MAJOR_RE:
                            broadcastBeginMajor = value;
                            break;
                        case BROADCASTTTYPE_MINOR_RE:
                            broadcastBeginMinor = value;
                            break;
                        default:
                            LOG.debug("New broadcasttype: " + type);
                    }
                }
            }
        }

        if(!broadcastBeginFirst.isEmpty()) {
            broadcastDate = broadcastBeginFirst;
        } else if(!broadcastBeginMajor.isEmpty()) {
            broadcastDate = broadcastBeginMajor;
        } else if(!broadcastBeginMinor.isEmpty()) {
            broadcastDate = broadcastBeginMinor;
        }

        // wenn kein Ausstrahlungsdatum vorhanden, dann die erste Ausstrahlung nehmen
        // egal, wann die CatchupRights liegen, damit ein "sinnvolles" Datum vorhanden ist
        if(broadcastDate.isEmpty()) {
            broadcastDate = getBroadcastDateIgnoringCatchupRights(broadcastArray, BROADCASTTTYPE_FIRST);
        }        
        // wenn immer noch leer, dann die Major-Ausstrahlung verwenden
        if(broadcastDate.isEmpty()) {
            broadcastDate = getBroadcastDateIgnoringCatchupRights(broadcastArray, BROADCASTTTYPE_MAJOR_RE);
        }        
        
        return broadcastDate;
    }
private String getBroadcastDate ( JsonArray broadcastArray ) { String broadcastDate = "" ; String broadcastBeginFirst = "" ; String broadcastBeginMajor = "" ; String broadcastBeginMinor = "" ; for ( int i = 0 ; i < broadcastArray . size ( ) ; i ++ ) { JsonObject broadcastObject = broadcastArray . get ( i ) . getAsJsonObject ( ) ; if ( broadcastObject . has ( JSON_ELEMENT_BROADCASTTYPE ) && broadcastObject . has ( JSON_ELEMENT_BROADCAST ) ) { String value = this . getBroadcastDateConsideringCatchupRights ( broadcastObject ) ; if ( ! value . isEmpty ( ) ) { String type = broadcastObject . get ( JSON_ELEMENT_BROADCASTTYPE ) . getAsString ( ) ; switch ( type ) { case BROADCASTTTYPE_FIRST : broadcastBeginFirst = value ; break ; case BROADCASTTTYPE_MAJOR_RE : broadcastBeginMajor = value ; break ; case BROADCASTTTYPE_MINOR_RE : broadcastBeginMinor = value ; break ; default : LOG . debug ( "New broadcasttype: " + type ) ; } } } } if ( ! broadcastBeginFirst . isEmpty ( ) ) { broadcastDate = broadcastBeginFirst ; } else if ( ! broadcastBeginMajor . isEmpty ( ) ) { broadcastDate = broadcastBeginMajor ; } else if ( ! broadcastBeginMinor . isEmpty ( ) ) { broadcastDate = broadcastBeginMinor ; } if ( broadcastDate . isEmpty ( ) ) { broadcastDate = getBroadcastDateIgnoringCatchupRights ( broadcastArray , BROADCASTTTYPE_FIRST ) ; } if ( broadcastDate . isEmpty ( ) ) { broadcastDate = getBroadcastDateIgnoringCatchupRights ( broadcastArray , BROADCASTTTYPE_MAJOR_RE ) ; } return broadcastDate ; }
ermittelt Ausstrahlungsdatum aus der Liste der Ausstrahlungen
@param broadcastArray
@return