Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
mederly committed Dec 7, 2017
2 parents d5874f9 + 76fb553 commit b7abe77
Show file tree
Hide file tree
Showing 5 changed files with 121 additions and 77 deletions.
Expand Up @@ -19,83 +19,116 @@
<wicket:panel>
<div class="row">
<div class="col-md-12">
<h3 style="margin-left: 20px;">
<wicket:message key="SystemConfigPanel.title.basic"/>
</h3>

<div class="form-group">
<label class="col-md-4 control-label">
<wicket:message key="SystemConfigPanel.title.securityPolicy"/>
</label>
<div wicket:id="securityPolicyChooser"/>
</div>

<div class="form-group" wicket:id="objectPolicyEditor"></div>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h3><wicket:message key="SystemConfigPanel.title.basic"/></h3>

<div class="form-group">
<label class="col-md-4 control-label">
<wicket:message key="SystemConfigPanel.title.securityPolicy"/>
</label>
<div wicket:id="securityPolicyChooser"/>
</div>

<div class="form-group" wicket:id="objectPolicyEditor"></div>

<h3><wicket:message key="SystemConfigPanel.title.accountSynchronization"/></h3>

<div class="form-group" wicket:id="chooseAssignmentPolicyEnforcement"/>
</div>
</div>
</div>

<h3 style="margin-left: 20px;">
<wicket:message key="SystemConfigPanel.title.accountSynchronization"/>
</h3>
<div class="form-group" wicket:id="chooseAssignmentPolicyEnforcement"/>
<h3 style="margin-left: 20px">
<wicket:message key="SystemConfigPanel.cleanupPolicy"/>
</h3>
<div class="container-fluid">
<div class="col-md-6">
<div class="form-group" wicket:id="auditRecordsCleanupAge"
<div class="row">
<div class="col-md-12">
<h3><wicket:message key="SystemConfigPanel.cleanupPolicy"/></h3>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group" wicket:id="auditRecordsCleanupAge"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
<div class="form-group" wicket:id="auditRecordsCleanupRecords"
</div>
<div class="col-md-6">
<div class="form-group" wicket:id="auditRecordsCleanupRecords"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
<div class="form-group" wicket:id="closedTasksCleanupAge"
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group" wicket:id="certificationCampaignsCleanupAge"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
<div class="form-group" wicket:id="certificationCampaignsCleanupAge"
</div>
<div class="col-md-6">
<div class="form-group" wicket:id="certificationCampaignsCleanupRecords"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
</div>
</div>
<div class="col-md-6">
<div class="form-group" wicket:id="certificationCampaignsCleanupRecords"
<div class="row">
<div class="col-md-6">
<div class="form-group" wicket:id="resultsCleanupAge"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
<div class="form-group" wicket:id="reportsCleanupAge"
</div>
<div class="col-md-6">

<div class="form-group" wicket:id="resultsCleanupRecords"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
<div class="form-group" wicket:id="resultsCleanupAge"
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group" wicket:id="closedTasksCleanupAge"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
<div class="form-group" wicket:id="resultsCleanupRecords"
<div class="form-group" wicket:id="reportsCleanupAge"
wicket:message="placeholder:SystemConfigPanel.cleanupPolicy.placeholder"/>
</div>
</div>
</div>

<h3 style="margin-left: 20px;">
<wicket:message key="SystemConfigPanel.title.deploymentInformation"/>
</h3>
<div class="form-group" wicket:id="deploymentInfoContainer">
<div class="container-fluid" wicket:id="deploymentInfoContainer">
<div class="row">
<div class="col-md-12">
<h3><wicket:message key="SystemConfigPanel.title.deploymentInformation"/></h3>

<div class="form-group" wicket:id="deploymentInfoName"/>
<div class="form-group" wicket:id="deploymentInfoName"/>

<div class="form-group" wicket:id="deploymentInfoDescription"/>
<div class="form-group" wicket:id="deploymentInfoDescription"/>

<div class="form-group" wicket:id="deploymentInfoHeaderColor"/>
<div class="form-group" wicket:id="deploymentInfoHeaderColor"/>

<div class="form-group" wicket:id="deploymentInfoSkin"/>
<div class="form-group" wicket:id="deploymentInfoSkin"/>

<div class="form-group" wicket:id="deploymentInfoCustomerUrl"/>
<div class="form-group" wicket:id="deploymentInfoCustomerUrl"/>

<div class="form-group" wicket:id="deploymentInfoPartnerName"/>
<div class="form-group" wicket:id="deploymentInfoPartnerName"/>

