@@ -2407,8 +2407,6 @@ public TemplateType validateTemplateType(BaseCmd cmd, boolean isAdmin, boolean i
24072407 throw new InvalidParameterValueException (String .format ("Please specify a valid templatetype: %s" ,
24082408 org .apache .commons .lang3 .StringUtils .join ("," , TemplateType .values ())));
24092409 }
2410- } else if (cmd instanceof GetUploadParamsForTemplateCmd ) {
2411- templateType = ((GetUploadParamsForTemplateCmd ) cmd ).isRoutingType () ? TemplateType .ROUTING : TemplateType .USER ;
24122410 }
24132411 if (templateType != null ) {
24142412 if (isRoutingType != null && (TemplateType .ROUTING .equals (templateType ) != isRoutingType )) {
@@ -2418,7 +2416,7 @@ public TemplateType validateTemplateType(BaseCmd cmd, boolean isAdmin, boolean i
24182416 } else if ((cmd instanceof RegisterVnfTemplateCmd || cmd instanceof UpdateVnfTemplateCmd ) && !TemplateType .VNF .equals (templateType )) {
24192417 throw new InvalidParameterValueException ("The template type must be VNF for VNF templates, but the actual type is " + templateType );
24202418 }
2421- } else if (cmd instanceof RegisterTemplateCmd ) {
2419+ } else if (cmd instanceof RegisterTemplateCmd || cmd instanceof GetUploadParamsForTemplateCmd ) {
24222420 boolean isRouting = Boolean .TRUE .equals (isRoutingType );
24232421 templateType = (cmd instanceof RegisterVnfTemplateCmd ) ? TemplateType .VNF : (isRouting ? TemplateType .ROUTING : TemplateType .USER );
24242422 }
@@ -2428,6 +2426,8 @@ public TemplateType validateTemplateType(BaseCmd cmd, boolean isAdmin, boolean i
24282426 throw new InvalidParameterValueException (String .format ("Users can not register Template with template type %s." , templateType ));
24292427 } else if (cmd instanceof UpdateTemplateCmd ) {
24302428 throw new InvalidParameterValueException (String .format ("Users can not update Template to template type %s." , templateType ));
2429+ } else if (cmd instanceof GetUploadParamsForTemplateCmd ) {
2430+ throw new InvalidParameterValueException (String .format ("Users can not upload Template to template type %s." , templateType ));
24312431 }
24322432 }
24332433 return templateType ;
0 commit comments