Example usage for org.apache.solr.common.luke FieldFlag getDisplay

List of usage examples for org.apache.solr.common.luke FieldFlag getDisplay

Introduction

In this page you can find the example usage for org.apache.solr.common.luke FieldFlag getDisplay.

Prototype

public String getDisplay() 

Source Link

Usage

From source file:com.github.fengtan.sophie.tables.FieldsTable.java

License:Open Source License

/**
 * Create a new table listing Solr fields.
 * //from w w  w  .j  a v  a  2 s.  co m
 * @param composite
 *            Parent composite.
 * @throws SophieException
 *             If the table could not be initialized.
 */
public FieldsTable(Composite composite) throws SophieException {
    super(composite);

    // Add columns (static + flags).
    for (String columnName : columnNames) {
        addColumn(columnName);
    }
    for (FieldFlag flag : FieldFlag.values()) {
        addColumn(flag.getDisplay());
    }

    // Add rows.
    populate();
}

From source file:com.github.fengtan.sophie.tables.FieldsTable.java

License:Open Source License

@Override
protected void populate() throws SophieException {
    // Get remote fields + unique key.
    String uniqueField = SolrUtils.getRemoteUniqueField();
    List<FieldInfo> fields = SolrUtils.getRemoteFields();

    // Populate table.
    for (FieldInfo field : fields) {
        Map<String, String> values = new HashMap<String, String>();
        values.put("Name", field.getName());
        values.put("Type", field.getType());
        values.put("Unique", Boolean.toString(StringUtils.equals(field.getName(), uniqueField)));
        values.put("Distinct", Integer.toString(field.getDistinct()));
        values.put("Schema", field.getSchema());
        for (FieldFlag flag : FieldFlag.values()) {
            EnumSet<FieldFlag> flags = SolrUtils.getFlags(field);
            values.put(flag.getDisplay(), Boolean.toString(flags.contains(flag)));
        }/*from  ww  w .j  av a 2 s . co m*/
        addRow(values);
    }
}