Ejemplo n.º 1
0
  @Override
  public TaskRunResult run(Task task) {

    OperationResult result =
        task.getResult().createSubresult(WaitForTasksTaskHandler.class.getName() + ".run");
    result.recordInProgress();

    LOGGER.info("WaitForTasksTaskHandler run starting; in task " + task.getName());
    try {
      // todo resolve this brutal hack
      taskManagerImpl.pauseTask(task, TaskWaitingReason.OTHER, result);
      task.startWaitingForTasksImmediate(result);
    } catch (SchemaException e) {
      throw new SystemException(
          "Couldn't mark task as waiting for prerequisite tasks",
          e); // should not occur; will be handled by task runner
    } catch (ObjectNotFoundException e) {
      throw new SystemException(
          "Couldn't mark task as waiting for prerequisite tasks",
          e); // should not occur; will be handled by task runner
    }
    LOGGER.info("WaitForTasksTaskHandler run finishing; in task " + task.getName());

    result.computeStatus();

    TaskRunResult runResult = new TaskRunResult();
    runResult.setOperationResult(result);
    runResult.setProgress(task.getProgress()); // not to overwrite task's progress
    runResult.setRunResultStatus(TaskRunResultStatus.FINISHED);
    return runResult;
  }
Ejemplo n.º 2
0
 /**
  * Removes all the successful minor results. Also checks if the result is roughly consistent and
  * complete. (e.g. does not have unknown operation status, etc.)
  *
  * <p>The argument "e" is for easier use of the cleanup in the exceptions handlers. The original
  * exception is passed to the IAE that this method produces for easier debugging.
  */
 public void cleanupResult(Throwable e) {
   if (status == OperationResultStatus.UNKNOWN) {
     LOGGER.error(
         "Attempt to cleanup result of operation " + operation + " that is still UNKNOWN:\n{}",
         this.debugDump());
     throw new IllegalStateException(
         "Attempt to cleanup result of operation " + operation + " that is still UNKNOWN");
   }
   if (subresults == null) {
     return;
   }
   Iterator<OperationResult> iterator = subresults.iterator();
   while (iterator.hasNext()) {
     OperationResult subresult = iterator.next();
     if (subresult.getStatus() == OperationResultStatus.UNKNOWN) {
       String message =
           "Subresult "
               + subresult.getOperation()
               + " of operation "
               + operation
               + " is still UNKNOWN during cleanup";
       LOGGER.error("{}:\n{}", message, this.debugDump(), e);
       if (e == null) {
         throw new IllegalStateException(message);
       } else {
         throw new IllegalStateException(message + "; during handling of exception " + e, e);
       }
     }
     if (subresult.canCleanup()) {
       iterator.remove();
     }
   }
 }
Ejemplo n.º 3
0
 @AfterClass
 public static void stopLdap() throws Exception {
   openDJController.stop();
   LOGGER.info("------------------------------------------------------------------------------");
   LOGGER.info("STOP:  OpenDjUcfTest");
   LOGGER.info("------------------------------------------------------------------------------");
 }
