public void fromMapValue()

in src/main/java/org/apache/sling/jobs/impl/JobUpdateImpl.java [196:220]


    public void fromMapValue(@Nullable Object mapValue) {
        if (mapValue != null && mapValue instanceof Map) {
            @SuppressWarnings("unchecked") Map<String, Object> m = (Map<String, Object>) mapValue;
            jobQueue = Types.jobQueue((String) Utils.getRequired(m, "tp"));
            jobType = Types.jobType((String)Utils.getRequired(m, "jt"));
            id = Utils.getRequired(m, "id");
            command = JobUpdateCommand.valueOf((String) Utils.getRequired(m, "cm"));
            updateTimestamp = Utils.getRequired(m, "ts");
            expires =  Utils.getRequired(m, "ex");
            if (command == JobUpdateCommand.UPDATE_JOB || command == JobUpdateCommand.START_JOB || command == JobUpdateCommand.RETRY_JOB ) {
                startedAt = Utils.getOptional(m, "startedAt", 0L);
                createdAt = Utils.getOptional(m, "createdAt", 0L);
                finishedAt = Utils.getOptional(m, "finishedAt", 0L);
                retryCount = Utils.getOptional(m, "retryCount", 0);
                numberOfRetries = Utils.getOptional(m, "nRetries", 10);
                jobState = Job.JobState.valueOf(Utils.getOptional(m, "jobState", Job.JobState.QUEUED.toString()));
                resultMessage = Utils.getOptional(m, "resultMessage", null);
                properties = Utils.getOptional(m, "properties", new HashMap<String, Object>());
            } else {
                properties = new HashMap<String, Object>();
            }
        } else {
            throw new IllegalArgumentException("Cant populate JobImpl from "+mapValue);
        }
    }