Search in sources :

Example 1 with InformationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType in project midpoint by Evolveum.

the class InformationPanel method initLayout.

private void initLayout() {
    Label titleLabel = new Label(ID_TITLE, new LocalizableMessageModel(new IModel<LocalizableMessageType>() {

        @Override
        public LocalizableMessageType getObject() {
            InformationType info = getModelObject();
            if (info == null || info.getTitle() == null && info.getLocalizableTitle() == null) {
                return new SingleLocalizableMessageType().fallbackMessage("ApprovalStageDefinitionType.additionalInformation");
            }
            return getLocalizableMessageOrDefault(info.getLocalizableTitle(), info.getTitle());
        }
    }, this));
    titleLabel.add(new VisibleBehaviour(() -> getModelObject() != null));
    add(titleLabel);
    ListView<InformationPartType> list = new ListView<InformationPartType>(ID_PARTS, new PropertyModel<>(getModel(), InformationType.F_PART.getLocalPart())) {

        @Override
        protected void populateItem(ListItem<InformationPartType> item) {
            InformationPartType part = item.getModelObject();
            Label label = new Label(ID_PART, part != null ? WebComponentUtil.resolveLocalizableMessage(getLocalizableMessageOrDefault(part.getLocalizableText(), part.getText()), InformationPanel.this) : "");
            if (Boolean.TRUE.equals(part.isHasMarkup())) {
                label.setEscapeModelStrings(false);
            }
            item.add(label);
        }
    };
    add(list);
}
Also used : IModel(org.apache.wicket.model.IModel) ListView(org.apache.wicket.markup.html.list.ListView) VisibleBehaviour(com.evolveum.midpoint.web.component.util.VisibleBehaviour) Label(org.apache.wicket.markup.html.basic.Label) LocalizableMessageModel(com.evolveum.midpoint.web.component.util.LocalizableMessageModel) ListItem(org.apache.wicket.markup.html.list.ListItem) InformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType) InformationPartType(com.evolveum.midpoint.xml.ns._public.common.common_3.InformationPartType) SingleLocalizableMessageType(com.evolveum.midpoint.xml.ns._public.common.common_3.SingleLocalizableMessageType)

Example 2 with InformationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType in project midpoint by Evolveum.

the class MidpointParsingMigrator method stringToInformationType.

public static InformationType stringToInformationType(String s) {
    InformationType info = new InformationType();
    InformationPartType part = new InformationPartType();
    part.setLocalizableText(LocalizationUtil.createForFallbackMessage(s));
    info.getPart().add(part);
    return info;
}
Also used : InformationType(com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType) InformationPartType(com.evolveum.midpoint.xml.ns._public.common.common_3.InformationPartType)

Example 3 with InformationType

use of com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType in project midpoint by Evolveum.

the class PrepareForTaskCreation method wrapAdditionalInformationIfNeeded.

@SuppressWarnings("unchecked")
private List<InformationType> wrapAdditionalInformationIfNeeded(List<?> data) {
    // data is not empty
    if (data.stream().allMatch(o -> o instanceof String)) {
        InformationType info = new InformationType();
        for (Object o : data) {
            InformationPartType part = new InformationPartType();
            part.setText((String) o);
            info.getPart().add(part);
        }
        return Collections.singletonList(info);
    } else if (data.stream().allMatch(o -> o instanceof InformationType)) {
        return (List<InformationType>) data;
    } else {
        throw new SystemException("Couldn't create 'additional information' structure from list of " + data.stream().map(o -> o != null ? o.getClass().getSimpleName() : null).collect(Collectors.joining(", ", "[", "]")));
    }
}
Also used : SpringApplicationContextHolder.getTaskManager(com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder.getTaskManager) SingleItemSerializationSafeContainerImpl(com.evolveum.midpoint.wf.impl.util.SingleItemSerializationSafeContainerImpl) com.evolveum.midpoint.xml.ns._public.common.common_3(com.evolveum.midpoint.xml.ns._public.common.common_3) com.evolveum.midpoint.wf.impl.processes.common(com.evolveum.midpoint.wf.impl.processes.common) OperationResult(com.evolveum.midpoint.schema.result.OperationResult) Trace(com.evolveum.midpoint.util.logging.Trace) Task(com.evolveum.midpoint.task.api.Task) MiscDataUtil(com.evolveum.midpoint.wf.impl.util.MiscDataUtil) Collectors(java.util.stream.Collectors) DOMUtil(com.evolveum.midpoint.util.DOMUtil) QNameUtil(com.evolveum.midpoint.util.QNameUtil) JavaDelegate(org.activiti.engine.delegate.JavaDelegate) ExpressionVariables(com.evolveum.midpoint.repo.common.expression.ExpressionVariables) List(java.util.List) SpringApplicationContextHolder.getPrismContext(com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder.getPrismContext) ActivitiUtil.getRequiredVariable(com.evolveum.midpoint.wf.impl.processes.common.ActivitiUtil.getRequiredVariable) PrismContext(com.evolveum.midpoint.prism.PrismContext) SystemException(com.evolveum.midpoint.util.exception.SystemException) DelegateExecution(org.activiti.engine.delegate.DelegateExecution) Collections(java.util.Collections) TraceManager(com.evolveum.midpoint.util.logging.TraceManager) SystemException(com.evolveum.midpoint.util.exception.SystemException)

Aggregations

InformationPartType (com.evolveum.midpoint.xml.ns._public.common.common_3.InformationPartType)2 InformationType (com.evolveum.midpoint.xml.ns._public.common.common_3.InformationType)2 PrismContext (com.evolveum.midpoint.prism.PrismContext)1 ExpressionVariables (com.evolveum.midpoint.repo.common.expression.ExpressionVariables)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 Task (com.evolveum.midpoint.task.api.Task)1 DOMUtil (com.evolveum.midpoint.util.DOMUtil)1 QNameUtil (com.evolveum.midpoint.util.QNameUtil)1 SystemException (com.evolveum.midpoint.util.exception.SystemException)1 Trace (com.evolveum.midpoint.util.logging.Trace)1 TraceManager (com.evolveum.midpoint.util.logging.TraceManager)1 LocalizableMessageModel (com.evolveum.midpoint.web.component.util.LocalizableMessageModel)1 VisibleBehaviour (com.evolveum.midpoint.web.component.util.VisibleBehaviour)1 com.evolveum.midpoint.wf.impl.processes.common (com.evolveum.midpoint.wf.impl.processes.common)1 ActivitiUtil.getRequiredVariable (com.evolveum.midpoint.wf.impl.processes.common.ActivitiUtil.getRequiredVariable)1 SpringApplicationContextHolder.getPrismContext (com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder.getPrismContext)1 SpringApplicationContextHolder.getTaskManager (com.evolveum.midpoint.wf.impl.processes.common.SpringApplicationContextHolder.getTaskManager)1 MiscDataUtil (com.evolveum.midpoint.wf.impl.util.MiscDataUtil)1 SingleItemSerializationSafeContainerImpl (com.evolveum.midpoint.wf.impl.util.SingleItemSerializationSafeContainerImpl)1 com.evolveum.midpoint.xml.ns._public.common.common_3 (com.evolveum.midpoint.xml.ns._public.common.common_3)1