001/**
002 * Licensed to the Apache Software Foundation (ASF) under one
003 * or more contributor license agreements.  See the NOTICE file
004 * distributed with this work for additional information
005 * regarding copyright ownership.  The ASF licenses this file
006 * to you under the Apache License, Version 2.0 (the
007 * "License"); you may not use this file except in compliance
008 * with the License.  You may obtain a copy of the License at
009 *
010 *      http://www.apache.org/licenses/LICENSE-2.0
011 *
012 * Unless required by applicable law or agreed to in writing, software
013 * distributed under the License is distributed on an "AS IS" BASIS,
014 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
015 * See the License for the specific language governing permissions and
016 * limitations under the License.
017 */
018
019package org.apache.oozie.client.event.message;
020
021import java.util.Date;
022
023import org.apache.oozie.AppType;
024import org.apache.oozie.client.CoordinatorAction;
025import org.apache.oozie.client.event.JobEvent.EventStatus;
026import org.codehaus.jackson.annotate.JsonProperty;
027import org.codehaus.jackson.map.annotate.JsonSerialize;
028
029/**
030 * Class holding attributes related to Coordinator action message
031 *
032 */
033@JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
034public class CoordinatorActionMessage extends JobMessage {
035
036    @JsonProperty
037    private CoordinatorAction.Status status;
038    @JsonProperty
039    private Date nominalTime;
040    @JsonProperty
041    private String missingDependency;
042    @JsonProperty
043    private String errorCode;
044    @JsonProperty
045    private String errorMessage;
046
047    /**
048     * Default constructor
049     */
050    public CoordinatorActionMessage() {
051        // Default constructor for jackson
052    }
053
054    /**
055     * Constructs the coordinator action message
056     * @param eventStatus the event status
057     * @param coordinatorActionId the coord action id
058     * @param coordinatorJobId the parent job id
059     * @param startTime the created time of coord action
060     * @param endTime the end time of coord action
061     * @param nominalTime the nominal time of coord action
062     * @param status the status of coord action
063     * @param user the user of coordinator
064     * @param appName the app name of coordinator
065     * @param missingDependency the action's first missing dependency
066     * @param errorCode the action's error code
067     * @param errorMessage the action's error message
068     */
069    public CoordinatorActionMessage(EventStatus eventStatus, String coordinatorActionId,
070            String coordinatorJobId, Date startTime, Date endTime, Date nominalTime, CoordinatorAction.Status status,
071            String user, String appName, String missingDependency, String errorCode, String errorMessage) {
072        super(eventStatus, AppType.COORDINATOR_ACTION, coordinatorActionId, coordinatorJobId, startTime,
073                endTime, user, appName);
074        this.status = status;
075        this.nominalTime = nominalTime;
076        this.missingDependency = missingDependency;
077        this.errorCode = errorCode;
078        this.errorMessage = errorMessage;
079
080    }
081
082    /**
083     * Set the status of coordinator action
084     * @param status
085     */
086    public void setStatus(CoordinatorAction.Status status) {
087        this.status = status;
088    }
089
090    /**
091     * Get the status of coord action
092     * @return the CoordinatorAction status
093     */
094    public CoordinatorAction.Status getStatus() {
095        return status;
096    }
097
098    /**
099     * Set the nominal time
100     * @param nominalTime
101     */
102    public void setNominalTime(Date nominalTime) {
103        this.nominalTime = nominalTime;
104    }
105
106    /**
107     * Get the nominal time
108     * @return the nominal time
109     */
110    public Date getNominalTime() {
111        return nominalTime;
112    }
113
114    /**
115     * Set the error code
116     * @param errorCode
117     */
118    public void setErrorCode(String errorCode) {
119        this.errorCode = errorCode;
120    }
121
122    /**
123     * Get the error code
124     * @return the errorCode
125     */
126    public String getErrorCode() {
127        return errorCode;
128    }
129
130    /**
131     * Set the error message
132     * @param errorMessage
133     */
134    public void setErrorMessage(String errorMessage) {
135        this.errorMessage = errorMessage;
136    }
137
138    /**
139     * Get the error message
140     * @return the errorMessage
141     */
142    public String getErrorMessage() {
143        return errorMessage;
144    }
145
146    /**
147     * Set the missing dependency
148     * @param missingDependency
149     */
150    public void setMissingDependency(String missingDependency) {
151        this.missingDependency = missingDependency;
152    }
153
154    /**
155     * Get the missing dependency
156     * @return the missing Dependency
157     */
158    public String getMissingDependency() {
159        return missingDependency;
160    }
161
162}