Package ai.wanaku.cli.main.support
Class TargetsHelper
java.lang.Object
ai.wanaku.cli.main.support.TargetsHelper
-
Method Summary
Modifier and TypeMethodDescriptioncreateTargetMap(String serviceName, ActivityRecord activityRecord) Creates a printable target map from a service name and activity record.getPrintableTargets(Map<String, List<ActivityRecord>> states) Converts a map of service states to a list of printable target representations.
-
Method Details
-
getPrintableTargets
Converts a map of service states to a list of printable target representations. Each target is represented as a map containing display-friendly key-value pairs suitable for reporting or user interface purposes.- Parameters:
states- a map where keys are service names and values are lists ofActivityRecordobjects representing the activities for each service. Must not be null.- Returns:
- a list of maps, where each map represents a single target with the
following keys:
- "id" - the activity record ID
- "service" - the service name
- "active" - string representation of the activity status ("true"/"false")
- "last_seen" - formatted timestamp of when the activity was last seen
- Throws:
NullPointerException- ifstatesis null or contains null valuesRuntimeException- ifformatLastSeenTimestampfails for any activity record- Since:
- 1.0
- See Also:
-
createTargetMap
Creates a printable target map from a service name and activity record. This is a helper method to improve readability and maintainability.- Parameters:
serviceName- the name of the serviceactivityRecord- the activity record to convert- Returns:
- a map containing the printable representation of the target
-