org.jmythapi.protocol.events.impl
Class UpdateProgInfo

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<IUpdateProgInfo.Props>
              extended by org.jmythapi.protocol.events.impl.UpdateProgInfo
All Implemented Interfaces:
Cloneable, IPropertyAware<IUpdateProgInfo.Props>, IVersionable, IMythEvent<IUpdateProgInfo.Props>, IRecordingEvent<IUpdateProgInfo.Props>, IRecordingUpdateEvent<IUpdateProgInfo.Props>, IUpdateProgInfo, ISendable, IMythResponse<IUpdateProgInfo.Props>

public class UpdateProgInfo
extends AMythEvent<IUpdateProgInfo.Props>
implements IUpdateProgInfo


Nested Class Summary
 
Nested classes/interfaces inherited from interface org.jmythapi.protocol.events.IUpdateProgInfo
IUpdateProgInfo.Props
 
Field Summary
 
Fields inherited from class org.jmythapi.impl.AData
logger, propsClass, protoVersion, respArgs
 
Constructor Summary
UpdateProgInfo(IMythPacket packet)
           
 
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

UpdateProgInfo

public UpdateProgInfo(IMythPacket packet)
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<IUpdateProgInfo.Props>
Parameters:
responseArgs - the response-argument-list
Throws:
IllegalArgumentException - if expected arguments are missing.

getProgramInfo

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

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

getChannelID

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

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

getRecordingStartTime

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

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

getUniqueRecordingID

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

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

getUpdatedProperties

public EnumMap<IProgramInfo.Props,Object[]> getUpdatedProperties(IProgramInfo oldProgramInfo)
Description copied from interface: IUpdateProgInfo
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 IRecordingUpdateEvent<IUpdateProgInfo.Props>
Specified by:
getUpdatedProperties in interface IUpdateProgInfo
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<IUpdateProgInfo.Props>


Copyright © 2008-2013. All Rights Reserved.