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    package org.apache.oozie.client.event.message;
019    
020    import java.util.Date;
021    
022    import org.apache.oozie.AppType;
023    import org.apache.oozie.client.CoordinatorAction;
024    import org.apache.oozie.client.event.JobEvent.EventStatus;
025    import org.codehaus.jackson.annotate.JsonProperty;
026    import org.codehaus.jackson.map.annotate.JsonSerialize;
027    
028    /**
029     * Class holding attributes related to Coordinator action message
030     *
031     */
032    @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
033    public class CoordinatorActionMessage extends JobMessage {
034    
035        @JsonProperty
036        private CoordinatorAction.Status status;
037        @JsonProperty
038        private Date nominalTime;
039        @JsonProperty
040        private String missingDependency;
041        @JsonProperty
042        private String errorCode;
043        @JsonProperty
044        private String errorMessage;
045    
046        /**
047         * Default constructor
048         */
049        public CoordinatorActionMessage() {
050            // Default constructor for jackson
051        }
052    
053        /**
054         * Constructs the coordinator action message
055         * @param eventStatus the event status
056         * @param coordinatorActionId the coord action id
057         * @param coordinatorJobId the parent job id
058         * @param startTime the created time of coord action
059         * @param endTime the end time of coord action
060         * @param nominalTime the nominal time of coord action
061         * @param status the status of coord action
062         * @param user the user of coordinator
063         * @param appName the app name of coordinator
064         * @param missingDependency the action's first missing dependency
065         * @param errorCode the action's error code
066         * @param errorMessage the action's error message
067         */
068        public CoordinatorActionMessage(EventStatus eventStatus, String coordinatorActionId,
069                String coordinatorJobId, Date startTime, Date endTime, Date nominalTime, CoordinatorAction.Status status,
070                String user, String appName, String missingDependency, String errorCode, String errorMessage) {
071            super(eventStatus, AppType.COORDINATOR_ACTION, coordinatorActionId, coordinatorJobId, startTime,
072                    endTime, user, appName);
073            this.status = status;
074            this.nominalTime = nominalTime;
075            this.missingDependency = missingDependency;
076            this.errorCode = errorCode;
077            this.errorMessage = errorMessage;
078    
079        }
080    
081        /**
082         * Set the status of coordinator action
083         * @param status
084         */
085        public void setStatus(CoordinatorAction.Status status) {
086            this.status = status;
087        }
088    
089        /**
090         * Get the status of coord action
091         * @return the CoordinatorAction status
092         */
093        public CoordinatorAction.Status getStatus() {
094            return status;
095        }
096    
097        /**
098         * Set the nominal time
099         * @param nominalTime
100         */
101        public void setNominalTime(Date nominalTime) {
102            this.nominalTime = nominalTime;
103        }
104    
105        /**
106         * Get the nominal time
107         * @return the nominal time
108         */
109        public Date getNominalTime() {
110            return nominalTime;
111        }
112    
113        /**
114         * Set the error code
115         * @param errorCode
116         */
117        public void setErrorCode(String errorCode) {
118            this.errorCode = errorCode;
119        }
120    
121        /**
122         * Get the error code
123         * @return the errorCode
124         */
125        public String getErrorCode() {
126            return errorCode;
127        }
128    
129        /**
130         * Set the error message
131         * @param errorMessage
132         */
133        public void setErrorMessage(String errorMessage) {
134            this.errorMessage = errorMessage;
135        }
136    
137        /**
138         * Get the error message
139         * @return the errorMessage
140         */
141        public String getErrorMessage() {
142            return errorMessage;
143        }
144    
145        /**
146         * Set the missing dependency
147         * @param missingDependency
148         */
149        public void setMissingDependency(String missingDependency) {
150            this.missingDependency = missingDependency;
151        }
152    
153        /**
154         * Get the missing dependency
155         * @return the missing Dependency
156         */
157        public String getMissingDependency() {
158            return missingDependency;
159        }
160    
161    }