<div class="form-group" wicket:id="deploymentInfoSubscriptionId"/>
<div class="form-group" wicket:id="deploymentInfoSubscriptionId"/>

<hr style="margin-right: 20px;">

<hr style="margin-right: 20px;">
<div class="form-group" wicket:id="deploymentInfoLogoImageUrl"/>

<div class="form-group" wicket:id="deploymentInfoLogoCssClass"/>

<div class="form-group" wicket:id="deploymentInfoLogoImageUrl"/>
<hr style="margin-right: 20px;">
</div>
</div>
</div>

<div class="form-group" wicket:id="deploymentInfoLogoCssClass"/>

<hr style="margin-right: 20px;">
</div>
<h3 style="margin-left: 20px;">
<wicket:message key="SystemConfigPanel.title.misc"/>
</h3>

<div class="form-group" wicket:id="experimentalCodeCheckbox"/>
<div class="container-fluid">
<div class="row">
<div class="col-md-12">
<h3><wicket:message key="SystemConfigPanel.title.misc"/></h3>

<div class="form-group" wicket:id="experimentalCodeCheckbox"/>
</div>
</div>
</div>
</div>

</div>
Expand Down
Expand Up @@ -72,7 +72,8 @@ public class SystemConfigPanel extends BasePanel<SystemConfigurationDto> {
private static final String ID_LABEL_SIZE = "col-md-4";
private static final String ID_INPUT_SIZE = "col-md-4";

private static final String CLEANUP_SIZE = "col-md-6";
private static final String CLEANUP_LABEL_SIZE = "col-md-6";
private static final String CLEANUP_INPUT_SIZE = "col-md-6";


public SystemConfigPanel(String id, IModel<SystemConfigurationDto> model) {
Expand Down Expand Up @@ -105,42 +106,42 @@ protected void initLayout() {
TextFormGroup auditRecordsAgeField = new TextFormGroup(ID_AUDIT_RECORDS_CLEANUP_AGE,
new PropertyModel<>(getModel(), SystemConfigurationDto.F_AUDIT_CLEANUP_AGE),
createStringResource("SystemConfigPanel.cleanupPolicy.auditRecords"),
DURATION_TOOLTIP_KEY, true, CLEANUP_SIZE, CLEANUP_SIZE, false, false);
DURATION_TOOLTIP_KEY, true, CLEANUP_LABEL_SIZE, CLEANUP_INPUT_SIZE, false, false);
add(auditRecordsAgeField);
TextFormGroup auditRecordsRecordsField = new TextFormGroup(ID_AUDIT_RECORDS_CLEANUP_RECORDS,
new PropertyModel<>(getModel(), SystemConfigurationDto.F_AUDIT_CLEANUP_RECORDS),
createStringResource("SystemConfigPanel.cleanupPolicy.auditRecords.records"),
null, true, CLEANUP_SIZE, CLEANUP_SIZE, false, false);
null, true, CLEANUP_LABEL_SIZE, CLEANUP_INPUT_SIZE, false, false);
add(auditRecordsRecordsField);
TextFormGroup closedTasksAgeField = new TextFormGroup(ID_CLOSED_TASKS_CLEANUP_AGE,
new PropertyModel<>(getModel(), SystemConfigurationDto.F_TASK_CLEANUP_AGE),
createStringResource("SystemConfigPanel.cleanupPolicy.closedTasks"),
DURATION_TOOLTIP_KEY, true, CLEANUP_SIZE, CLEANUP_SIZE, false, false);
DURATION_TOOLTIP_KEY, true, ID_LABEL_SIZE, ID_INPUT_SIZE, false, false);
add(closedTasksAgeField);
TextFormGroup campaignsAgeField = new TextFormGroup(ID_CERTIFICATION_CAMPAIGNS_CLEANUP_AGE,
new PropertyModel<>(getModel(), SystemConfigurationDto.F_CAMPAIGN_CLEANUP_AGE),
createStringResource("SystemConfigPanel.cleanupPolicy.certificationCampaigns"),
DURATION_TOOLTIP_KEY, true, CLEANUP_SIZE, CLEANUP_SIZE, false, false);
DURATION_TOOLTIP_KEY, true, CLEANUP_LABEL_SIZE, CLEANUP_INPUT_SIZE, false, false);
add(campaignsAgeField);
TextFormGroup campaignsRecordsField = new TextFormGroup(ID_CERTIFICATION_CAMPAIGNS_CLEANUP_RECORDS,
new PropertyModel<>(getModel(), SystemConfigurationDto.F_CAMPAIGN_CLEANUP_RECORDS),
createStringResource("SystemConfigPanel.cleanupPolicy.certificationCampaigns.records"),
null, true, CLEANUP_SIZE, CLEANUP_SIZE, false, false);
null, true, CLEANUP_LABEL_SIZE, CLEANUP_INPUT_SIZE, false, false);
add(campaignsRecordsField);
TextFormGroup reportsAgeField = new TextFormGroup(ID_REPORTS_CLEANUP_AGE,
new PropertyModel<>(getModel(), SystemConfigurationDto.F_REPORT_CLEANUP_AGE),
createStringResource("SystemConfigPanel.cleanupPolicy.reports"),
DURATION_TOOLTIP_KEY, true, CLEANUP_SIZE, CLEANUP_SIZE, false, false);
DURATION_TOOLTIP_KEY, true, ID_LABEL_SIZE, ID_INPUT_SIZE, false, false);
add(reportsAgeField);
TextFormGroup resultsAgeField = new TextFormGroup(ID_RESULTS_CLEANUP_AGE,
new PropertyModel<>(getModel(), SystemConfigurationDto.F_RESULT_CLEANUP_AGE),
createStringResource("SystemConfigPanel.cleanupPolicy.results"),
DURATION_TOOLTIP_KEY, true, CLEANUP_SIZE, CLEANUP_SIZE, false, false);
DURATION_TOOLTIP_KEY, true, CLEANUP_LABEL_SIZE, CLEANUP_INPUT_SIZE, false, false);
add(resultsAgeField);
TextFormGroup resultsRecordsField = new TextFormGroup(ID_RESULTS_CLEANUP_RECORDS,
new PropertyModel<>(getModel(), SystemConfigurationDto.F_RESULT_CLEANUP_RECORDS),
createStringResource("SystemConfigPanel.cleanupPolicy.results.records"),
null, true, CLEANUP_SIZE, CLEANUP_SIZE, false, false);
null, true, CLEANUP_LABEL_SIZE, CLEANUP_INPUT_SIZE, false, false);
add(resultsRecordsField);

