org.jmythapi.protocol.events.impl
Class RecordingListChangeUpdate

java.lang.Object
  extended by org.jmythapi.impl.AData<E>
      extended by org.jmythapi.protocol.response.impl.AMythResponse<E>
          extended by org.jmythapi.protocol.events.impl.AMythEvent<IRecordingListChangeUpdate.Props>
              extended by org.jmythapi.protocol.events.impl.RecordingListChangeUpdate
All Implemented Interfaces:
Cloneable, IPropertyAware<IRecordingListChangeUpdate.Props>, IVersionable, IMythEvent<IRecordingListChangeUpdate.Props>, IRecordingEvent<IRecordingListChangeUpdate.Props>, IRecordingListChange<IRecordingListChangeUpdate.Props>, IRecordingListChangeSingle<IRecordingListChangeUpdate.Props>, IRecordingListChangeUpdate, IRecordingUpdateEvent<IRecordingListChangeUpdate.Props>, ISendable, IMythResponse<IRecordingListChangeUpdate.Props>

public class RecordingListChangeUpdate
extends AMythEvent<IRecordingListChangeUpdate.Props>
implements IRecordingListChangeUpdate


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jmythapi.protocol.events.IRecordingListChangeUpdate
IRecordingListChangeUpdate.Props
 
Field Summary
 
Fields inherited from class org.jmythapi.impl.AData
logger, propsClass, protoVersion, respArgs
 
Constructor Summary
RecordingListChangeUpdate(IMythPacket packet)
           
RecordingListChangeUpdate(ProtocolVersion protoVersion, List<String> eventArguments)
           
 
Method Summary
protected  void checkSize(List<String> responseArgs)
          A function to check if the given response-argument-liste contains all expected arguments.
 Integer getChannelID()
          Gets the channel ID of the recording.
 IProgramInfo getProgramInfo()
          Gets the info object of the changed recording.
 Date getRecordingStartTime()
          Gets the recording start time.
 String getUniqueRecordingID()
          Gets the unique ID of the changed recording.
 EnumMap<IProgramInfo.Props,Object[]> getUpdatedProperties(IProgramInfo oldProgramInfo)
          Compares a previous version of the recording with the changed version.
 String toString()
          Returns the content of this data object as a formatted string.
 
Methods inherited from class org.jmythapi.protocol.events.impl.AMythEvent
decodeProperty, encodeProperty, extractArgumentsList, extractEventName, getEventName, getPacket
 
Methods inherited from class org.jmythapi.protocol.response.impl.AMythResponse
getExpectedSize, getProperties, getProperty, getPropertyIndex
 
Methods inherited from class org.jmythapi.impl.AData
clone, equals, getPropertyClass, getPropertyCount, getPropertyMap, getPropertyValue, getPropertyValue, getPropertyValueObject, getPropertyValueObject, getPropertyValues, getVersionNr, hashCode, init, postProcessArguments, setPropertyValue, setPropertyValue, setPropertyValueObject
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.jmythapi.protocol.events.IMythEvent
getEventName
 
Methods inherited from interface org.jmythapi.IPropertyAware
getProperties, getProperty, getPropertyClass, getPropertyCount, getPropertyIndex, getPropertyMap, getPropertyValue, getPropertyValue, getPropertyValueObject, getPropertyValues, setPropertyValue, setPropertyValue, setPropertyValueObject
 
Methods inherited from interface org.jmythapi.IVersionable
getVersionNr
 
Methods inherited from interface org.jmythapi.protocol.ISendable
getPacket
 

Constructor Detail

RecordingListChangeUpdate

public RecordingListChangeUpdate(IMythPacket packet)

RecordingListChangeUpdate

public RecordingListChangeUpdate(ProtocolVersion protoVersion,
                                 List<String> eventArguments)
Method Detail

checkSize

protected void checkSize(List<String> responseArgs)
                  throws IllegalArgumentException
Description copied from class: AMythResponse

A function to check if the given response-argument-liste contains all expected arguments.

The expected argument-list-size is calculated using #getExpectedSize(ArrayList).

Overrides:
checkSize in class AMythResponse<IRecordingListChangeUpdate.Props>
Parameters:
responseArgs - the response-argument-list
Throws:
IllegalArgumentException - if expected arguments are missing.