Ejemplo n.º 4
0
  private CallableResult<List<AssignmentItemDto>> loadAssignments() throws Exception {
    LOGGER.debug("Loading assignments.");
    CallableResult callableResult = new CallableResult();
    List<AssignmentItemDto> list = new ArrayList<AssignmentItemDto>();
    callableResult.setValue(list);

    PrismObject<UserType> user = principalModel.getObject();
    if (user == null || user.findContainer(UserType.F_ASSIGNMENT) == null) {
      return callableResult;
    }

    Task task = createSimpleTask(OPERATION_LOAD_ASSIGNMENTS);
    OperationResult result = task.getResult();
    callableResult.setResult(result);

    PrismContainer assignments = user.findContainer(UserType.F_ASSIGNMENT);
    List<PrismContainerValue> values = assignments.getValues();
    for (PrismContainerValue assignment : values) {
      AssignmentItemDto item = createAssignmentItem(user, assignment, task, result);
      if (item != null) {
        list.add(item);
      }
    }
    result.recordSuccessIfUnknown();
    result.recomputeStatus();

    Collections.sort(list);

    LOGGER.debug("Finished assignments loading.");

    return callableResult;
  }
 @PostConstruct
 private void initialize() {
   if (LOGGER.isTraceEnabled()) {
     LOGGER.trace("Registering with taskManager as a handler for " + MODEL_OPERATION_TASK_URI);
   }
   taskManager.registerHandler(MODEL_OPERATION_TASK_URI, this);
 }
  /* (non-Javadoc)
   * @see javax.xml.xpath.XPathFunctionResolver#resolveFunction(javax.xml.namespace.QName, int)
   */
  @Override
  public XPathFunction resolveFunction(QName functionQName, int arity) {
    boolean enableDebug = false;
    String namespace = functionQName.getNamespaceURI();
    if (StringUtils.isEmpty(namespace)) {
      namespace = MidPointConstants.NS_FUNC_BASIC;
      enableDebug = true;
    } else if (namespace.equals(MidPointConstants.NS_FUNC_BASIC)) {
      enableDebug = true;
    }

    FunctionLibrary lib = findLibrary(namespace);
    if (lib == null) {
      LOGGER.trace(
          "Unknown namespace for function {} function with {} arguments", functionQName, arity);
      return null;
    }

    Object functionObject = null;
    if (lib.getXmlFunctions() != null) {
      functionObject = lib.getXmlFunctions();
    } else {
      functionObject = lib.getGenericFunctions();
    }

    String functionName = functionQName.getLocalPart();

    LOGGER.trace("Resolving to {} function with {} arguments", functionName, arity);
    ReflectionXPathFunctionWrapper xPathFunction =
        new ReflectionXPathFunctionWrapper(functionObject, functionName, arity, enableDebug);
    return xPathFunction;
  }
Ejemplo n.º 7
0
 @BeforeClass
 public static void startLdap() throws Exception {
   LOGGER.info("------------------------------------------------------------------------------");
   LOGGER.info("START:  OpenDjUcfTest");
   LOGGER.info("------------------------------------------------------------------------------");
   openDJController.startCleanServer();
 }
Ejemplo n.º 8
0
 private void log(String message, Object... params) {
   if (LOGGER.isTraceEnabled()) {
     LOGGER.trace(message, params);
   }
   if (PERFORMANCE_ADVISOR.isTraceEnabled()) {
     PERFORMANCE_ADVISOR.trace(message, params);
   }
 }
  <F extends ObjectType> void processPasswordPolicy(
      LensProjectionContext projectionContext,
      LensContext<F> context,
      Task task,
      OperationResult result)
      throws SchemaException, PolicyViolationException {

    ObjectDelta accountDelta = projectionContext.getDelta();

    if (accountDelta == null) {
      LOGGER.trace("Skipping processing password policies. Shadow delta not specified.");
      return;
    }

    if (ChangeType.DELETE == accountDelta.getChangeType()) {
      return;
    }

    PrismObject<ShadowType> accountShadow = null;
    PrismProperty<PasswordType> password = null;
    if (ChangeType.ADD == accountDelta.getChangeType()) {
      accountShadow = accountDelta.getObjectToAdd();
      if (accountShadow != null) {
        password = accountShadow.findProperty(SchemaConstants.PATH_PASSWORD_VALUE);
      }
    }
    if (ChangeType.MODIFY == accountDelta.getChangeType() || password == null) {
      PropertyDelta<PasswordType> passwordValueDelta = null;
      if (accountDelta != null) {
        passwordValueDelta = accountDelta.findPropertyDelta(SchemaConstants.PATH_PASSWORD_VALUE);
        // Modification sanity check
        if (accountDelta.getChangeType() == ChangeType.MODIFY
            && passwordValueDelta != null
            && (passwordValueDelta.isAdd() || passwordValueDelta.isDelete())) {
          throw new SchemaException(
              "Shadow password value cannot be added or deleted, it can only be replaced");
        }
        if (passwordValueDelta == null) {
          LOGGER.trace(
              "Skipping processing password policies. Shadow delta does not contain password change.");
          return;
        }
        password = (PrismProperty<PasswordType>) passwordValueDelta.getItemNewMatchingPath(null);
      }
    }

    //		PrismProperty<PasswordType> password = getPassword(projectionContext);
    ValuePolicyType passwordPolicy = null;
    if (isCheckOrgPolicy(context)) {
      passwordPolicy = determineValuePolicy(context.getFocusContext().getObjectAny(), task, result);
      context.getFocusContext().setOrgPasswordPolicy(passwordPolicy);
    } else {
      passwordPolicy = projectionContext.getEffectivePasswordPolicy();
    }

    processPasswordPolicy(passwordPolicy, password, result);
  }
