コード例 #1
0
  /**
   * Creates and returns an instance of {@link Job} entity.
   *
   * @param actionType The action type the job entity represents.
   * @param command The {@code CommandBase} instance which the job entity describes.
   * @return An initialized {@code Job} instance.
   */
  public static Job createJob(VdcActionType actionType, CommandBase<?> command) {
    Job job = new Job();

    job.setId(Guid.newGuid());
    job.setActionType(actionType);
    job.setDescription(
        ExecutionMessageDirector.resolveJobMessage(actionType, command.getJobMessageProperties()));
    job.setJobSubjectEntities(getSubjectEntities(command.getPermissionCheckSubjects()));
    job.setOwnerId(command.getUserId());
    job.setStatus(JobExecutionStatus.STARTED);
    job.setStartTime(new Date());
    job.setCorrelationId(command.getCorrelationId());

    return job;
  }