getProgramInfo

public IProgramInfo getProgramInfo()
Description copied from interface: IRecordingListChangeUpdate
Gets the info object of the changed recording.

Specified by:
getProgramInfo in interface IRecordingListChangeUpdate
Specified by:
getProgramInfo in interface IRecordingUpdateEvent<IRecordingListChangeUpdate.Props>
Returns:
the changed recording

getChannelID

public Integer getChannelID()
Description copied from interface: IRecordingListChangeUpdate
Gets the channel ID of the recording.

Specified by:
getChannelID in interface IRecordingEvent<IRecordingListChangeUpdate.Props>
Specified by:
getChannelID in interface IRecordingListChangeSingle<IRecordingListChangeUpdate.Props>
Specified by:
getChannelID in interface IRecordingListChangeUpdate
Specified by:
getChannelID in interface IRecordingUpdateEvent<IRecordingListChangeUpdate.Props>
Returns:
the channel ID.

getRecordingStartTime

public Date getRecordingStartTime()
Description copied from interface: IRecordingListChangeUpdate
Gets the recording start time.

Specified by:
getRecordingStartTime in interface IRecordingEvent<IRecordingListChangeUpdate.Props>
Specified by:
getRecordingStartTime in interface IRecordingListChangeSingle<IRecordingListChangeUpdate.Props>
Specified by:
getRecordingStartTime in interface IRecordingListChangeUpdate
Specified by:
getRecordingStartTime in interface IRecordingUpdateEvent<IRecordingListChangeUpdate.Props>
Returns:
the recording start time.

getUniqueRecordingID

public String getUniqueRecordingID()
Description copied from interface: IRecordingListChangeUpdate
Gets the unique ID of the changed recording.

Specified by:
getUniqueRecordingID in interface IRecordingEvent<IRecordingListChangeUpdate.Props>
Specified by:
getUniqueRecordingID in interface IRecordingListChangeSingle<IRecordingListChangeUpdate.Props>
Specified by:
getUniqueRecordingID in interface IRecordingListChangeUpdate
Specified by:
getUniqueRecordingID in interface IRecordingUpdateEvent<IRecordingListChangeUpdate.Props>
Returns:
the unique recording ID.
See Also:
EncodingUtils.generateId(Integer, Date)

getUpdatedProperties

public EnumMap<IProgramInfo.Props,Object[]> getUpdatedProperties(IProgramInfo oldProgramInfo)
Description copied from interface: IRecordingListChangeUpdate
Compares a previous version of the recording with the changed version.

This function compares each property of the recordings and returns a map containing all changed properties

Usage Example:


    EnumMap<IProgramInfo.Props,Object[]> diffMap = ((IRecordingListChangeUpdate)event).getUpdatedProperties(oldRecording);
    
    // pring changes
    System.out.println(String.format(
       "%d properties of recording changed:",
       Integer.valueOf(diffMap.size()), recording.getBaseName()
    ));							
    for(Entry<IProgramInfo.Props,Object[]> entry : diffMap.entrySet()) {
       IProgramInfo.Props property = entry.getKey();
       Object[] values = entry.getValue();
       System.out.println(String.format(
          "\r\n   %s: %s -> %s",
          property, values[0],values[1]
       ));
    }						 	
 

Specified by:
getUpdatedProperties in interface IRecordingListChangeUpdate
Specified by:
getUpdatedProperties in interface IRecordingUpdateEvent<IRecordingListChangeUpdate.Props>
Parameters:
oldProgramInfo - a previous version of the recording
Returns:
a map containing all found differences
See Also:
PropertyAwareUtils.compare(IPropertyAware, IPropertyAware)

toString

public String toString()
Description copied from class: AData

Returns the content of this data object as a formatted string.

E.g.
 <0>TOTAL_RAM_MB: 1002 | <1>FREE_RAM_MB: 474 | <2>TOTAL_VM_MB: 853 | <3>FREE_VM_MB: 853
 

Overrides:
toString in class AMythEvent<IRecordingListChangeUpdate.Props>


Copyright © 2008-2013. All Rights Reserved.