Ejemplo n.º 10
0
  /**
   * Check whether system configuration has not changed in repository (e.g. by another node in
   * cluster). Applies new configuration if so.
   *
   * @param parentResult
   */
  public void checkSystemConfigurationChanged(OperationResult parentResult) {

    OperationResult result = parentResult.createSubresult(CHECK_SYSTEM_CONFIGURATION_CHANGED);

    PrismObject<SystemConfigurationType> systemConfiguration;
    try {
      PrismObject<SystemConfigurationType> config =
          getRepositoryService()
              .getObject(
                  SystemConfigurationType.class,
                  SystemObjectsType.SYSTEM_CONFIGURATION.value(),
                  null,
                  result);

      String versionInRepo = config.getVersion();
      String versionApplied = LoggingConfigurationManager.getCurrentlyUsedVersion();

      // we do not try to determine which one is "newer" - we simply use the one from repo
      if (!versionInRepo.equals(versionApplied)) {
        LoggingConfigurationType loggingConfig =
            ProfilingConfigurationManager.checkSystemProfilingConfiguration(config);
        LoggingConfigurationManager.configure(loggingConfig, versionInRepo, result);
      } else {
        if (LOGGER.isTraceEnabled()) {
          LOGGER.trace(
              "System configuration change check: version in repo = version currently applied = {}",
              versionApplied);
        }
      }

      if (result.isUnknown()) {
        result.computeStatus();
      }

    } catch (ObjectNotFoundException e) {
      LoggingConfigurationManager
          .resetCurrentlyUsedVersion(); // because the new config (if any) will have version number
                                        // probably starting at 1 - so to be sure to read it when it
                                        // comes [hope this never occurs :)]
      String message = "No system configuration found, skipping application of system settings";
      LOGGER.error(message + ": " + e.getMessage(), e);
      result.recordWarning(message, e);
    } catch (SchemaException e) {
      String message =
          "Schema error in system configuration, skipping application of system settings";
      LOGGER.error(message + ": " + e.getMessage(), e);
      result.recordWarning(message, e);
    } catch (RuntimeException e) {
      String message =
          "Runtime exception in system configuration processing, skipping application of system settings";
      LOGGER.error(message + ": " + e.getMessage(), e);
      result.recordWarning(message, e);
    }
  }
Ejemplo n.º 11
0
  @Override
  public void notify(DelegateTask delegateTask) {

    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace(
          "notify called; event name = {}, name = {}",
          delegateTask.getEventName(),
          delegateTask.getName());
    }

    ActivitiInterface activitiInterface = SpringApplicationContextHolder.getActivitiInterface();
    activitiInterface.notifyMidpointAboutTaskEvent(delegateTask);
  }
Ejemplo n.º 12
0
  public <O extends ObjectType> List<PrismObject<O>> resolveAssignments(
      Collection<AssignmentType> assignments, Class<O> type) {
    List<PrismObject<O>> resolvedAssignments = new ArrayList<>();
    if (assignments == null) {
      return resolvedAssignments;
    }
    for (AssignmentType assignment : assignments) {
      Class clazz = null;
      String oid = null;
      if (assignment.getTargetRef() != null) {
        clazz = getClassForType(assignment.getTargetRef().getType());
        oid = assignment.getTargetRef().getOid();
      } else if (assignment.getTarget() != null) {
        clazz = assignment.getTarget().getClass();
      } else if (assignment.getTenantRef() != null) {
        clazz = getClassForType(assignment.getTenantRef().getType());
        oid = assignment.getTenantRef().getOid();
      }

      if (clazz == null && assignment.getConstruction() != null) {
        continue;
      } else {
        LOGGER.debug("Could not resolve assignment for type {}. No target type defined.", type);
      }

      if (!clazz.equals(type)) {
        continue;
      }

      if (assignment.getTarget() != null) {
        resolvedAssignments.add(assignment.getTarget().asPrismObject());
        continue;
      }

      Task task = taskManager.createTaskInstance();
      try {
        PrismObject<O> obj = model.getObject(type, oid, null, task, task.getResult());
        resolvedAssignments.add(obj);
      } catch (ObjectNotFoundException
          | SchemaException
          | SecurityViolationException
          | CommunicationException
          | ConfigurationException e) {
        LOGGER.error("Could not get object with oid " + oid + ". Reason: " + e.getMessage());
      }
    }

    return resolvedAssignments;
  }
