Search in sources :

Example 11 with MetadataType

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

the class MetadataFactory method toJAXB.

public static MetadataType toJAXB(Metadata repo, PrismContext context) {
    if (isNull(repo)) {
        return null;
    }
    MetadataType jaxb = new MetadataType();
    jaxb.setCreateChannel(repo.getCreateChannel());
    jaxb.setCreateTimestamp(repo.getCreateTimestamp());
    jaxb.setModifyChannel(repo.getModifyChannel());
    jaxb.setModifyTimestamp(repo.getModifyTimestamp());
    if (repo.getCreatorRef() != null) {
        jaxb.setCreatorRef(repo.getCreatorRef().toJAXB(context));
    }
    if (repo.getModifierRef() != null) {
        jaxb.setModifierRef(repo.getModifierRef().toJAXB(context));
    }
    if (repo instanceof RObject) {
        List refs = RUtil.safeSetReferencesToList(repo.getCreateApproverRef(), context);
        if (!refs.isEmpty()) {
            jaxb.getCreateApproverRef().addAll(refs);
        }
        refs = RUtil.safeSetReferencesToList(repo.getModifyApproverRef(), context);
        if (!refs.isEmpty()) {
            jaxb.getModifyApproverRef().addAll(refs);
        }
    } else {
    }
    return jaxb;
}
Also used : RObject(com.evolveum.midpoint.repo.sql.data.common.RObject) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) List(java.util.List)

Example 12 with MetadataType

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

the class AbstractModelIntegrationTest method assertPasswordMetadata.

protected void assertPasswordMetadata(PrismObject<UserType> user, QName credentialType, boolean create, XMLGregorianCalendar start, XMLGregorianCalendar end, String actorOid, String channel) {
    PrismContainer<MetadataType> metadataContainer = user.findContainer(new ItemPath(UserType.F_CREDENTIALS, credentialType, PasswordType.F_METADATA));
    assertNotNull("No password metadata in " + user, metadataContainer);
    MetadataType metadataType = metadataContainer.getValue().asContainerable();
    assertMetadata("password metadata in " + user, metadataType, create, false, start, end, actorOid, channel);
}
Also used : MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 13 with MetadataType

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

the class AbstractModelIntegrationTest method assertPasswordMetadata.

@Deprecated
protected void assertPasswordMetadata(PrismObject<UserType> user, boolean create, XMLGregorianCalendar start, XMLGregorianCalendar end, String actorOid, String channel) {
    PrismContainer<MetadataType> metadataContainer = user.findContainer(new ItemPath(UserType.F_CREDENTIALS, CredentialsType.F_PASSWORD, PasswordType.F_METADATA));
    assertNotNull("No password metadata in " + user, metadataContainer);
    MetadataType metadataType = metadataContainer.getValue().asContainerable();
    assertMetadata("password metadata in " + user, metadataType, create, false, start, end, actorOid, channel);
}
Also used : MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 14 with MetadataType

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

the class PrismObjectPanel method createMetadataPanel.

protected void createMetadataPanel(IModel<ObjectWrapper<O>> model, ListItem<ContainerWrapper> item, PrismContainerPanel containerPanel) {
    //check if metadata container exists for
    //the current item and create metadata panel if yes
    Component metadataPanel;
    //becomes visible only in case metadata exists
    Model<Boolean> metadataVisibility = Model.of(false);
    ItemPath metadataContainerPath = item.getModelObject().isMain() ? new ItemPath(ObjectType.F_METADATA) : new ItemPath(item.getModelObject().getPath(), ObjectType.F_METADATA);
    if (model.getObject().findContainerWrapper(metadataContainerPath) != null) {
        ContainerWrapper<MetadataType> metadataContainer = model.getObject().findContainerWrapper(metadataContainerPath);
        metadataVisibility.setObject(true);
        String containerName = item.getModelObject().isMain() ? "Object" : StringUtils.capitalize(item.getModelObject().getPath().last().toString());
        metadataPanel = new MetadataPanel(ID_CONTAINER_METADATA, new AbstractReadOnlyModel<MetadataType>() {

            @Override
            public MetadataType getObject() {
                return metadataContainer.getItem().getRealValue();
            }
        }, containerName, "");
    } else {
        metadataPanel = new WebMarkupContainer(ID_CONTAINER_METADATA);
    }
    metadataPanel.add(new VisibleEnableBehaviour() {

        @Override
        public boolean isVisible() {
            return containerPanel.isVisible() && metadataVisibility.getObject() && model.getObject().isShowMetadata() && !ContainerStatus.ADDING.equals(model.getObject().getStatus());
        }
    });
    metadataPanel.setOutputMarkupId(true);
    item.add(metadataPanel);
}
Also used : AbstractReadOnlyModel(org.apache.wicket.model.AbstractReadOnlyModel) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) MetadataPanel(com.evolveum.midpoint.web.component.assignment.MetadataPanel) VisibleEnableBehaviour(com.evolveum.midpoint.web.component.util.VisibleEnableBehaviour) Component(org.apache.wicket.Component) WebMarkupContainer(org.apache.wicket.markup.html.WebMarkupContainer) ItemPath(com.evolveum.midpoint.prism.path.ItemPath)

