Search in sources :

Example 6 with RoleType

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

the class PageRoles method initLayout.

private void initLayout() {
    Form mainForm = new Form(ID_MAIN_FORM);
    add(mainForm);
    MainObjectListPanel<RoleType> roleListPanel = new MainObjectListPanel<RoleType>(ID_TABLE, RoleType.class, TableId.TABLE_ROLES, null, this) {

        @Override
        protected List<InlineMenuItem> createInlineMenu() {
            return listInlineMenuHelper.createRowActions(false);
        }

        @Override
        protected List<IColumn<SelectableBean<RoleType>, String>> createColumns() {
            return PageRoles.this.initColumns();
        }

        @Override
        protected IColumn<SelectableBean<RoleType>, String> createActionsColumn() {
            return PageRoles.this.createActionsColumn();
        }

        @Override
        protected void objectDetailsPerformed(AjaxRequestTarget target, RoleType object) {
            PageRoles.this.roleDetailsPerformed(target, object.getOid());
            ;
        }

        @Override
        protected void newObjectPerformed(AjaxRequestTarget target) {
            navigateToNext(PageRole.class);
        }
    };
    roleListPanel.setOutputMarkupId(true);
    roleListPanel.setAdditionalBoxCssClasses(GuiStyleConstants.CLASS_OBJECT_ROLE_BOX_CSS_CLASSES);
    mainForm.add(roleListPanel);
}
Also used : AjaxRequestTarget(org.apache.wicket.ajax.AjaxRequestTarget) MainObjectListPanel(com.evolveum.midpoint.gui.api.component.MainObjectListPanel) Form(org.apache.wicket.markup.html.form.Form) IColumn(org.apache.wicket.extensions.markup.html.repeater.data.table.IColumn) RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) SelectableBean(com.evolveum.midpoint.web.component.util.SelectableBean) InlineMenuItem(com.evolveum.midpoint.web.component.menu.cog.InlineMenuItem)

Example 7 with RoleType

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

the class PageAccounts method ownerDetailsPerformed.

private <F extends FocusType> void ownerDetailsPerformed(AjaxRequestTarget target, IModel<SelectableBean> model) {
    F focus = loadShadowOwner(model);
    if (focus == null) {
        error(getString("PageAccounts.message.cantShowOwner"));
        target.add(getFeedbackPanel());
        return;
    }
    PageParameters parameters = new PageParameters();
    parameters.add(OnePageParameterEncoder.PARAMETER, focus.getOid());
    if (focus instanceof UserType) {
        navigateToNext(PageUser.class, parameters);
    } else if (focus instanceof RoleType) {
        navigateToNext(PageRole.class, parameters);
    } else if (focus instanceof OrgType) {
        navigateToNext(PageOrgUnit.class, parameters);
    } else {
        error(getString("PageAccounts.message.unsupportedOwnerType"));
        target.add(getFeedbackPanel());
        return;
    }
}
Also used : RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) PageRole(com.evolveum.midpoint.web.page.admin.roles.PageRole) OrgType(com.evolveum.midpoint.xml.ns._public.common.common_3.OrgType) PageParameters(org.apache.wicket.request.mapper.parameter.PageParameters) UserType(com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)

Example 8 with RoleType

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

the class TestSchemaDelta method testDeleteInducementActivationSameNullIdApplyToObject.

@Test
public void testDeleteInducementActivationSameNullIdApplyToObject() throws Exception {
    final String TEST_NAME = "testDeleteInducementActivationSameNullIdApplyToObject";
    displayTestTile(TEST_NAME);
    // GIVEN
    PrismObject<RoleType> role = PrismTestUtil.parseObject(ROLE_CONSTRUCTION_FILE);
    //Delta
    ActivationType activationType = new ActivationType();
    activationType.setAdministrativeStatus(ActivationStatusType.ENABLED);
    // No container ID
    ObjectDelta<RoleType> roleDelta = ObjectDelta.createModificationDeleteContainer(RoleType.class, ROLE_CONSTRUCTION_OID, new ItemPath(new NameItemPathSegment(RoleType.F_INDUCEMENT), new IdItemPathSegment(ROLE_CONSTRUCTION_INDUCEMENT_ID), new NameItemPathSegment(AssignmentType.F_ACTIVATION)), getPrismContext(), activationType);
    // WHEN
    roleDelta.applyTo(role);
    // THEN
    System.out.println("Role after delta application:");
    System.out.println(role.debugDump());
    assertEquals("Wrong OID", ROLE_CONSTRUCTION_OID, role.getOid());
    PrismAsserts.assertPropertyValue(role, UserType.F_NAME, PrismTestUtil.createPolyString("Construction"));
    PrismContainer<AssignmentType> inducementContainer = role.findContainer(RoleType.F_INDUCEMENT);
    assertNotNull("No inducement", inducementContainer);
    assertEquals("Unexpected number of inducement values", 1, inducementContainer.size());
    PrismContainerValue<AssignmentType> inducementValue = inducementContainer.getValues().iterator().next();
    AssignmentType inducement = inducementValue.asContainerable();
    ActivationType activation = inducement.getActivation();
    // activation should be gone (the error is that it is empty and not gone)
    assertNull("Activation is not gone", activation);
}
Also used : RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) ActivationType(com.evolveum.midpoint.xml.ns._public.common.common_3.ActivationType) IdItemPathSegment(com.evolveum.midpoint.prism.path.IdItemPathSegment) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) NameItemPathSegment(com.evolveum.midpoint.prism.path.NameItemPathSegment) ItemPath(com.evolveum.midpoint.prism.path.ItemPath) Test(org.testng.annotations.Test)