Ejemplo n.º 13
0
 private void traceFailure(
     ExpressionEvaluationContext context, ExpressionVariables processedVariables, Exception e) {
   LOGGER.error(
       "Error evaluating expression in {}: {}",
       new Object[] {context.getContextDescription(), e.getMessage(), e});
   if (!LOGGER.isTraceEnabled()) {
     return;
   }
   StringBuilder sb = new StringBuilder();
   sb.append("Expression failure:\n");
   appendTraceHeader(sb, context, processedVariables);
   sb.append("\nERROR: ").append(e.getClass().getSimpleName()).append(": ").append(e.getMessage());
   appendTraceFooter(sb);
   LOGGER.trace(sb.toString());
 }
Ejemplo n.º 14
0
  private AccountCallableResult<List<SimpleAccountDto>> loadAccounts() throws Exception {
    LOGGER.debug("Loading accounts.");

    AccountCallableResult callableResult = new AccountCallableResult();
    List<SimpleAccountDto> list = new ArrayList<SimpleAccountDto>();
    callableResult.setValue(list);
    PrismObject<UserType> user = principalModel.getObject();
    if (user == null) {
      return callableResult;
    }

    Task task = createSimpleTask(OPERATION_LOAD_ACCOUNTS);
    OperationResult result = task.getResult();
    callableResult.setResult(result);
    Collection<SelectorOptions<GetOperationOptions>> options =
        SelectorOptions.createCollection(
            ShadowType.F_RESOURCE, GetOperationOptions.createResolve());

    List<ObjectReferenceType> references = user.asObjectable().getLinkRef();
    for (ObjectReferenceType reference : references) {
      PrismObject<ShadowType> account =
          WebModelUtils.loadObject(
              ShadowType.class, reference.getOid(), options, this, task, result);
      if (account == null) {
        continue;
      }

      ShadowType accountType = account.asObjectable();

      OperationResultType fetchResult = accountType.getFetchResult();

      if (fetchResult != null) {
        callableResult.getFetchResults().add(OperationResult.createOperationResult(fetchResult));
      }

      ResourceType resource = accountType.getResource();
      String resourceName = WebMiscUtil.getName(resource);
      list.add(
          new SimpleAccountDto(
              WebMiscUtil.getOrigStringFromPoly(accountType.getName()), resourceName));
    }
    result.recordSuccessIfUnknown();
    result.recomputeStatus();

    LOGGER.debug("Finished accounts loading.");

    return callableResult;
  }
Ejemplo n.º 15
0
  private boolean isUseObjectCounting() throws SchemaException {
    MidPointApplication application = (MidPointApplication) getApplication();
    PrismObject<ResourceType> resource = resourceModel.getObject();
    RefinedResourceSchema resourceSchema =
        RefinedResourceSchema.getRefinedSchema(resource, application.getPrismContext());

    // hacking this for now ... in future, we get the type definition (and maybe kind+intent)
    // directly from GUI model
    // TODO here we should deal with the situation that one object class is mentioned in different
    // kind/intent sections -- we would want to avoid mentioning paged search information in all
    // these sections
    ObjectClassComplexTypeDefinition typeDefinition = getAccountDefinition();
    if (typeDefinition == null) {
      // should not occur
      LOGGER.warn("ObjectClass definition couldn't be found");
      return false;
    }

    RefinedObjectClassDefinition refinedObjectClassDefinition =
        resourceSchema.getRefinedDefinition(typeDefinition.getTypeName());
    if (refinedObjectClassDefinition == null) {
      return false;
    }
    return refinedObjectClassDefinition.isObjectCountingEnabled();
  }
