Skip to content

Commit

Permalink
MID-5835 fix policy rules tab
Browse files Browse the repository at this point in the history
  • Loading branch information
KaterynaHonchar committed Oct 10, 2019
1 parent aa69e17 commit be1bf55
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
Expand Up @@ -462,7 +462,9 @@ private void prepareNewContainers(AjaxRequestTarget target, List<PrismContainerD
containers.forEach(container -> {
try {
ItemWrapper iw = getPageBase().createItemWrapper(container, getModelObject(), ctx);
((List) getModelObject().getItems()).add(iw);
if (iw != null) {
((List) getModelObject().getItems()).add(iw);
}
} catch (SchemaException e) {
OperationResult result = ctx.getResult();
result.recordFatalError(createStringResource("PrismContainerValuePanel.message.prepareNewContainers.fatalError", container).getString(), e);
Expand Down
Expand Up @@ -723,8 +723,8 @@ private boolean supportsCustomContainers(QName targetType) {
protected void addCustomSpecificContainers(Fragment specificContainers, IModel<PrismContainerValueWrapper<AssignmentType>> modelObject) {
specificContainers.add(getSpecificContainerPanel(modelObject));
}
protected Panel getSpecificContainerPanel(IModel<PrismContainerValueWrapper<AssignmentType>> modelObject) {

protected Panel getSpecificContainerPanel(IModel<PrismContainerValueWrapper<AssignmentType>> modelObject) {

ItemPath assignmentPath = modelObject.getObject().getPath();
try {
Expand Down Expand Up @@ -755,8 +755,8 @@ protected IModel<PrismContainerWrapper> getSpecificContainerModel(IModel<PrismCo
return (IModel) constructionModel;
}
if (PolicyRuleType.COMPLEX_TYPE.equals(AssignmentsUtil.getTargetType(assignment))) {
IModel<PrismContainerWrapper<PolicyRuleType>> constructionModel = PrismContainerWrapperModel.fromContainerValueWrapper(modelObject, AssignmentType.F_POLICY_RULE);
return (IModel) constructionModel;
IModel<PrismContainerWrapper<PolicyRuleType>> policyRuleModel = PrismContainerWrapperModel.fromContainerValueWrapper(modelObject, AssignmentType.F_POLICY_RULE);
return (IModel) policyRuleModel;
}
return Model.of();
}
Expand Down
Expand Up @@ -471,7 +471,7 @@ public static QName getTargetType(AssignmentType assignment) {
if (targetRef.asReferenceValue().getObject() != null) {
// object assignment
return targetRef.asReferenceValue().getObject().getComplexTypeDefinition().getTypeName();
} else if (assignment.getTargetRef() != null) {
} else if (assignment.getTargetRef() != null && assignment.getTargetRef().getType() != null) {
return assignment.getTargetRef().getType();
}
if (assignment.getPolicyRule() != null){
Expand Down
Expand Up @@ -82,9 +82,11 @@ protected TableId getTableId() {

@Override
protected void newAssignmentClickPerformed(AjaxRequestTarget target, AssignmentObjectRelation assignmentTargetRelation) {
PrismContainerValue<AssignmentType> newAssignment = getModelObject().getItem().createNewValue();
try {
PrismContainerValue<AssignmentType> newAssignment = getModelObject().getItem().createNewValue();
AssignmentType assignmentType = newAssignment.asContainerable();
try {
newAssignment.findOrCreateContainer(AssignmentType.F_POLICY_RULE);
assignmentType.setPolicyRule(new PolicyRuleType());
} catch (SchemaException e) {
LOGGER.error("Cannot create policy rule assignment: {}", e.getMessage(), e);
getSession().error("Cannot create policyRule assignment.");
Expand Down

0 comments on commit be1bf55

Please sign in to comment.