4949import org .apache .syncope .client .ui .commons .wizards .any .UserWrapper ;
5050import org .apache .syncope .common .lib .to .AnyObjectTO ;
5151import org .apache .syncope .common .lib .to .AnyTO ;
52- import org .apache .syncope .common .lib .to .RelatableTO ;
5352import org .apache .syncope .common .lib .to .RelationshipTO ;
5453import org .apache .syncope .common .lib .to .RelationshipTypeTO ;
5554import org .apache .syncope .common .lib .types .AnyEntitlement ;
@@ -121,12 +120,11 @@ protected Fragment getViewFragment() {
121120 Fragment viewFragment = new Fragment ("relationships" , "viewFragment" , this );
122121 viewFragment .setOutputMarkupId (true );
123122
124- List <RelationshipTO > relationships = getCurrentRelationships ();
125- viewFragment .add (relationships .isEmpty ()
123+ viewFragment .add (anyTO .getRelationships ().isEmpty ()
126124 ? new Label ("relationships" , new Model <>(getString ("relationships.empty.list" )))
127125 : new RelationshipViewPanel .Builder (pageRef ).
128126 setAnyTO (anyTO ).
129- setRelationships (relationships ).
127+ setRelationships (anyTO . getRelationships () ).
130128 build ("relationships" ));
131129
132130 ActionsPanel <RelationshipTO > panel = new ActionsPanel <>("actions" , null );
@@ -148,18 +146,6 @@ public void onClick(final AjaxRequestTarget target, final RelationshipTO ignore)
148146 return viewFragment ;
149147 }
150148
151- protected List <RelationshipTO > getCurrentRelationships () {
152- return anyTO instanceof RelatableTO relatableTO
153- ? relatableTO .getRelationships ()
154- : List .of ();
155- }
156-
157- protected void addNewRelationship (final RelationshipTO relaltionship ) {
158- if (anyTO instanceof RelatableTO relatableTO ) {
159- relatableTO .getRelationships ().add (relaltionship );
160- }
161- }
162-
163149 @ Override
164150 public boolean evaluate () {
165151 return !relationshipTypeRestClient .list ().isEmpty ();
@@ -270,7 +256,7 @@ public void onEvent(final IEvent<?> event) {
270256 rel .setOtherEndKey (right .getKey ());
271257 rel .setOtherEndName (AnyObjectTO .class .cast (right ).getName ());
272258
273- Relationships . this . addNewRelationship (rel );
259+ anyTO . getRelationships (). add (rel );
274260
275261 Relationships .this .addOrReplace (getViewFragment ().setRenderBodyOnly (true ));
276262 target .add (Relationships .this );
0 commit comments