test_class.declarator: amj
test_class.modifier: private
test_class.original_string: private AbstractMaintenanceJob amj;
test_class.type: AbstractMaintenanceJob
test_class.var_name: amj
test_class.declarator: context
test_class.modifier: private
test_class.original_string: private JobExecutionContext context;
test_class.type: JobExecutionContext
test_class.var_name: context
test_class.declarator: resultBuilder
test_class.modifier: private
test_class.original_string: private ResultBuilder resultBuilder;
test_class.type: ResultBuilder
test_class.var_name: resultBuilder
test_class.file: core/src/test/java/org/apache/sling/cms/core/internal/repository/AbstractMaintenanceJobTest.java
test_class.identifier: AbstractMaintenanceJobTest
test_case.body: @Test
      public void testInvalidCode() {
          int id = 1;
          CompositeData data = CompositeDataMock.init().put("code", 2345677).put("message", "Hello World").put("id", id)
                  .build();
          amj.createResult(context, Optional.ofNullable(data), id);
          Mockito.verify(resultBuilder).failed();
      }
test_case.class_method_signature: AbstractMaintenanceJobTest.testInvalidCode()
test_case.full_signature: @Test public void testInvalidCode()
test_case.identifier: testInvalidCode
test_case.invocations: build put put put init createResult ofNullable failed verify
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testInvalidCode()
focal_class.declarator: log = LoggerFactory.getLogger(AbstractMaintenanceJob.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(AbstractMaintenanceJob.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: jobManager
focal_class.modifier: protected
focal_class.original_string: protected JobManager jobManager;
focal_class.type: JobManager
focal_class.var_name: jobManager
focal_class.file: core/src/main/java/org/apache/sling/cms/core/internal/repository/AbstractMaintenanceJob.java
focal_class.identifier: AbstractMaintenanceJob
focal_class.interfaces: implements Runnable, JobExecutor
focal_class.class_method_signature: AbstractMaintenanceJob.createResult(JobExecutionContext context, Optional<CompositeData> data,
              Integer startId)
focal_class.full_signature: protected final JobExecutionResult createResult(JobExecutionContext context, Optional<CompositeData> data,
              Integer startId)
focal_class.identifier: createResult
focal_class.modifiers: protected final
focal_class.parameters: (JobExecutionContext context, Optional<CompositeData> data,
              Integer startId)
focal_class.return: JobExecutionResult
focal_class.signature: JobExecutionResult createResult(JobExecutionContext context, Optional<CompositeData> data,
              Integer startId)
focal_class.class_method_signature: AbstractMaintenanceJob.getJobTopic()
focal_class.full_signature: public abstract String getJobTopic()
focal_class.identifier: getJobTopic
focal_class.modifiers: public abstract
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getJobTopic()
focal_class.class_method_signature: AbstractMaintenanceJob.getPrefix()
focal_class.full_signature: public abstract String getPrefix()
focal_class.identifier: getPrefix
focal_class.modifiers: public abstract
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getPrefix()
focal_class.class_method_signature: AbstractMaintenanceJob.getStatus()
focal_class.full_signature: public abstract Optional<CompositeData> getStatus()
focal_class.identifier: getStatus
focal_class.modifiers: public abstract
focal_class.parameters: ()
focal_class.return: Optional<CompositeData>
focal_class.signature: Optional<CompositeData> getStatus()
focal_class.class_method_signature: AbstractMaintenanceJob.process(Job job, JobExecutionContext context)
focal_class.full_signature: public JobExecutionResult process(Job job, JobExecutionContext context)
focal_class.identifier: process
focal_class.modifiers: public
focal_class.parameters: (Job job, JobExecutionContext context)
focal_class.return: JobExecutionResult
focal_class.signature: JobExecutionResult process(Job job, JobExecutionContext context)
focal_class.class_method_signature: AbstractMaintenanceJob.run()
focal_class.full_signature: @Override public void run()
focal_class.identifier: run
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void run()
focal_class.class_method_signature: AbstractMaintenanceJob.setJobManager(JobManager jobManager)
focal_class.full_signature: public abstract void setJobManager(JobManager jobManager)
focal_class.identifier: setJobManager
focal_class.modifiers: public abstract
focal_class.parameters: (JobManager jobManager)
focal_class.return: void
focal_class.signature: void setJobManager(JobManager jobManager)
focal_class.class_method_signature: AbstractMaintenanceJob.startMaintenance()
focal_class.full_signature: public abstract Optional<CompositeData> startMaintenance()
focal_class.identifier: startMaintenance
focal_class.modifiers: public abstract
focal_class.parameters: ()
focal_class.return: Optional<CompositeData>
focal_class.signature: Optional<CompositeData> startMaintenance()
focal_class.class_method_signature: AbstractMaintenanceJob.stopMaintenance()
focal_class.full_signature: public abstract Optional<CompositeData> stopMaintenance()
focal_class.identifier: stopMaintenance
focal_class.modifiers: public abstract
focal_class.parameters: ()
focal_class.return: Optional<CompositeData>
focal_class.signature: Optional<CompositeData> stopMaintenance()
focal_method.body: protected final JobExecutionResult createResult(JobExecutionContext context, Optional<CompositeData> data,
              Integer startId) {
          String message = data.map(d -> ((String) d.get("message"))).orElse(null);
          StatusCode code = data.map(d -> ((Integer) d.get("code"))).map(c -> Arrays.stream(StatusCode.values())
                  .filter(sc -> sc.ordinal() == c).findFirst().orElse(StatusCode.NONE)).orElse(StatusCode.NONE);
          log.trace("Loaded status code: {}", code);
          Integer id = data.map(d -> ((Integer) d.get("id"))).orElse(null);
          boolean success = false;
          StringBuilder sb = new StringBuilder(getPrefix());
          if (!data.isPresent() || code == null) {
              log.trace("No result...");
              sb.append("No result.");
          } else if (startId != null && (id == null || id.intValue() != startId.intValue())) {
              log.trace("ID does not match original ID, assuming successful...");
              sb.append(StatusCode.SUCCEEDED.name);
              success = true;
          } else if (code == StatusCode.INITIATED || code == StatusCode.SUCCEEDED) {
              log.trace("Successful result: {}...", code.name);
              sb.append(code.name);
              success = true;
          } else if (code == StatusCode.UNAVAILABLE || code == StatusCode.NONE || code == StatusCode.FAILED) {
              log.trace("Failed result: {}...", code.name);
              sb.append(code.name);
          } else {
              return null;
          }
          if (message != null) {
              sb.append(" ");
              sb.append(message);
          }
          ResultBuilder rb = context.result().message(sb.toString());
          return success ? rb.succeeded() : rb.failed();
      }
focal_method.class_method_signature: AbstractMaintenanceJob.createResult(JobExecutionContext context, Optional<CompositeData> data,
              Integer startId)
focal_method.full_signature: protected final JobExecutionResult createResult(JobExecutionContext context, Optional<CompositeData> data,
              Integer startId)
focal_method.identifier: createResult
focal_method.invocations: orElse map get orElse map map get orElse findFirst filter stream values ordinal trace orElse map get getPrefix isPresent trace append intValue intValue trace append trace append trace append append append message result toString succeeded failed
focal_method.modifiers: protected final
focal_method.parameters: (JobExecutionContext context, Optional<CompositeData> data,
              Integer startId)
focal_method.return: JobExecutionResult
focal_method.signature: JobExecutionResult createResult(JobExecutionContext context, Optional<CompositeData> data,
              Integer startId)