com.evolveum.midpoint.task.api.Task.getExtension()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(4.7k)|赞(0)|评价(0)|浏览(136)

本文整理了Java中com.evolveum.midpoint.task.api.Task.getExtension()方法的一些代码示例,展示了Task.getExtension()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Task.getExtension()方法的具体详情如下:
包路径:com.evolveum.midpoint.task.api.Task
类名称:Task
方法名:getExtension

Task.getExtension介绍

[英]Returns task extension. The extension is a part of task that can store arbitrary data. It usually holds data specific to a task type, internal task state, business state or similar data that are out of scope of this interface definition.
[中]返回任务扩展。扩展是任务的一部分,可以存储任意数据。它通常保存特定于任务类型、内部任务状态、业务状态或类似数据的数据,这些数据超出了此接口定义的范围。

代码示例

代码示例来源:origin: Evolveum/midpoint

static Boolean findItemValue(Task task, QName path) throws SchemaException{
  Validate.notNull(task, "Task must not be null.");
  if (task.getExtension() == null) {
    return null;
  }
  PrismProperty<Boolean> item = task.getExtensionProperty(path);
  if (item == null || item.isEmpty()) {
    return null;
  }
  if (item.getValues().size() > 1) {
    throw new SchemaException("Unexpected number of values for option 'dry run'.");
  }
  return item.getValues().iterator().next().getValue();
}

代码示例来源:origin: Evolveum/midpoint

private Object findSyncTokenObject(Task syncCycle) {
  Object token = null;
  PrismProperty<?> tokenProperty = syncCycle.getExtension().findProperty(SchemaConstants.SYNC_TOKEN);
  if (tokenProperty != null) {
    Collection<?> values = tokenProperty.getRealValues();
    if (values.size() > 1) {
      throw new IllegalStateException("Too must values in token "+tokenProperty);
    }
    token = values.iterator().next();
  }
  return token;
}

代码示例来源:origin: Evolveum/midpoint

public static ModelExecuteOptions getModelExecuteOptions(Task task) throws SchemaException {
  Validate.notNull(task, "Task must not be null.");
  if (task.getExtension() == null) {
    return null;
  }
  //LOGGER.info("Task:\n{}",task.debugDump(1));
  PrismProperty<ModelExecuteOptionsType> item = task.getExtensionProperty(SchemaConstants.C_MODEL_EXECUTE_OPTIONS);
  if (item == null || item.isEmpty()) {
    return null;
  }
  //LOGGER.info("Item:\n{}",item.debugDump(1));
  if (item.getValues().size() > 1) {
    throw new SchemaException("Unexpected number of values for option 'modelExecuteOptions'.");
  }
  ModelExecuteOptionsType modelExecuteOptionsType = item.getValues().iterator().next().getValue();
  if (modelExecuteOptionsType == null) {
    return null;
  }
  //LOGGER.info("modelExecuteOptionsType: {}",modelExecuteOptionsType);
  ModelExecuteOptions modelExecuteOptions = ModelExecuteOptions.fromModelExecutionOptionsType(modelExecuteOptionsType);
  //LOGGER.info("modelExecuteOptions: {}",modelExecuteOptions);
  return modelExecuteOptions;
}

代码示例来源:origin: Evolveum/midpoint

runResult.setShouldContinue(false);     // overridden later
PrismContainer taskExtension = task.getExtension();

代码示例来源:origin: Evolveum/midpoint

private static boolean isDryRun(Task task){
      
      Validate.notNull(task, "Task must not be null.");
      
      if (task.getExtension() == null){
        return false;
      }
      
      PrismProperty<Boolean> item = task.getExtensionProperty(SchemaConstants.MODEL_EXTENSION_DRY_RUN);
      if (item == null || item.isEmpty()){
        return false;
      }
      
      if (item.getValues().size() > 1){
        return false;
//                throw new SchemaException("Unexpected number of values for option 'dry run'.");
      }
          
      Boolean dryRun = item.getValues().iterator().next().getValue();
      
      if (dryRun == null){
        return false;
      }
      
      return dryRun.booleanValue(); 
    }

代码示例来源:origin: Evolveum/midpoint

PrismContainer<?> taskExtension = task.getExtension();
AssertJUnit.assertNotNull(taskExtension);
display("Task extension", taskExtension);

代码示例来源:origin: Evolveum/midpoint

@SuppressWarnings("rawtypes")
private PrismProperty getTokenProperty(ResourceShadowDiscriminator shadowCoordinates, Task task, OperationResult result)
    throws ObjectNotFoundException, CommunicationException, SchemaException, ConfigurationException, ExpressionEvaluationException {
  PrismProperty tokenProperty = null;
  if (task.getExtension() != null) {
    tokenProperty = task.getExtensionProperty(SchemaConstants.SYNC_TOKEN);
  }
  if (tokenProperty != null && (tokenProperty.getAnyRealValue() == null)) {
    LOGGER.warn("Sync token exists, but it is empty (null value). Ignoring it.");
    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace("Empty sync token property:\n{}", tokenProperty.debugDump());
    }
    tokenProperty = null;
  }
  // if the token is not specified in the task, get the latest token
  if (tokenProperty == null) {
    tokenProperty = shadowCache.fetchCurrentToken(shadowCoordinates, result);
    if (tokenProperty == null || tokenProperty.getValue() == null
        || tokenProperty.getValue().getValue() == null) {
      LOGGER.warn("Empty current sync token provided by {}", shadowCoordinates);
      if (LOGGER.isTraceEnabled()) {
        LOGGER.trace("Empty current sync token property.");
      }
      return null;
    }
  }
  return tokenProperty;
}

代码示例来源:origin: Evolveum/midpoint

if (task.getExtension() != null) {
   PrismProperty tokenRetryUnhandledErrProperty = task.getExtensionProperty(SchemaConstants.SYNC_TOKEN_RETRY_UNHANDLED);

相关文章