use of com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType in project midpoint by Evolveum.
the class PageArchetypes method initLayout.
private void initLayout() {
Form mainForm = new MidpointForm(ID_MAIN_FORM);
add(mainForm);
MainObjectListPanel<ArchetypeType> table = new MainObjectListPanel<ArchetypeType>(ID_TABLE, ArchetypeType.class) {
@Override
protected TableId getTableId() {
return UserProfileStorage.TableId.TABLE_ARCHETYPES;
}
@Override
protected IColumn<SelectableBean<ArchetypeType>, String> createCheckboxColumn() {
return null;
}
};
table.setOutputMarkupId(true);
mainForm.add(table);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType in project midpoint by Evolveum.
the class SqaleRepoAddDeleteObjectTest method test821ArchetypeAndInducement.
// This covers mapping of attributes in AbstractRole + Archetype + inducement mapping.
// There is no focus on QFocusMapping that is covered above.
@Test
public void test821ArchetypeAndInducement() throws Exception {
OperationResult result = createOperationResult();
given("archetype object");
String objectName = "arch" + getTestNumber();
ArchetypeType archetype = new ArchetypeType(prismContext).name(objectName).autoassign(new AutoassignSpecificationType().enabled(true)).displayName("display-name").identifier("identifier").requestable(false).riskLevel("extremely-high").inducement(new AssignmentType(prismContext).order(2).targetRef(UUID.randomUUID().toString(), RoleType.COMPLEX_TYPE)).inducement(new AssignmentType(prismContext).order(3).targetRef(UUID.randomUUID().toString(), RoleType.COMPLEX_TYPE));
// this is no additional attribute specific for archetype
when("adding it to the repository");
repositoryService.addObject(archetype.asPrismObject(), null, result);
then("it is stored and relevant attributes are in columns");
assertThatOperationResult(result).isSuccess();
UUID archetypeOid = UUID.fromString(archetype.getOid());
MArchetype row = selectObjectByOid(QArchetype.class, archetypeOid);
// all attributes from MAbstractRole
assertThat(row.autoAssignEnabled).isTrue();
assertThat(row.displayNameOrig).isEqualTo("display-name");
assertThat(row.displayNameNorm).isEqualTo("displayname");
assertThat(row.identifier).isEqualTo("identifier");
assertThat(row.requestable).isFalse();
assertThat(row.riskLevel).isEqualTo("extremely-high");
QAssignment<?> a = QAssignmentMapping.getAssignmentMapping().defaultAlias();
assertThat(select(a, a.ownerOid.eq(archetypeOid))).hasSize(2).anyMatch(ar -> ar.orderValue.equals(2)).anyMatch(ar -> ar.orderValue.equals(3)).allMatch(ar -> ar.targetRefTargetOid != null && ar.targetRefTargetType == MObjectType.ROLE);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType in project midpoint by Evolveum.
the class TestRepositoryCache method test300ModifyInIterativeSearch.
/**
* MID-6250
*/
@Test
public void test300ModifyInIterativeSearch() throws SchemaException, ObjectNotFoundException, ObjectAlreadyExistsException {
given();
PrismContext prismContext = getPrismContext();
OperationResult result = createOperationResult();
clearStatistics();
clearCaches();
String name = "testModifyInIterativeSearch";
String changedDescription = "changed";
PrismObject<ArchetypeType> archetype = new ArchetypeType(prismContext).name(name).asPrismObject();
repositoryCache.addObject(archetype, null, result);
when();
ObjectQuery query = prismContext.queryFor(ArchetypeType.class).item(ArchetypeType.F_NAME).eqPoly(name).matchingOrig().build();
List<ItemDelta<?, ?>> deltas = prismContext.deltaFor(ArchetypeType.class).item(ArchetypeType.F_DESCRIPTION).replace(changedDescription).asItemDeltas();
AtomicInteger found = new AtomicInteger(0);
ResultHandler<ArchetypeType> handler = (object, result1) -> {
try {
repositoryCache.modifyObject(ArchetypeType.class, object.getOid(), deltas, result1);
} catch (ObjectNotFoundException | SchemaException | ObjectAlreadyExistsException e) {
throw new AssertionError(e);
}
found.incrementAndGet();
return true;
};
repositoryCache.searchObjectsIterative(ArchetypeType.class, query, handler, null, false, result);
dumpStatistics();
assertThat(found.get()).as("objects found").isEqualTo(1);
PrismObject<ArchetypeType> singleObjectAfter = repositoryCache.getObject(ArchetypeType.class, archetype.getOid(), null, result);
List<PrismObject<ArchetypeType>> listAfter = repositoryCache.searchObjects(ArchetypeType.class, query, null, result);
then();
assertThat(singleObjectAfter.asObjectable().getDescription()).as("description in getObject result (after change)").isEqualTo(changedDescription);
assertThat(listAfter.size()).as("objects found after").isEqualTo(1);
assertThat(listAfter.get(0).asObjectable().getDescription()).as("description in searchObjects result (after change)").isEqualTo(changedDescription);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType in project midpoint by Evolveum.
the class TestRepositoryCache method test320SearchObjectsIterativeSlow.
/**
* MID-6250
*/
@Test
public void test320SearchObjectsIterativeSlow() throws ObjectAlreadyExistsException, SchemaException, ObjectNotFoundException {
OperationResult result = createOperationResult();
deleteExistingObjects(ArchetypeType.class, result);
clearStatistics();
clearCaches();
generateObjects(ArchetypeType.class, 5, result);
when();
SearchResultList<PrismObject<ArchetypeType>> retrieved = new SearchResultList<>();
AtomicBoolean delayed = new AtomicBoolean(false);
ResultHandler<ArchetypeType> handler = (object, parentResult) -> {
retrieved.add(object.clone());
object.asObjectable().setDescription("garbage: " + Math.random());
if (!delayed.getAndSet(true)) {
try {
// larger than default staleness limit of 1000 ms
Thread.sleep(1500);
} catch (InterruptedException e) {
throw new AssertionError(e);
}
}
return true;
};
repositoryCache.searchObjectsIterative(ArchetypeType.class, null, handler, null, true, result);
then();
dumpStatistics();
assertObjectIsCached(retrieved.get(0).getOid());
assertVersionIsCached(retrieved.get(0).getOid());
for (int i = 1; i < retrieved.size(); i++) {
assertObjectIsNotCached(retrieved.get(i).getOid());
assertVersionIsNotCached(retrieved.get(i).getOid());
}
assertQueryIsNotCached(ArchetypeType.class, null);
Map<String, CachePerformanceCollector.CacheData> map = CachePerformanceCollector.INSTANCE.getGlobalPerformanceMap();
CachePerformanceCollector.CacheData data = map.get("all.ArchetypeType");
// 4 objects + 1 search result
assertThat(data.skippedStaleData.get()).as("stale data counter").isEqualTo(5);
}
use of com.evolveum.midpoint.xml.ns._public.common.common_3.ArchetypeType in project midpoint by Evolveum.
the class PageArchetype method createMainPanel.
@Override
protected AbstractObjectMainPanel<ArchetypeType> createMainPanel(String id) {
return new AbstractRoleMainPanel<>(id, getObjectModel(), getProjectionModel(), this) {
private static final long serialVersionUID = 1L;
@Override
public AbstractRoleMemberPanel<ArchetypeType> createMemberPanel(String panelId, PageBase pageBase) {
return new ArchetypeMembersPanel(panelId, new Model<>(getObject().asObjectable()), pageBase);
}
@Override
protected List<ITab> createTabs(PageAdminObjectDetails<ArchetypeType> parentPage) {
List<ITab> tabs = super.createTabs(parentPage);
tabs.add(new PanelTab(parentPage.createStringResource("PageArchetype.archetypePolicy"), getTabVisibility(ComponentConstants.UI_ARCHTYPE_TAB_ARCHETYPE_POLICY_URL, false, parentPage)) {
private static final long serialVersionUID = 1L;
@Override
public WebMarkupContainer createPanel(String panelId) {
return new ContainerOfSystemConfigurationPanel<ArchetypePolicyType>(panelId, PrismContainerWrapperModel.fromContainerWrapper(getObjectModel(), ArchetypeType.F_ARCHETYPE_POLICY), ArchetypePolicyType.COMPLEX_TYPE);
}
});
return tabs;
}
};
}
Aggregations