@@ -54,51 +54,51 @@ public void execute(List<API> apis) throws AppException {
5454
5555 private void printStandard (List <API > apis ) {
5656 Console .println (AsciiTable .getTable (borderStyle , apis , Arrays .asList (
57- new Column ().header (ID ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getId ),
58- new Column ().header (PATH ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getPath ),
59- new Column ().header (NAME ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getName ),
60- new Column ().header (VERSION ).with (API ::getVersion ),
61- new Column ().header (CREATED_ON ).with (this ::getFormattedDate )
57+ new Column ().header (ID ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getId ),
58+ new Column ().header (PATH ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getPath ),
59+ new Column ().header (NAME ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getName ),
60+ new Column ().header (VERSION ).with (API ::getVersion ),
61+ new Column ().header (CREATED_ON ).with (this ::getFormattedDate )
6262 )));
6363 printDetails (apis );
6464 }
6565
6666 private void printWide (List <API > apis ) {
6767 Console .println (AsciiTable .getTable (borderStyle , apis , Arrays .asList (
68- new Column ().header (ID ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getId ),
69- new Column ().header (PATH ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getPath ),
70- new Column ().header (NAME ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getName ),
71- new Column ().header (VERSION ).with (API ::getVersion ),
72- new Column ().header ("V-Host" ).with (API ::getVhost ),
73- new Column ().header ("State" ).with (this ::getState ),
74- new Column ().header ("Backend" ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (APIResultHandler ::getBackendPath ),
75- new Column ().header ("Inbound Security" ).with (APIResultHandler ::getUsedSecurity ),
76- new Column ().header ("Outbound Security" ).with (APIResultHandler ::getUsedOutboundAuthentication ),
77- new Column ().header ("Policies" ).dataAlign (HorizontalAlign .LEFT ).maxWidth (30 ).with (this ::getUsedPoliciesForConsole ),
78- new Column ().header ("Organization" ).dataAlign (HorizontalAlign .LEFT ).with (api -> api .getOrganization ().getName ()),
79- new Column ().header (CREATED_ON ).with (this ::getFormattedDate )
68+ new Column ().header (ID ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getId ),
69+ new Column ().header (PATH ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getPath ),
70+ new Column ().header (NAME ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getName ),
71+ new Column ().header (VERSION ).with (API ::getVersion ),
72+ new Column ().header ("V-Host" ).with (API ::getVhost ),
73+ new Column ().header ("State" ).with (this ::getState ),
74+ new Column ().header ("Backend" ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (APIResultHandler ::getBackendPath ),
75+ new Column ().header ("Inbound Security" ).with (APIResultHandler ::getUsedSecurity ),
76+ new Column ().header ("Outbound Security" ).with (APIResultHandler ::getUsedOutboundAuthentication ),
77+ new Column ().header ("Policies" ).dataAlign (HorizontalAlign .LEFT ).maxWidth (30 ).with (this ::getUsedPoliciesForConsole ),
78+ new Column ().header ("Organization" ).dataAlign (HorizontalAlign .LEFT ).with (api -> api .getOrganization ().getName ()),
79+ new Column ().header (CREATED_ON ).with (this ::getFormattedDate )
8080 )));
8181 printDetails (apis );
8282 }
8383
8484 private void printUltra (List <API > apis ) {
8585 Console .println (AsciiTable .getTable (borderStyle , apis , Arrays .asList (
86- new Column ().header (ID ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getId ),
87- new Column ().header (PATH ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getPath ),
88- new Column ().header (NAME ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getName ),
89- new Column ().header (VERSION ).with (API ::getVersion ),
90- new Column ().header ("V-Host" ).with (API ::getVhost ),
91- new Column ().header ("State" ).with (this ::getState ),
92- new Column ().header ("Backend" ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (APIResultHandler ::getBackendPath ),
93- new Column ().header ("Inbound Security" ).with (APIResultHandler ::getUsedSecurity ),
94- new Column ().header ("Outbound Security" ).with (APIResultHandler ::getUsedOutboundAuthentication ),
95- new Column ().header ("Policies" ).dataAlign (HorizontalAlign .LEFT ).maxWidth (30 ).with (this ::getUsedPoliciesForConsole ),
96- new Column ().header ("Organization" ).dataAlign (HorizontalAlign .LEFT ).with (api -> api .getOrganization ().getName ()),
97- new Column ().header ("Orgs" ).with (this ::getOrgCount ),
98- new Column ().header ("Apps" ).with (this ::getAppCount ),
99- new Column ().header ("Quotas" ).with (api -> Boolean .toString (hasQuota (api ))),
100- new Column ().header ("Tags" ).dataAlign (HorizontalAlign .LEFT ).maxWidth (30 ).with (api -> Boolean .toString (hasTags (api ))),
101- new Column ().header (CREATED_ON ).with (this ::getFormattedDate )
86+ new Column ().header (ID ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getId ),
87+ new Column ().header (PATH ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getPath ),
88+ new Column ().header (NAME ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (API ::getName ),
89+ new Column ().header (VERSION ).with (API ::getVersion ),
90+ new Column ().header ("V-Host" ).with (API ::getVhost ),
91+ new Column ().header ("State" ).with (this ::getState ),
92+ new Column ().header ("Backend" ).headerAlign (HorizontalAlign .LEFT ).dataAlign (HorizontalAlign .LEFT ).with (APIResultHandler ::getBackendPath ),
93+ new Column ().header ("Inbound Security" ).with (APIResultHandler ::getUsedSecurity ),
94+ new Column ().header ("Outbound Security" ).with (APIResultHandler ::getUsedOutboundAuthentication ),
95+ new Column ().header ("Policies" ).dataAlign (HorizontalAlign .LEFT ).maxWidth (30 ).with (this ::getUsedPoliciesForConsole ),
96+ new Column ().header ("Organization" ).dataAlign (HorizontalAlign .LEFT ).with (api -> api .getOrganization ().getName ()),
97+ new Column ().header ("Orgs" ).with (this ::getOrgCount ),
98+ new Column ().header ("Apps" ).with (this ::getAppCount ),
99+ new Column ().header ("Quotas" ).with (api -> Boolean .toString (hasQuota (api ))),
100+ new Column ().header ("Tags" ).dataAlign (HorizontalAlign .LEFT ).maxWidth (30 ).with (api -> Boolean .toString (hasTags (api ))),
101+ new Column ().header (CREATED_ON ).with (this ::getFormattedDate )
102102 )));
103103 printDetails (apis );
104104 }
@@ -148,12 +148,12 @@ private void printDetails(List<API> apis) {
148148
149149 private boolean hasQuota (API api ) {
150150 return (api .getApplicationQuota () != null &&
151- api .getApplicationQuota ().getRestrictions () != null &&
152- !api .getApplicationQuota ().getRestrictions ().isEmpty ()) ||
153- (api .getSystemQuota () != null &&
154- api .getSystemQuota ().getRestrictions () != null &&
155- !api .getSystemQuota ().getRestrictions ().isEmpty ())
156- ;
151+ api .getApplicationQuota ().getRestrictions () != null &&
152+ !api .getApplicationQuota ().getRestrictions ().isEmpty ()) ||
153+ (api .getSystemQuota () != null &&
154+ api .getSystemQuota ().getRestrictions () != null &&
155+ !api .getSystemQuota ().getRestrictions ().isEmpty ())
156+ ;
157157 }
158158
159159 private String getState (API api ) {
@@ -195,8 +195,15 @@ private String getSubscribedApplications(API api) {
195195
196196 @ Override
197197 public APIFilter getFilter () {
198- APIFilter apiFilter = createFilter ();
199- apiFilter .setState (params .getState ());
200- return apiFilter ;
198+ APIFilter .Builder builder = createFilterBuilder ();
199+ if (params .getState () != null && params .getState ().equalsIgnoreCase ("deprecated" )) {
200+ builder .isDeprecated (true );
201+ builder .hasState (null );
202+ }
203+ if (params .getState () != null && params .getState ().equalsIgnoreCase ("retired" )) {
204+ builder .isDeprecated (true );
205+ builder .hasState (null );
206+ }
207+ return builder .build ();
201208 }
202209}
0 commit comments