Ejemplo n.º 16
0
  public <O extends ObjectType> List<PrismObject<O>> resolveLinkRefs(
      Collection<ObjectReferenceType> refs, Class type) {

    List<PrismObject<O>> objects = new ArrayList<>();

    for (ObjectReferenceType ref : refs) {
      Class clazz = getClassForType(ref.getType());
      if (!clazz.equals(type)) {
        continue;
      }
      Task task = taskManager.createTaskInstance();
      OperationResult parentResult = task.getResult();
      try {
        PrismObject<O> obj =
            model.getObject(
                type,
                ref.getOid(),
                SelectorOptions.createCollection(GetOperationOptions.createResolveNames()),
                task,
                parentResult);
        objects.add(obj);
      } catch (ObjectNotFoundException
          | SchemaException
          | SecurityViolationException
          | CommunicationException
          | ConfigurationException e) {
        // TODO Auto-generated catch block
        LOGGER.error(
            "Could not get object with oid " + ref.getOid() + ". Reason: " + e.getMessage());
      }
    }
    return objects;
  }
 // region Initialization and Configuration
 @PostConstruct
 public void init() {
   processorConfigurationType = gcpConfigurationHelper.configure(this);
   if (isEnabled()) {
     // print startup message
     int scenarios = processorConfigurationType.getScenario().size();
     if (scenarios > 0) {
       LOGGER.info(
           getBeanName() + " initialized correctly (number of scenarios: " + scenarios + ")");
     } else {
       LOGGER.warn(
           getBeanName()
               + " initialized correctly, but there are no scenarios - so it will never be invoked");
     }
   }
 }
Ejemplo n.º 18
0
  public static InputStream createReport(
      ReportOutputType report,
      AjaxDownloadBehaviorFromStream ajaxDownloadBehaviorFromStream,
      PageBase pageBase) {
    OperationResult result = new OperationResult(OPERATION_DOWNLOAD_REPORT);
    ReportManager reportManager = pageBase.getReportManager();

    if (report == null) {
      return null;
    }

    String contentType = reportExportTypeMap.get(report.getExportType());
    if (StringUtils.isEmpty(contentType)) {
      contentType = "multipart/mixed; charset=UTF-8";
    }
    ajaxDownloadBehaviorFromStream.setContentType(contentType);

    InputStream input = null;
    try {
      input = reportManager.getReportOutputData(report.getOid(), result);
    } catch (Exception e) {
      pageBase.error(
          pageBase.getString("pageCreatedReports.message.downloadError") + " " + e.getMessage());
      LoggingUtils.logUnexpectedException(LOGGER, "Couldn't download report.", e);
      LOGGER.trace(result.debugDump());
    } finally {
      result.computeStatusIfUnknown();
    }

    if (WebComponentUtil.showResultInPage(result)) {
      pageBase.showResult(result);
    }

    return input;
  }
Ejemplo n.º 19
0
 private static void addMapping(Class javaClass, QName xsdType, boolean both) {
   LOGGER.trace("Adding XSD type mapping {} {} {} ", javaClass, both ? "<->" : " ->", xsdType);
   javaToXsdTypeMap.put(javaClass, xsdType);
   if (both) {
     xsdToJavaTypeMap.put(xsdType, javaClass);
   }
 }
