@@ -0,0 +1,2087 @@
+package com.suse.saltstack.netapi.event;%0A%0Aimport com.suse.saltstack.netapi.datatypes.Event;%0A%0Aimport java.util.Map;%0Aimport java.util.Optional;%0Aimport java.util.regex.Matcher;%0Aimport java.util.regex.Pattern;%0A%0A/**%0A * Representation of job return events fired each time a minion returns data for a job.%0A */%0Apublic class JobReturnEvent %7B%0A%0A    private static final Pattern PATTERN =%0A            Pattern.compile(%22%5Esalt/job/(%5B%5E/%5D+)/ret/(%5B%5E/%5D+)$%22);%0A%0A    private final String jobId;%0A    private final String minionId;%0A    private final Map%3CString, Object%3E data;%0A%0A    /**%0A     * Creates a new JobReturnEvent%0A     * @param jobIdIn the id of the job%0A     * @param minionIdIn the id of the minion returning the job%0A     * @param dataIn data containing more information about this event%0A     */%0A    public JobReturnEvent(String jobIdIn, String minionIdIn, Map%3CString, Object%3E dataIn) %7B%0A        this.jobId = jobIdIn;%0A        this.minionId = minionIdIn;%0A        this.data = dataIn;%0A    %7D%0A%0A    /**%0A     * The id of the job%0A     *%0A     * @return job id%0A     */%0A    public String getJobId() %7B%0A        return jobId;%0A    %7D%0A%0A    /**%0A     * The id of the minion that returned the ob%0A     *%0A     * @return the minion id%0A     */%0A    public String getMinionId() %7B%0A        return minionId;%0A    %7D%0A%0A    /**%0A     * The event data containing more information about this event%0A     *%0A     * @return the event data%0A     */%0A    public Map%3CString, Object%3E getData() %7B%0A        return data;%0A    %7D%0A%0A    /**%0A     * Utility method to parse a generic event into a more specific one.%0A     * @param event the generic event to parse%0A     * @return an option containing the parsed value or non if it could not be parsed%0A     */%0A    public static Optional%3CJobReturnEvent%3E parse(Event event) %7B%0A        Matcher matcher = PATTERN.matcher(event.getTag());%0A        if (matcher.matches()) %7B%0A            JobReturnEvent result = new JobReturnEvent(matcher.group(1), matcher.group(2),%0A                    event.getData());%0A            return Optional.of(result);%0A        %7D%0A        else %7B%0A            return Optional.empty();%0A        %7D%0A    %7D%0A%7D%0A

add job return event