TextFormGroup deploymentInfoName = new TextFormGroup(ID_DEPLOYMENT_INFO_NAME, new PropertyModel<String>(getModel(), "deploymentInformation.name"), createStringResource("SystemConfigPanel.deploymentInformation.name"), ID_LABEL_SIZE, ID_INPUT_SIZE, false);
Expand Down
Expand Up @@ -232,8 +232,8 @@ protected void onConfirmPerformed(IModel<RoleRelationSelectionDto> model, AjaxRe
// }

@Override
protected ObjectQuery createAllMemberQuery() {
return super.createDirectMemberQuery();
protected ObjectQuery createAllMemberQuery(List<QName> relations) {
return super.createDirectMemberQuery(relations);
}

@Override
Expand Down Expand Up @@ -326,6 +326,7 @@ private void initOwnerRelationObjectsModel(){
protected List<String> load() {
OperationResult result = new OperationResult(OPERATION_LOAD_OWNER_RELATION_OBJECTS);


PrismReferenceValue rv = new PrismReferenceValue(getModelObject().getOid());
rv.setRelation(RelationTypes.OWNER.getRelation());

Expand Down
Expand Up @@ -50,6 +50,8 @@
import com.evolveum.midpoint.web.page.admin.users.component.AbstractRoleMemberPanel;
import com.evolveum.midpoint.web.session.UserProfileStorage.TableId;
import com.evolveum.midpoint.xml.ns._public.common.common_3.*;

import org.apache.commons.collections.CollectionUtils;
import org.apache.wicket.ajax.AjaxRequestTarget;
import org.apache.wicket.ajax.form.OnChangeAjaxBehavior;
import org.apache.wicket.behavior.AttributeAppender;
Expand Down Expand Up @@ -157,36 +159,35 @@ protected AssignmentType createMemberAssignmentToModify(QName relation) throws S
return assignmentToModify;
}

private ObjectQuery getActionQuery(QueryScope scope) {
private ObjectQuery getActionQuery(QueryScope scope, List<QName> relations) {
switch (scope) {
case ALL:
return createAllMemberQuery();
return createAllMemberQuery(relations);
case ALL_DIRECT:
return createDirectMemberQuery( );
return createDirectMemberQuery(relations);
case SELECTED:
return createRecomputeQuery();
}

return null;
}

protected ObjectQuery createAllMemberQuery() {
protected ObjectQuery createAllMemberQuery(List<QName> relations) {
return QueryBuilder.queryFor(FocusType.class, getPrismContext())
.item(FocusType.F_ROLE_MEMBERSHIP_REF).ref(createReferenceValuesList())
.item(FocusType.F_ROLE_MEMBERSHIP_REF).ref(createReferenceValuesList(relations))
.build();
}

private List<PrismReferenceValue> createReferenceValuesList() {
private List<PrismReferenceValue> createReferenceValuesList(List<QName> relations) {
List<PrismReferenceValue> referenceValuesList = new ArrayList<>();
if (relations != null && relations.size() > 0){
for (RelationTypes relation : relations) {
PrismReferenceValue rv = new PrismReferenceValue(getModelObject().getOid());
rv.setRelation(relation.getRelation());
referenceValuesList.add(rv);
if (!CollectionUtils.isEmpty(relations)) {
for (QName relation : relations) {
referenceValuesList.add(createReference(relation).asReferenceValue());
}
}
} else {
PrismReferenceValue rv = new PrismReferenceValue(getModelObject().getOid());
referenceValuesList.add(rv);
referenceValuesList.add(createReference().asReferenceValue());
}

return referenceValuesList;
Expand Down Expand Up @@ -374,15 +375,15 @@ protected ObjectDelta getDeleteAssignmentDelta(List<QName> relations, Class clas
protected void removeMembersPerformed(QueryScope scope, List<QName> relation, AjaxRequestTarget target) {
Task operationalTask = getPageBase().createSimpleTask(getTaskName("Remove", scope));
ObjectDelta delta = prepareDelta(FocusType.COMPLEX_TYPE, relation, MemberOperation.REMOVE, operationalTask.getResult());
executeMemberOperation(operationalTask, FocusType.COMPLEX_TYPE, getActionQuery(scope), delta,
executeMemberOperation(operationalTask, FocusType.COMPLEX_TYPE, getActionQuery(scope, relation), delta,
TaskCategory.EXECUTE_CHANGES, target);

}

@Override
protected void recomputeMembersPerformed(QueryScope scope, AjaxRequestTarget target) {
Task operationalTask = getPageBase().createSimpleTask(getTaskName("Recompute", scope));
executeMemberOperation(operationalTask, FocusType.COMPLEX_TYPE, getActionQuery(scope), null,
executeMemberOperation(operationalTask, FocusType.COMPLEX_TYPE, getActionQuery(scope, null), null,
TaskCategory.RECOMPUTATION, target);

}
Expand All @@ -391,17 +392,24 @@ protected void recomputeMembersPerformed(QueryScope scope, AjaxRequestTarget tar
protected ObjectQuery createContentQuery() {
boolean indirect = ((CheckBoxPanel) get(createComponentPath(ID_INDIRECT_MEMBERS_CONTAINER, ID_INDIRECT_MEMBERS))).getValue();

return indirect ? createAllMemberQuery() : createDirectMemberQuery();
List<QName> relationList = new ArrayList<>();
if (relations != null) {
for (RelationTypes relation: relations) {
relationList.add(relation.getRelation());
}
}

return indirect ? createAllMemberQuery(relationList) : createDirectMemberQuery(relationList);

}

protected ObjectQuery createDirectMemberQuery() {
protected ObjectQuery createDirectMemberQuery(List<QName> relations) {
ObjectQuery query;

String oid = getModelObject().getOid();
S_AtomicFilterExit q = QueryBuilder.queryFor(FocusType.class, getPrismContext())
.item(FocusType.F_ASSIGNMENT, AssignmentType.F_TARGET_REF)
.ref(createReferenceValuesList());
.ref(createReferenceValuesList(relations));
ChooseTypePanel<OrgType> tenantChoice = (ChooseTypePanel) get(createComponentPath(ID_TENANT));
ObjectViewDto<OrgType> tenant = tenantChoice.getModelObject();
if (tenant != null && tenant.getObjectType() != null) {
Expand Down
Expand Up @@ -3901,4 +3901,5 @@ RoleRelationSelectionPanel.owner=Owner
TreeTablePanel.menu.unassignApproversSelected=Unassign selected approvers
TreeTablePanel.menu.unassignOwnersSelected=Unassign selected owners
TreeTablePanel.menu.unassignManagersSelected=Unassign selected managers
Button.cancel=Cancel
Button.cancel=Cancel
RoleRelationSelectionPanel.select.relation=Select relations to process

0 comments on commit b7abe77

Please sign in to comment.