コード例 #1
0
  public ObjectPolicyConfigurationTypeDto preparePolicyConfig() {
    ObjectPolicyConfigurationTypeDto newConfig = new ObjectPolicyConfigurationTypeDto();

    newConfig.setConstraints(propertyConstraintsList);
    newConfig.setType(type);

    ObjectReferenceType ref = new ObjectReferenceType();
    if (templateRef != null) {
      ref.setOid(templateRef.getOid());
      ref.setType(ObjectTemplateType.COMPLEX_TYPE);
    }

    newConfig.setTemplateRef(ref);

    return newConfig;
  }
コード例 #2
0
  private List<ObjectReferenceType> createResourceList() {
    resourceMap.clear();
    OperationResult result = new OperationResult(OPERATION_LOAD_RESOURCES);
    Task task = getPageBase().createSimpleTask(OPERATION_LOAD_RESOURCES);
    List<PrismObject<ResourceType>> resources = null;
    List<ObjectReferenceType> references = new ArrayList<>();

    try {
      resources =
          getPageBase()
              .getModelService()
              .searchObjects(ResourceType.class, new ObjectQuery(), null, task, result);
      result.recomputeStatus();
    } catch (Exception e) {
      result.recordFatalError("Couldn't get resource list.", e);
      LoggingUtils.logException(LOGGER, "Couldn't get resource list.", e);
    }

    // TODO - show error somehow
    // if(!result.isSuccess()){
    //    getPageBase().showResult(result);
    // }

    if (resources != null) {
      ObjectReferenceType ref;
      for (PrismObject<ResourceType> r : resources) {
        resourceMap.put(r.getOid(), WebMiscUtil.getName(r));
        ref = new ObjectReferenceType();
        ref.setType(ResourceType.COMPLEX_TYPE);
        ref.setOid(r.getOid());
        references.add(ref);
      }
    }

    return references;
  }