Ejemplo n.º 20
0
  private PasswordQuestionsDto loadPageModel() {
    LOGGER.debug("Loading user for Security Question Page.");

    PasswordQuestionsDto dto = new PasswordQuestionsDto();
    OperationResult result = new OperationResult(OPERATION_LOAD_USER);
    try {

      String userOid = SecurityUtils.getPrincipalUser().getOid();
      Task task = createSimpleTask(OPERATION_LOAD_USER);
      OperationResult subResult = result.createSubresult(OPERATION_LOAD_USER);

      PrismObject<UserType> user =
          getModelService().getObject(UserType.class, userOid, null, task, subResult);

      dto.setSecurityAnswers(createUsersSecurityQuestionsList(user));

      subResult.recordSuccessIfUnknown();

    } catch (Exception ex) {
      LoggingUtils.logExceptionOnDebugLevel(
          LOGGER, "Couldn't get user Questions, Probably not set yet", ex);

    } finally {
      result.recomputeStatus();
    }
    return dto;
  }
  // TODO: maybe some caching of orgs?????
  private <T extends ObjectType, F extends ObjectType> ValuePolicyType determineValuePolicy(
      ObjectDelta<UserType> userDelta,
      PrismObject<T> object,
      LensContext<F> context,
      Task task,
      OperationResult result)
      throws SchemaException {
    // check the modification of organization first
    ValuePolicyType valuePolicy = determineValuePolicy(userDelta, task, result);

    // if null, check the existing organization
    if (valuePolicy == null) {
      valuePolicy = determineValuePolicy(object, task, result);
    }

    // if still null, just use global policy
    if (valuePolicy == null) {
      valuePolicy = context.getEffectivePasswordPolicy();
    }

    if (valuePolicy != null) {
      LOGGER.trace(
          "Value policy {} will be user to check password.", valuePolicy.getName().getOrig());
    }

    return valuePolicy;
  }
Ejemplo n.º 22
0
  private InputStream createReport() {
    OperationResult result = new OperationResult(OPERATION_DOWNLOAD_REPORT);
    ReportManager reportManager = getReportManager();

    if (currentReport == null) {
      return null;
    }

    InputStream input = null;
    try {
      input = reportManager.getReportOutputData(currentReport.getOid(), result);
    } catch (Exception e) {
      error(getString("pageCreatedReports.message.downloadError") + " " + e.getMessage());
      LoggingUtils.logException(LOGGER, "Couldn't download report.", e);
      LOGGER.trace(result.debugDump());
    } finally {
      result.computeStatusIfUnknown();
    }

    if (WebMiscUtil.showResultInPage(result)) {
      showResultInSession(result);
    }

    return input;
  }
Ejemplo n.º 23
0
  private ReportOutputSearchDto createSearchDto() {
    ReportOutputSearchDto dto = new ReportOutputSearchDto();
    Map<String, String> reportTypeMap = dto.getReportTypeMap();

    List<PrismObject<ReportType>> reportTypes =
        WebModelUtils.searchObjects(ReportType.class, null, null, getPageBase());
    LOGGER.debug("Found {} report types.", reportTypes.size());

    for (PrismObject o : reportTypes) {
      ReportType reportType = (ReportType) o.asObjectable();

      if (reportType.isParent()) {
        String name = WebMiscUtil.getName(o);
        reportTypeMap.put(name, reportType.getOid());
      }
    }

    StringValue param = getPage().getPageParameters().get(OnePageParameterEncoder.PARAMETER);
    if (param != null) {
      for (String key : dto.getReportTypeMap().keySet()) {
        if (reportTypeMap.get(key).equals(param.toString())) {
          dto.setReportType(key);
        }
      }
    }

    return dto;
  }
Ejemplo n.º 24
0
 static {
   try {
     initTypeMap();
   } catch (Exception e) {
     LOGGER.error("Cannot initialize XSD type mapping: " + e.getMessage(), e);
     throw new IllegalStateException("Cannot initialize XSD type mapping: " + e.getMessage(), e);
   }
 }
Ejemplo n.º 25
0
  private void updateDebugPerformed(AjaxRequestTarget target) {
    internalsModel.getObject().saveDebugUtil();

    LOGGER.trace("Updated debug util, detailedDebugDump={}", DebugUtil.isDetailedDebugDump());
    success(
        getString("PageInternals.message.debugUpdatePerformed", DebugUtil.isDetailedDebugDump()));
    target.add(getFeedbackPanel(), getDebugUtilForm());
  }