Example 9 with RoleType

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

the class TestSchemaDelta method testDeleteInducementValidIdEmptyValueApplyToObject.

@Test
public void testDeleteInducementValidIdEmptyValueApplyToObject() throws Exception {
    final String TEST_NAME = "testDeleteInducementValidIdEmptyValueApplyToObject";
    displayTestTile(TEST_NAME);
    // GIVEN
    PrismObject<RoleType> role = PrismTestUtil.parseObject(ROLE_CONSTRUCTION_FILE);
    //Delta
    AssignmentType inducement = new AssignmentType();
    inducement.setId(ROLE_CONSTRUCTION_INDUCEMENT_ID);
    ObjectDelta<RoleType> roleDelta = ObjectDelta.createModificationDeleteContainer(RoleType.class, ROLE_CONSTRUCTION_OID, RoleType.F_INDUCEMENT, getPrismContext(), inducement);
    // WHEN
    roleDelta.applyTo(role);
    // THEN
    System.out.println("Role after delta application:");
    System.out.println(role.debugDump());
    assertEquals("Wrong OID", ROLE_CONSTRUCTION_OID, role.getOid());
    PrismAsserts.assertPropertyValue(role, UserType.F_NAME, PrismTestUtil.createPolyString("Construction"));
    PrismContainer<AssignmentType> assignment = role.findContainer(RoleType.F_INDUCEMENT);
    assertNull("Unexpected inducement", assignment);
}
Also used : RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) AssignmentType(com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType) Test(org.testng.annotations.Test)

Example 10 with RoleType

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

the class TestSchemaRegistry method testRoleType.

@Test
public void testRoleType() throws Exception {
    MidPointPrismContextFactory factory = getContextFactory();
    PrismContext context = factory.createInitializedPrismContext();
    SchemaRegistry schemaRegistry = context.getSchemaRegistry();
    PrismObjectDefinition<RoleType> roleDefinition = schemaRegistry.findObjectDefinitionByCompileTimeClass(RoleType.class);
    assertNotNull("No role definition", roleDefinition);
    assertFalse("Role definition is marked as runtime", roleDefinition.isRuntimeSchema());
    PrismPropertyDefinition nameDef = roleDefinition.findPropertyDefinition(ObjectType.F_NAME);
    assertNotNull("No name definition", nameDef);
    PrismContainerDefinition extensionDef = roleDefinition.findContainerDefinition(ObjectType.F_EXTENSION);
    assertNotNull("No 'extension' definition", extensionDef);
    assertTrue("Extension definition is NOT marked as runtime", extensionDef.isRuntimeSchema());
    PrismPropertyDefinition identifierDef = roleDefinition.findPropertyDefinition(RoleType.F_IDENTIFIER);
    assertNotNull("No identifier definition", identifierDef);
    // Just make sure this does not end with NPE or stack overflow
    PrismObjectDefinition<RoleType> shallowClone = roleDefinition.clone();
    PrismObjectDefinition<RoleType> deepClone = roleDefinition.deepClone(false);
    PrismObjectDefinition<RoleType> ultraDeepClone = roleDefinition.deepClone(true);
}
Also used : RoleType(com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType) SchemaRegistry(com.evolveum.midpoint.prism.schema.SchemaRegistry) Test(org.testng.annotations.Test)

Aggregations

RoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.RoleType)67 Test (org.testng.annotations.Test)44 OperationResult (com.evolveum.midpoint.schema.result.OperationResult)39 Task (com.evolveum.midpoint.task.api.Task)34 AbstractInitializedModelIntegrationTest (com.evolveum.midpoint.model.intest.AbstractInitializedModelIntegrationTest)18 AssignmentType (com.evolveum.midpoint.xml.ns._public.common.common_3.AssignmentType)15 ItemPath (com.evolveum.midpoint.prism.path.ItemPath)13 UserType (com.evolveum.midpoint.xml.ns._public.common.common_3.UserType)9 NameItemPathSegment (com.evolveum.midpoint.prism.path.NameItemPathSegment)8 AbstractRoleType (com.evolveum.midpoint.xml.ns._public.common.common_3.AbstractRoleType)8 ObjectReferenceType (com.evolveum.midpoint.xml.ns._public.common.common_3.ObjectReferenceType)8 QName (javax.xml.namespace.QName)7 IdItemPathSegment (com.evolveum.midpoint.prism.path.IdItemPathSegment)6 ShadowType (com.evolveum.midpoint.xml.ns._public.common.common_3.ShadowType)6 PrismObject (com.evolveum.midpoint.prism.PrismObject)5 PrismReferenceValue (com.evolveum.midpoint.prism.PrismReferenceValue)5 PolicyViolationException (com.evolveum.midpoint.util.exception.PolicyViolationException)5 File (java.io.File)5 ObjectDelta (com.evolveum.midpoint.prism.delta.ObjectDelta)4 PolyString (com.evolveum.midpoint.prism.polystring.PolyString)4