001/*
002 * Copyright 2009-2018 the original author or authors.
003 *
004 * Licensed under the Apache License, Version 2.0 (the "License");
005 * you may not use this file except in compliance with the License.
006 * You may obtain a copy of the License at
007 *
008 *       https://www.apache.org/licenses/LICENSE-2.0
009 *
010 * Unless required by applicable law or agreed to in writing, software
011 * distributed under the License is distributed on an "AS IS" BASIS,
012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013 * See the License for the specific language governing permissions and
014 * limitations under the License.
015 */
016package org.springframework.batch.integration.partition;
017
018import java.io.Serializable;
019
020/**
021 * Class encapsulating information required to request a step execution in
022 * a remote partitioning setup.
023 *
024 * @author Dave Syer
025 * @author Mahmoud Ben Hassine
026 */
027public class StepExecutionRequest implements Serializable {
028
029        private static final long serialVersionUID = 1L;
030
031        private Long stepExecutionId;
032
033        private String stepName;
034
035        private Long jobExecutionId;
036
037        private StepExecutionRequest() {
038                //For Jackson deserialization
039        }
040
041        /**
042         * Create a new {@link StepExecutionRequest} instance.
043         * @param stepName the name of the step to execute
044         * @param jobExecutionId the id of the job execution
045         * @param stepExecutionId the id of the step execution
046         */
047        public StepExecutionRequest(String stepName, Long jobExecutionId, Long stepExecutionId) {
048                this.stepName = stepName;
049                this.jobExecutionId = jobExecutionId;
050                this.stepExecutionId = stepExecutionId;
051        }
052
053        public Long getJobExecutionId() {
054                return jobExecutionId;
055        }
056
057        public Long getStepExecutionId() {
058                return stepExecutionId;
059        }
060
061        public String getStepName() {
062                return stepName;
063        }
064
065        @Override
066        public String toString() {
067                return String.format("StepExecutionRequest: [jobExecutionId=%d, stepExecutionId=%d, stepName=%s]",
068                                jobExecutionId, stepExecutionId, stepName);
069        }
070
071}