Package org.geotools.data.solr

Examples of org.geotools.data.solr.SolrLayerConfiguration


    @Override
    public boolean initialize(FeatureTypeInfo info,
            DataAccess<? extends FeatureType, ? extends Feature> dataAccess, Name temporaryName)
            throws IOException {
        SolrLayerConfiguration configuration = (SolrLayerConfiguration) info.getMetadata().get(
                SolrLayerConfiguration.KEY);
        if (configuration != null) {
            SolrDataStore dataStore = (SolrDataStore) dataAccess;
            dataStore.setSolrConfigurations(configuration);
        }
View Full Code Here


    @Override
    public void dispose(FeatureTypeInfo info,
            DataAccess<? extends FeatureType, ? extends Feature> dataAccess, Name temporaryName)
            throws IOException {
        SolrLayerConfiguration configuration = (SolrLayerConfiguration) info.getMetadata().get(
                SolrLayerConfiguration.KEY);
        SolrDataStore dataStore = (SolrDataStore) dataAccess;
        dataStore.getSolrConfigurations().remove(configuration.getLayerName());
    }
View Full Code Here

     * @see {@link FeatureTypeInfo#getMetadata}
     */
    protected void onSave(AjaxRequestTarget target) {
        try {
            ResourceInfo ri = (ResourceInfo) getDefaultModel().getObject();
            SolrLayerConfiguration layerConfiguration = fillSolrAttributes(ri);

            Boolean pkSet = false;
            Boolean geomSet = false;
            Boolean sridSet = false;
            // Validate configuration
            for (SolrAttribute att : layerConfiguration.getAttributes()) {
                if (att.isPk() && att.isUse()) {
                    pkSet = true;
                }
                if (Geometry.class.isAssignableFrom(att.getType()) && att.isUse()) {
                    geomSet = true;
View Full Code Here

    /*
     * Load SolrLayerConfiguration configuration before shows on table Reloads SOLR attributes from
     * datastore and merge it with user attributes configurations
     */
    private SolrLayerConfiguration fillSolrAttributes(ResourceInfo ri) {
        SolrLayerConfiguration solrLayerConfiguration = (SolrLayerConfiguration) ri.getMetadata()
                .get(SolrLayerConfiguration.KEY);
        try {

            ArrayList<SolrAttribute> result = new ArrayList<SolrAttribute>();
            Map<String, SolrAttribute> tempMap = new HashMap<String, SolrAttribute>();
            if (solrLayerConfiguration != null) {
                for (SolrAttribute att : solrLayerConfiguration.getAttributes()) {
                    tempMap.put(att.getName(), att);
                }
            } else {
                tempMap.clear();
                solrLayerConfiguration = new SolrLayerConfiguration(new ArrayList<SolrAttribute>());
                solrLayerConfiguration.setLayerName(ri.getName());
                ri.getMetadata().put(SolrLayerConfiguration.KEY, solrLayerConfiguration);
            }
            SolrDataStore dataStore = (SolrDataStore) ((DataStoreInfo) ri.getStore())
                    .getDataStore(new NullProgressListener());
            ArrayList<SolrAttribute> attributes = dataStore
                    .getSolrAttributes(solrLayerConfiguration.getLayerName());
            for (SolrAttribute at : attributes) {
                if (tempMap.containsKey(at.getName())) {
                    SolrAttribute prev = tempMap.get(at.getName());
                    prev.setEmpty(at.getEmpty());
                    at = prev;
                }
                result.add(at);
            }
            solrLayerConfiguration.getAttributes().clear();
            solrLayerConfiguration.getAttributes().addAll(result);
        } catch (Exception e) {
            LOGGER.log(Level.SEVERE, e.getMessage(), e);
        }
        return solrLayerConfiguration;
    }
View Full Code Here

TOP

Related Classes of org.geotools.data.solr.SolrLayerConfiguration

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.