@@ -421,7 +421,7 @@ public CompositedIconBuilder getIconCompositedBuilder() {
421421 items .add (menu );
422422
423423 menu = new ButtonInlineMenuItem (
424- createStringResource ("ResourceObjectsPanel.button.association.inbound " )) {
424+ createStringResource ("ResourceObjectsPanel.button.association" )) {
425425 @ Serial private static final long serialVersionUID = 1L ;
426426
427427 @ Override
@@ -447,15 +447,17 @@ public void onClick(AjaxRequestTarget target) {
447447 }
448448
449449 if (associations .size () == 1 ) {
450- showAssociationInboundWizard (associations .iterator ().next (), target );
450+ showAssociationWizard (associations .iterator ().next (), target );
451451 } else {
452452 ChoiceAssociationPopupPanel popup = new ChoiceAssociationPopupPanel (
453453 getPageBase ().getMainPopupBodyId (),
454454 getObjectDetailsModels (),
455455 associations ) {
456456 @ Override
457457 protected void onTileClickPerformed (AssociationDefinitionWrapper value , AjaxRequestTarget target ) {
458- showAssociationInboundWizard (value .getSourceValue (), target );
458+ if (value != null && value .getSourceValue () != null ) {
459+ showAssociationWizard (value .getSourceValue (), target );
460+ }
459461 }
460462 };
461463 getPageBase ().showMainPopup (popup , target );
@@ -475,65 +477,9 @@ public CompositedIconBuilder getIconCompositedBuilder() {
475477 };
476478 menu .setVisible (createAssociationMenuItemVisibilityModel ());
477479 items .add (menu );
478-
479- menu = new ButtonInlineMenuItem (
480- createStringResource ("ResourceObjectsPanel.button.association.outbound" )) {
481- @ Serial private static final long serialVersionUID = 1L ;
482-
483- @ Override
484- public InlineMenuItemAction initAction () {
485- return new ColumnMenuAction <>() {
486- @ Serial private static final long serialVersionUID = 1L ;
487-
488- @ Override
489- public void onClick (AjaxRequestTarget target ) {
490- ResourceObjectTypeDefinition selectedObjectType = getSelectedObjectTypeDefinition ();
491- if (selectedObjectType == null ) {
492- getPageBase ().warn (LocalizationUtil .translate ("PageResource.objectTypeIsNullForAssociation" ));
493- target .add (getPageBase ().getFeedbackPanel ());
494- return ;
495- }
496-
497- try {
498- List <PrismContainerValueWrapper <ShadowAssociationTypeDefinitionType >> associations =
499- AssociationChildWrapperUtil .findAssociationDefinitions (getObjectWrapper (), selectedObjectType );
500-
501- if (associations .isEmpty ()) {
502- return ;
503- }
504-
505- if (associations .size () == 1 ) {
506- showAssociationOutboundWizard (associations .iterator ().next (), target );
507- } else {
508- ChoiceAssociationPopupPanel popup = new ChoiceAssociationPopupPanel (
509- getPageBase ().getMainPopupBodyId (),
510- getObjectDetailsModels (),
511- associations ) {
512- @ Override
513- protected void onTileClickPerformed (AssociationDefinitionWrapper value , AjaxRequestTarget target ) {
514- showAssociationOutboundWizard (value .getSourceValue (), target );
515- }
516- };
517- getPageBase ().showMainPopup (popup , target );
518- }
519-
520- } catch (SchemaException e ) {
521- LOGGER .error ("Couldn't load association for " + selectedObjectType );
522- }
523- }
524- };
525- }
526-
527- @ Override
528- public CompositedIconBuilder getIconCompositedBuilder () {
529- return getDefaultCompositedIconBuilder ("fa fa-arrow-right-from-bracket" );
530- }
531- };
532- menu .setVisible (createAssociationMenuItemVisibilityModel ());
533- items .add (menu );
534480 }
535481
536- private IModel <Boolean > createAssociationMenuItemVisibilityModel () {
482+ private @ NotNull IModel <Boolean > createAssociationMenuItemVisibilityModel () {
537483 return () -> {
538484 ResourceObjectTypeDefinition selectedObjectType = getSelectedObjectTypeDefinition ();
539485 if (selectedObjectType == null ) {
@@ -550,56 +496,17 @@ private IModel<Boolean> createAssociationMenuItemVisibilityModel() {
550496 };
551497 }
552498
553- private void showAssociationInboundWizard (@ NotNull PrismContainerValueWrapper <ShadowAssociationTypeDefinitionType > associationWrapper , AjaxRequestTarget target ) {
554- ShadowAssociationTypeDefinitionType association = associationWrapper .getRealValue ();
555- if (association == null ) {
556- return ;
557- }
558-
559- if (association .getSubject () == null || association .getSubject ().getAssociation () == null ) {
560- return ;
561- }
562-
499+ private void showAssociationWizard (
500+ @ NotNull PrismContainerValueWrapper <ShadowAssociationTypeDefinitionType > associationWrapper ,
501+ AjaxRequestTarget target ) {
563502 PageResource page = getObjectDetailsModels ().getPageResource ();
564- if (association .getSubject ().getAssociation ().getInbound ().size () == 1 ) {
565- ItemPath path = association .getSubject ().getAssociation ().getInbound ().iterator ().next ().asPrismContainerValue ().getPath ();
566-
567- page .showAssociationInboundWizard (target , path , association , createExitLabelModel ());
568- } else {
569- ItemPath path = association .asPrismContainerValue ().getPath ()
570- .append (ShadowAssociationTypeDefinitionType .F_SUBJECT )
571- .append (ShadowAssociationTypeSubjectDefinitionType .F_ASSOCIATION );
572-
573- page .showAssociationInboundsWizard (target , path , association , createExitLabelModel ());
574- }
575- }
576-
577- private IModel <String > createExitLabelModel () {
578- return new StringResourceModel ("ResourceObjectsPanel.associationWizard.exitLabel." + getKind ());
579- }
580-
581- private void showAssociationOutboundWizard (PrismContainerValueWrapper <ShadowAssociationTypeDefinitionType > associationWrapper , AjaxRequestTarget target ) {
582503 ShadowAssociationTypeDefinitionType association = associationWrapper .getRealValue ();
583504 if (association == null ) {
584505 return ;
585506 }
586507
587- if (association .getSubject () == null || association .getSubject ().getAssociation () == null ) {
588- return ;
589- }
590-
591- PageResource page = getObjectDetailsModels ().getPageResource ();
592- if (association .getSubject ().getAssociation ().getOutbound ().size () == 1 ) {
593- ItemPath path = association .getSubject ().getAssociation ().getOutbound ().iterator ().next ().asPrismContainerValue ().getPath ();
594-
595- page .showAssociationOutboundWizard (target , path , association , createExitLabelModel ());
596- } else {
597- ItemPath path = association .asPrismContainerValue ().getPath ()
598- .append (ShadowAssociationTypeDefinitionType .F_SUBJECT )
599- .append (ShadowAssociationTypeSubjectDefinitionType .F_ASSOCIATION );
600-
601- page .showAssociationOutboundsWizard (target , path , association , createExitLabelModel ());
602- }
508+ ItemPath path = association .asPrismContainerValue ().getPath ();
509+ page .showResourceAssociationTypePreviewWizard (target , path );
603510 }
604511
605512 private ButtonInlineMenuItem createWizardItemPanel (
0 commit comments