Example 15 with MetadataType

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

the class TestDiffEquals method testAssignmentEquals.

@Test
public void testAssignmentEquals() throws Exception {
    System.out.println("\n\n===[ testAssignmentEquals ]===\n");
    PrismContext prismContext = PrismTestUtil.getPrismContext();
    AssignmentType a1a = new AssignmentType();
    prismContext.adopt(a1a);
    a1a.setDescription("descr1");
    AssignmentType a2 = new AssignmentType();
    prismContext.adopt(a2);
    a2.setDescription("descr2");
    AssignmentType a1b = new AssignmentType();
    prismContext.adopt(a1b);
    a1b.setDescription("descr1");
    AssignmentType a1m = new AssignmentType();
    prismContext.adopt(a1m);
    a1m.setDescription("descr1");
    MetadataType metadata1m = new MetadataType();
    metadata1m.setCreateTimestamp(XmlTypeConverter.createXMLGregorianCalendar(System.currentTimeMillis()));
    a1m.setMetadata(metadata1m);
    AssignmentType a1e = new AssignmentType();
    prismContext.adopt(a1e);
    a1e.setDescription("descr1");
    ActivationType activation1e = new ActivationType();
    activation1e.setEffectiveStatus(ActivationStatusType.ENABLED);
    a1e.setActivation(activation1e);
    // WHEN
    assertFalse(a1a.equals(a2));
    assertFalse(a1b.equals(a2));
    assertFalse(a1m.equals(a2));
    assertFalse(a1e.equals(a2));
    assertFalse(a2.equals(a1a));
    assertFalse(a2.equals(a1b));
    assertFalse(a2.equals(a1m));
    assertFalse(a2.equals(a1e));
    assertTrue(a1a.equals(a1a));
    assertTrue(a1b.equals(a1b));
    assertTrue(a1m.equals(a1m));
    assertTrue(a1e.equals(a1e));
    assertTrue(a2.equals(a2));
    assertTrue(a1a.equals(a1b));
    assertTrue(a1b.equals(a1a));
    assertTrue(a1a.equals(a1m));
    assertTrue(a1b.equals(a1m));
    assertTrue(a1m.equals(a1a));
    assertTrue(a1m.equals(a1b));
    assertTrue(a1m.equals(a1e));
    assertTrue(a1a.equals(a1e));
    assertTrue(a1b.equals(a1e));
    assertTrue(a1e.equals(a1a));
    assertTrue(a1e.equals(a1b));
    assertTrue(a1e.equals(a1m));
}
Also used : PrismContext(com.evolveum.midpoint.prism.PrismContext) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) MetadataType(com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType) Test(org.testng.annotations.Test)

Aggregations

MetadataType (com.evolveum.midpoint.xml.ns._public.common.common_3.MetadataType)23 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)4 ActivationType (com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType)4 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)4 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)3 PrismContext (com.evolveum.midpoint.prism.PrismContext)2 ProtectedStringType (com.evolveum.prism.xml.ns._public.types_3.ProtectedStringType)2 AbstractReadOnlyModel (org.apache.wicket.model.AbstractReadOnlyModel)2 Test (org.testng.annotations.Test)2 LoadableModel (com.evolveum.midpoint.gui.api.model.LoadableModel)1 PrismContainerDefinition (com.evolveum.midpoint.prism.PrismContainerDefinition)1 PrismContainerValue (com.evolveum.midpoint.prism.PrismContainerValue)1 PrismReferenceDefinition (com.evolveum.midpoint.prism.PrismReferenceDefinition)1 ContainerDelta (com.evolveum.midpoint.prism.delta.ContainerDelta)1 ItemDelta (com.evolveum.midpoint.prism.delta.ItemDelta)1 RObject (com.evolveum.midpoint.repo.sql.data.common.RObject)1 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)1 DateLabelComponent (com.evolveum.midpoint.web.component.DateLabelComponent)1 MetadataPanel (com.evolveum.midpoint.web.component.assignment.MetadataPanel)1 CheckBoxHeaderColumn (com.evolveum.midpoint.web.component.data.column.CheckBoxHeaderColumn)1