github-advanced-security[bot] commented on code in PR #1000:
URL: https://github.com/apache/syncope/pull/1000#discussion_r1978829454


##########
client/idrepo/console/src/main/java/org/apache/syncope/client/console/wicket/markup/html/form/ActionLinksTogglePanel.java:
##########
@@ -73,52 +73,52 @@
 
     public void updateHeader(final AjaxRequestTarget target, final 
Serializable modelObject) {
         final String header;
-        if (modelObject instanceof UserTO) {
-            header = ((UserTO) modelObject).getUsername();
-        } else if (modelObject instanceof UserWrapper) {
-            header = ((UserWrapper) 
modelObject).getInnerObject().getUsername();
-        } else if (modelObject instanceof GroupTO) {
-            header = ((GroupTO) modelObject).getName();
-        } else if (modelObject instanceof GroupWrapper) {
-            header = ((GroupWrapper) modelObject).getInnerObject().getName();
-        } else if (modelObject instanceof AnyObjectTO) {
-            header = ((AnyObjectTO) modelObject).getName();
-        } else if (modelObject instanceof AnyObjectWrapper) {
-            header = ((AnyObjectWrapper) 
modelObject).getInnerObject().getName();
-        } else if (modelObject instanceof Attr) {
-            header = ((Attr) modelObject).getSchema();
-        } else if (modelObject instanceof ConfParam) {
-            header = ((ConfParam) modelObject).getSchema();
-        } else if (modelObject instanceof PolicyTO) {
-            header = ((PolicyTO) modelObject).getName();
-        } else if (modelObject instanceof SecurityQuestionTO) {
-            header = ((SecurityQuestionTO) modelObject).getContent();
-        } else if (modelObject instanceof AccessTokenTO) {
-            header = ((AccessTokenTO) modelObject).getOwner();
-        } else if (modelObject instanceof ExecTO) {
-            header = ((ExecTO) modelObject).getKey();
-        } else if (modelObject instanceof StatusBean) {
-            header = ((StatusBean) modelObject).getResource();
-        } else if (modelObject instanceof PolicyRuleWrapper) {
-            header = ((PolicyRuleWrapper) modelObject).getImplementationKey();
-        } else if (modelObject instanceof CommandWrapper) {
-            header = ((CommandWrapper) modelObject).getCommand().getKey();
-        } else if (modelObject instanceof JobTO) {
-            header = ((JobTO) modelObject).getRefKey() == null
-                    ? ((JobTO) modelObject).getRefDesc() : ((JobTO) 
modelObject).getRefKey();
-        } else if (modelObject instanceof ToggleableTarget) {
-            header = ((ToggleableTarget) modelObject).getAnyType();
-        } else if (modelObject instanceof Domain) {
-            header = ((Domain) modelObject).getKey();
-        } else if (modelObject instanceof CommandTO) {
-            header = ((CommandTO) modelObject).getKey();
-        } else if (modelObject instanceof NamedEntityTO) {
-            header = ((NamedEntityTO) modelObject).getName();
-        } else if (modelObject instanceof EntityTO) {
-            header = ((EntityTO) modelObject).getKey();
-        } else if (modelObject instanceof EntityWrapper) {
-            EntityTO inner = ((EntityWrapper) modelObject).getInnerObject();
-            header = inner instanceof NamedEntityTO ? ((NamedEntityTO) 
inner).getName() : inner.getKey();
+        if (modelObject instanceof final UserTO userTO) {

Review Comment:
   ## Chain of 'instanceof' tests
   
   This if block performs a chain of 22 type tests - consider alternatives, 
e.g. polymorphism or the visitor pattern.
   
   [Show more 
details](https://github.com/apache/syncope/security/code-scanning/2195)



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: dev-unsubscr...@syncope.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to