Skip to content

Commit

Permalink
JBERET-221 com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: …
Browse files Browse the repository at this point in the history
…1 counts of IllegalAnnotationExceptions
  • Loading branch information
chengfang committed Feb 25, 2016
1 parent cb652f6 commit 37fb696
Show file tree
Hide file tree
Showing 7 changed files with 85 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
import java.io.Serializable;
import java.util.Date;
import javax.batch.runtime.BatchStatus;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;

/**
* The base class for {@link JobExecutionEntity} and {@link StepExecutionEntity},
Expand All @@ -26,12 +29,20 @@
*
* @since 1.3.0
*/
@XmlAccessorType(XmlAccessType.FIELD)
public abstract class AbstractExecutionEntity implements Serializable {
private static final long serialVersionUID = -6861630889634554990L;

@XmlElement
Date startTime;

@XmlElement
Date endTime;

@XmlElement
BatchStatus batchStatus;

@XmlElement
String exitStatus;

public AbstractExecutionEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@

import java.io.Serializable;
import javax.batch.operations.BatchRuntimeException;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

Expand All @@ -26,12 +29,18 @@
* @since 1.3.0
*/
@XmlRootElement
@XmlType(propOrder = "type, message, stackTrace")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = {"type", "message", "stackTrace"})
public final class BatchExceptionEntity implements Serializable {
private static final long serialVersionUID = 810435611118287431L;

@XmlElement
private final Class<? extends BatchRuntimeException> type;

@XmlElement
private final String message;

@XmlElement
private final String stackTrace;

public BatchExceptionEntity(final BatchRuntimeException ex) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,9 @@
package org.jberet.rest.entity;

import java.io.Serializable;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

Expand All @@ -23,11 +26,18 @@
* @since 1.3.0
*/
@XmlRootElement
@XmlType(propOrder = "jobName, numberOfJobInstances, numberOfRunningJobExecutions")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = {"jobName", "numberOfJobInstances", "numberOfRunningJobExecutions"})
public final class JobEntity implements Serializable {
private static final long serialVersionUID = -7252231657018200476L;

@XmlElement
private String jobName;

@XmlElement
private int numberOfJobInstances;

@XmlElement
private int numberOfRunningJobExecutions;

public JobEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
import java.util.List;
import java.util.Properties;
import javax.batch.runtime.JobExecution;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlTransient;

Expand All @@ -32,20 +35,35 @@
* @since 1.3.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
//@XmlType(propOrder =
//"executionId, href, jobName, jobInstanceId, jobParameters, batchStatus, exitStatus, createTime, startTime, lastUpdatedTime, endTime")
// {"executionId", "href", "jobName", "jobInstanceId", "jobParameters", "batchStatus", "exitStatus", "createTime", "startTime", "lastUpdatedTime", "endTime"})
public final class JobExecutionEntity extends AbstractExecutionEntity implements JobExecution, Serializable {
private static final long serialVersionUID = -8566764098276314827L;

@XmlElement
private long executionId;

@XmlElement
private String href;

@XmlElement
private Date createTime;

@XmlElement
private Date lastUpdatedTime;

@XmlElement
private Properties jobParameters;

@XmlElement
private String jobName;

@XmlElement
private long jobInstanceId;

private List<StepExecutionEntity> stepExecutions = new ArrayList<StepExecutionEntity>();
@XmlTransient
private List<StepExecutionEntity> stepExecutions = new ArrayList<StepExecutionEntity>();

public JobExecutionEntity() {
}
Expand Down Expand Up @@ -111,7 +129,6 @@ public void setJobName(String jobName) {
this.jobName = jobName;
}

@XmlTransient
public List<StepExecutionEntity> getStepExecutions() {
return stepExecutions;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
import java.util.List;
import javax.batch.runtime.JobExecution;
import javax.batch.runtime.JobInstance;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;

Expand All @@ -26,13 +29,21 @@
* @since 1.3.0
*/
@XmlRootElement
@XmlType(propOrder = "instanceId, jobName, jobExecutions, latestJobExecutionId")
@XmlAccessorType(XmlAccessType.FIELD)
@XmlType(propOrder = {"instanceId", "jobName", "numberOfJobExecutions", "latestJobExecutionId"})
public final class JobInstanceEntity implements JobInstance, Serializable {
private static final long serialVersionUID = 2427272964201557394L;

@XmlElement
private long instanceId;

@XmlElement
private String jobName;

@XmlElement
private int numberOfJobExecutions;

@XmlElement
private long latestJobExecutionId;

public JobInstanceEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@

import java.io.Serializable;
import javax.batch.runtime.Metric;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;

/**
* Represents a step execution metric, which includes metric type and metric value.
Expand All @@ -22,9 +26,15 @@
*
* @since 1.3.0
*/
@XmlRootElement
@XmlAccessorType(XmlAccessType.FIELD)
public class MetricEntity implements Serializable, Metric {
private static final long serialVersionUID = 717668174913816112L;

@XmlElement
private MetricType type;

@XmlElement
private long value;

public MetricEntity() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,11 @@

import java.io.Serializable;
import javax.batch.runtime.StepExecution;
import javax.xml.bind.annotation.XmlAccessType;
import javax.xml.bind.annotation.XmlAccessorType;
import javax.xml.bind.annotation.XmlElement;
import javax.xml.bind.annotation.XmlRootElement;
import javax.xml.bind.annotation.XmlType;
import javax.xml.bind.annotation.XmlTransient;

/**
* Represents a step execution, which includes fields such as step execution id,
Expand All @@ -27,20 +30,25 @@
* @since 1.3.0
*/
@XmlRootElement
@XmlType(propOrder =
"stepExecutionId, stepName, batchStatus, exitStatus, startTime, endTime, metrics")
@XmlAccessorType(XmlAccessType.FIELD)
//@XmlType(propOrder =
// {"stepExecutionId", "stepName", "batchStatus", "exitStatus", "startTime", "endTime", "metrics"})
public class StepExecutionEntity extends AbstractExecutionEntity implements StepExecution, Serializable {
private static final long serialVersionUID = -8528930845788535109L;

@XmlElement
private long stepExecutionId;

@XmlElement
private String stepName;

//unused property, kept here to satisfy Jackson mapping. Otherwise will get error:
//UnrecognizedPropertyException: Unrecognized field "persistentUserData"
//we don't want to annotate Jackson-specific annotations either (@JsonIgnoreProperties(ignoreUnknown = true)
@XmlTransient
private Serializable persistentUserData;

@XmlElement
private MetricEntity[] metrics;

public StepExecutionEntity() {
Expand Down

0 comments on commit 37fb696

Please sign in to comment.