[ https://issues.apache.org/jira/browse/UNOMI-167?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16371364#comment-16371364 ]
Serge Huber commented on UNOMI-167: ----------------------------------- This was already solved in this commit : [https://github.com/apache/incubator-unomi/commit/8df430d33d8b3cfd07f25a7116f3099d6dded78e] > Avoid duplicating shell table formatting code > --------------------------------------------- > > Key: UNOMI-167 > URL: https://issues.apache.org/jira/browse/UNOMI-167 > Project: Apache Unomi > Issue Type: Improvement > Reporter: Jarek Lipski > Priority: Minor > Fix For: 1.3.0-incubating > > > In every command formatting data to shell, we repeat very similar code. > Example (from SegmentListCommand) > {code:java} > ShellTable shellTable = new ShellTable(); > for (String header : headers) { > shellTable.column(header); > } > for (DataTable.Row dataTableRow : dataTable.getRows()) { > ArrayList<Object> rowData = new ArrayList<Object>(); > for (int i=0 ; i < dataTable.getMaxColumns(); i++) { > rowData.add(dataTableRow.getData(i)); > } > Row row = shellTable.addRow(); > row.addContent(rowData); > } > shellTable.print(System.out); > {code} > In order to avoid this repetition we could add a toShell ot printToShell > command to DataTable common data structure. However, in order to do that we > would need to add a dependency on "org.apache.karaf.shell.console" to > unomi-common, so I hesitated to do it immediately. > > In order to find all similar code occurence, search where DataTable is being > used. -- This message was sent by Atlassian JIRA (v7.6.3#76005)