Ejemplo n.º 26
0
  public RootHibernateQuery interpret(
      ObjectQuery query,
      Class<? extends Containerable> type,
      Collection<SelectorOptions<GetOperationOptions>> options,
      PrismContext prismContext,
      boolean countingObjects,
      Session session)
      throws QueryException {
    Validate.notNull(type, "Type must not be null.");
    Validate.notNull(session, "Session must not be null.");
    Validate.notNull(prismContext, "Prism context must not be null.");

    if (LOGGER.isTraceEnabled()) {
      LOGGER.trace("Interpreting query for type '{}', query:\n{}", new Object[] {type, query});
    }

    InterpretationContext context = new InterpretationContext(this, type, prismContext, session);

    interpretQueryFilter(context, query);
    interpretPagingAndSorting(context, query, countingObjects);

    RootHibernateQuery hibernateQuery = context.getHibernateQuery();

    if (countingObjects) {
      hibernateQuery.addProjectionElement(new ProjectionElement("count(*)"));
    } else {
      String rootAlias = hibernateQuery.getPrimaryEntityAlias();
      hibernateQuery.addProjectionElement(new ProjectionElement(rootAlias + ".fullObject"));
      // TODO other objects if parent is requested?
      if (context.isObject()) {
        hibernateQuery.addProjectionElement(new ProjectionElement(rootAlias + ".stringsCount"));
        hibernateQuery.addProjectionElement(new ProjectionElement(rootAlias + ".longsCount"));
        hibernateQuery.addProjectionElement(new ProjectionElement(rootAlias + ".datesCount"));
        hibernateQuery.addProjectionElement(new ProjectionElement(rootAlias + ".referencesCount"));
        hibernateQuery.addProjectionElement(new ProjectionElement(rootAlias + ".polysCount"));
        hibernateQuery.addProjectionElement(new ProjectionElement(rootAlias + ".booleansCount"));
        hibernateQuery.setResultTransformer(GetObjectResult.RESULT_TRANSFORMER);
      } else {
        hibernateQuery.addProjectionElement(new ProjectionElement(rootAlias + ".ownerOid"));
        hibernateQuery.setResultTransformer(GetContainerableResult.RESULT_TRANSFORMER);
      }
    }

    return hibernateQuery;
  }
Ejemplo n.º 27
0
 private void addValue(AjaxRequestTarget target) {
   Component inputPanel = this.get(ID_VALUE_CONTAINER).get(ID_INPUT);
   ValueWrapper wrapper = valueWrapperModel.getObject();
   ItemWrapper propertyWrapper = wrapper.getItem();
   LOGGER.debug("Adding value of {}", propertyWrapper);
   propertyWrapper.addValue();
   ListView parent = findParent(ListView.class);
   target.add(parent.getParent());
 }
Ejemplo n.º 28
0
 private void traceSuccess(
     ExpressionEvaluationContext context,
     ExpressionVariables processedVariables,
     PrismValueDeltaSetTriple<V> outputTriple) {
   if (!LOGGER.isTraceEnabled()) {
     return;
   }
   StringBuilder sb = new StringBuilder();
   sb.append("Expression trace:\n");
   appendTraceHeader(sb, context, processedVariables);
   sb.append("\nResult: ");
   if (outputTriple == null) {
     sb.append("null");
   } else {
     sb.append(outputTriple.toHumanReadableString());
   }
   appendTraceFooter(sb);
   LOGGER.trace(sb.toString());
 }
Ejemplo n.º 29
0
  /** Remove the intermediate results of values processing such as secondary deltas. */
  private <F extends FocusType> void cleanupContext(LensFocusContext<F> focusContext)
      throws SchemaException {
    // We must NOT clean up activation computation. This has happened before, it will not happen
    // again
    // and it does not depend on iteration
    LOGGER.trace("Cleaning up focus context");
    focusContext.setProjectionWaveSecondaryDelta(null);

    focusContext.clearIntermediateResults();
    focusContext.recompute();
  }
Ejemplo n.º 30
0
  public String resolveRefName(ObjectReferenceType ref) {
    if (ref == null) {
      return null;
    }
    PrismReferenceValue refValue = ref.asReferenceValue();
    Object name = refValue.getTargetName() != null ? ref.getTargetName().getOrig() : null;
    if (!(name instanceof String)) {
      LOGGER.error("Couldn't resolve object name");
    }

    return (String) name;
  }