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