use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class TestRetirement method createUser.
private PrismObject<UserType> createUser(String username, String givenName, String familyName, String parentOrgOid) throws SchemaException {
PrismObject<UserType> user = prismContext.getSchemaRegistry().findObjectDefinitionByCompileTimeClass(UserType.class).instantiate();
UserType userType = user.asObjectable();
userType.setName(new PolyStringType(username));
userType.setGivenName(new PolyStringType(givenName));
userType.setFamilyName(new PolyStringType(familyName));
userType.setFullName(new PolyStringType(givenName + " " + familyName));
if (parentOrgOid != null) {
AssignmentType parentAssignment = new AssignmentType();
ObjectReferenceType parentAssignmentTargetRef = new ObjectReferenceType();
parentAssignmentTargetRef.setOid(parentOrgOid);
parentAssignmentTargetRef.setType(OrgType.COMPLEX_TYPE);
parentAssignment.setTargetRef(parentAssignmentTargetRef);
userType.getAssignment().add(parentAssignment);
}
return user;
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class PageSelfRegistration method initStaticFormLayout.
private void initStaticFormLayout(Form<?> mainForm) {
// feedback
FeedbackPanel feedback = new FeedbackPanel(ID_FEEDBACK, new ContainerFeedbackMessageFilter(PageSelfRegistration.this));
feedback.setOutputMarkupId(true);
mainForm.add(feedback);
WebMarkupContainer staticRegistrationForm = createMarkupContainer(ID_STATIC_FORM, new VisibleEnableBehaviour() {
private static final long serialVersionUID = 1L;
@Override
public boolean isVisible() {
return getSelfRegistrationConfiguration().getFormRef() == null;
}
}, mainForm);
TextPanel<String> firstName = new TextPanel<>(ID_FIRST_NAME, new PropertyModel<String>(userModel, UserType.F_GIVEN_NAME.getLocalPart() + ".orig") {
private static final long serialVersionUID = 1L;
@Override
public void setObject(String object) {
userModel.getObject().setGivenName(new PolyStringType(object));
}
});
initInputProperties(feedback, firstName);
staticRegistrationForm.add(firstName);
TextPanel<String> lastName = new TextPanel<>(ID_LAST_NAME, new PropertyModel<String>(userModel, UserType.F_FAMILY_NAME.getLocalPart() + ".orig") {
private static final long serialVersionUID = 1L;
@Override
public void setObject(String object) {
userModel.getObject().setFamilyName(new PolyStringType(object));
}
});
initInputProperties(feedback, lastName);
staticRegistrationForm.add(lastName);
TextPanel<String> email = new TextPanel<>(ID_EMAIL, new PropertyModel<String>(userModel, UserType.F_EMAIL_ADDRESS.getLocalPart()));
initInputProperties(feedback, email);
staticRegistrationForm.add(email);
createPasswordPanel(staticRegistrationForm);
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class ObjectPolicyDialogDto method preparePolicyConfig.
public ObjectPolicyConfigurationTypeDto preparePolicyConfig() {
ObjectPolicyConfigurationTypeDto newConfig = new ObjectPolicyConfigurationTypeDto();
newConfig.setConstraints(propertyConstraintsList);
newConfig.setType(type);
newConfig.setSubtype(subtype);
ObjectReferenceType ref = new ObjectReferenceType();
if (templateRef != null) {
ref.setOid(templateRef.getOid());
ref.setType(ObjectTemplateType.COMPLEX_TYPE);
ref.setTargetName(new PolyStringType(templateRef.getName()));
}
newConfig.setTemplateRef(ref);
return newConfig;
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class AssignmentEditorDto method setPrivilegeLimitationList.
public void setPrivilegeLimitationList(List<AssignmentsPreviewDto> privilegeLimitationList) {
if (newAssignment.getLimitTargetContent() == null) {
newAssignment.setLimitTargetContent(new AssignmentSelectorType());
}
List<ObjectReferenceType> referencesList = newAssignment.getLimitTargetContent().getTargetRef();
if (referencesList == null) {
referencesList = new ArrayList<>();
}
referencesList.clear();
for (AssignmentsPreviewDto previewDto : privilegeLimitationList) {
ObjectReferenceType ref = new ObjectReferenceType();
ref.setOid(previewDto.getTargetOid());
ref.setTargetName(new PolyStringType(previewDto.getTargetName()));
ref.setType(previewDto.getTargetType());
ref.setRelation(previewDto.getRelation());
referencesList.add(ref);
}
this.privilegeLimitationList = privilegeLimitationList;
}
use of com.evolveum.prism.xml.ns._public.types_3.PolyStringType in project midpoint by Evolveum.
the class AuditLogViewerPanel method addOrReplaceTable.
private void addOrReplaceTable(Form mainForm) {
AuditEventRecordProvider provider = new AuditEventRecordProvider(AuditLogViewerPanel.this) {
private static final long serialVersionUID = 1L;
public Map<String, Object> getParameters() {
Map<String, Object> parameters = new HashMap<String, Object>();
AuditSearchDto search = auditSearchDto.getObject();
parameters.put("from", search.getFrom());
parameters.put("to", search.getTo());
if (search.getChannel() != null) {
parameters.put("channel", QNameUtil.qNameToUri(search.getChannel()));
}
parameters.put("hostIdentifier", search.getHostIdentifier());
if (search.getInitiatorName() != null) {
parameters.put("initiatorName", search.getInitiatorName().getOid());
}
if (search.getTargetOwnerName() != null) {
parameters.put("targetOwnerName", search.getTargetOwnerName().getOid());
}
List<String> targetOids = new ArrayList<>();
if (isNotEmpty(search.getTargetNamesObjects())) {
targetOids.addAll(search.getTargetNamesObjects().stream().map(ObjectType::getOid).collect(toList()));
}
if (isNotEmpty(search.getTargetNames())) {
targetOids.addAll(search.getTargetNames().stream().map(ObjectReferenceType::getOid).collect(toList()));
}
if (!targetOids.isEmpty()) {
parameters.put("targetNames", targetOids);
}
if (search.getChangedItem().toItemPath() != null) {
ItemPath itemPath = search.getChangedItem().toItemPath();
parameters.put("changedItem", CanonicalItemPath.create(itemPath).asString());
}
parameters.put("eventType", search.getEventType());
parameters.put("eventStage", search.getEventStage());
parameters.put("outcome", search.getOutcome());
if (isNotEmpty(search.getvalueRefTargetNames())) {
parameters.put(AuditEventRecordProvider.VALUE_REF_TARGET_NAMES_KEY, search.getvalueRefTargetNames().stream().map(ObjectType::getName).map(PolyStringType::getOrig).collect(toList()));
}
return parameters;
}
@Override
protected void saveCurrentPage(long from, long count) {
if (count != 0) {
auditLogStorage.setPageNumber(from / count);
}
}
};
UserProfileStorage userProfile = pageBase.getSessionStorage().getUserProfile();
int pageSize = DEFAULT_PAGE_SIZE;
if (userProfile.getTables().containsKey(UserProfileStorage.TableId.PAGE_AUDIT_LOG_VIEWER)) {
pageSize = userProfile.getPagingSize(UserProfileStorage.TableId.PAGE_AUDIT_LOG_VIEWER);
}
List<IColumn<AuditEventRecordType, String>> columns = initColumns();
BoxedTablePanel<AuditEventRecordType> table = new BoxedTablePanel<AuditEventRecordType>(ID_TABLE, provider, columns, UserProfileStorage.TableId.PAGE_AUDIT_LOG_VIEWER, pageSize) {
private static final long serialVersionUID = 1L;
@Override
protected WebMarkupContainer createButtonToolbar(String id) {
String fileName = "AuditLogViewer_" + createStringResource("MainObjectListPanel.exportFileName").getString();
CSVDataExporter csvDataExporter = new CSVDataExporter() {
@Override
public <T> void exportData(IDataProvider<T> dataProvider, List<IExportableColumn<T, ?>> columns, OutputStream outputStream) throws IOException {
((AuditEventRecordProvider) dataProvider).setExportSize(true);
super.exportData(dataProvider, columns, outputStream);
((AuditEventRecordProvider) dataProvider).setExportSize(false);
}
};
ResourceStreamResource resource = (new ResourceStreamResource() {
protected IResourceStream getResourceStream() {
return new ExportToolbar.DataExportResourceStreamWriter(csvDataExporter, getAuditLogViewerTable().getDataTable());
}
}).setFileName(fileName + "." + csvDataExporter.getFileNameExtension());
AbstractLink exportDataLink = (new ResourceLink(id, resource)).setBody(csvDataExporter.getDataFormatNameModel());
exportDataLink.add(new AttributeAppender("class", " btn btn-primary btn-sm"));
return exportDataLink;
}
@Override
public void setShowPaging(boolean show) {
//we don't need to do anything here
}
};
table.setShowPaging(true);
table.setCurrentPage(auditLogStorage.getPageNumber());
table.setOutputMarkupId(true);
mainForm.addOrReplace(table);
}
Aggregations