This project has retired. For details please refer to its
Attic page.
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.WorkflowJob;
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 a workflow job message
030 *
031 */
032 @JsonSerialize(include = JsonSerialize.Inclusion.NON_NULL)
033 public class WorkflowJobMessage extends JobMessage {
034
035 @JsonProperty
036 private WorkflowJob.Status status;
037 @JsonProperty
038 private String errorCode;
039 @JsonProperty
040 private String errorMessage;
041
042 /**
043 * Default constructor
044 */
045 public WorkflowJobMessage() {
046 // Default constructor for jackson
047 }
048
049 /**
050 * Constructor for a workflow job message
051 * @param eventStatus event status
052 * @param workflowJobId the workflow job id
053 * @param coordinatorActionId the parent coordinator action id
054 * @param startTime start time of workflow
055 * @param endTime end time of workflow
056 * @param status status of workflow
057 * @param user the user
058 * @param appName appName of workflow
059 * @param errorCode errorCode of the failed wf actions
060 * @param errorMessage errorMessage of the failed wf action
061 */
062 public WorkflowJobMessage(EventStatus eventStatus, String workflowJobId,
063 String coordinatorActionId, Date startTime, Date endTime, WorkflowJob.Status status, String user,
064 String appName, String errorCode, String errorMessage) {
065 super(eventStatus, AppType.WORKFLOW_JOB, workflowJobId, coordinatorActionId, startTime,
066 endTime, user, appName);
067 this.status = status;
068 this.errorCode = errorCode;
069 this.errorMessage = errorMessage;
070 }
071
072 /**
073 * Set the workflow job status
074 * @param status
075 */
076 public void setStatus(WorkflowJob.Status status) {
077 this.status = status;
078 }
079
080 /**
081 * Get the workflow job status
082 * @return the workflow status
083 */
084 public WorkflowJob.Status getStatus() {
085 return status;
086 }
087
088 /**
089 * Set the workflow error code
090 * @param errorCode
091 */
092 public void setErrorCode(String errorCode) {
093 this.errorCode = errorCode;
094 }
095
096 /**
097 * Get the workflow error code
098 * @return the error code
099 */
100 public String getErrorCode() {
101 return errorCode;
102 }
103
104 /**
105 * Set the workflow error message
106 * @param errorMessage
107 */
108 public void setErrorMessage(String errorMessage) {
109 this.errorMessage = errorMessage;
110 }
111
112 /**
113 * Get the error message
114 * @return the error message
115 */
116 public String getErrorMessage() {
117 return errorMessage;
118 }
119 }