public static Collection searchByAttribute( GeopistaLayer geopistaLayer, int attributeNumber, String value) { Collection finalFeatures = new ArrayList(); if (geopistaLayer == null) return finalFeatures; java.util.List allFeaturesList = geopistaLayer.getFeatureCollectionWrapper().getFeatures(); Iterator allFeaturesListIter = allFeaturesList.iterator(); while (allFeaturesListIter.hasNext()) { Feature localFeature = (Feature) allFeaturesListIter.next(); String nombreAtributo = localFeature.getString(attributeNumber).trim(); if (nombreAtributo.equals(value)) { finalFeatures.add(localFeature); } } return finalFeatures; }
/** * Añade todos los atributos de las capas seleccionadas * * @param extractLayers * @return */ private NamedVector[] getRootLayerNodes(ArrayList<GeopistaLayer> extractLayers) { NamedVector[] returnVector = null; if (extractLayers != null) { GeopistaLayer geopistaLayer = null; String layerSystemId; EIELFilesUtils eielFilesUtils; String layerName; returnVector = new NamedVector[extractLayers.size()]; // capas for (int i = 0; i < extractLayers.size(); i++) { geopistaLayer = extractLayers.get(i); layerSystemId = geopistaLayer.getSystemId(); eielFilesUtils = new EIELFilesUtils(layerSystemId); layerName = geopistaLayer.getName(); // buscamos el identificador de cada capa GeopistaSchema featureGeoSchema = (GeopistaSchema) geopistaLayer.getFeatureCollectionWrapper().getFeatureSchema(); // atributos NamedVector namedVector = new NamedVector(layerName); Column columnByAttribute = null; String colName = null; for (int j = 0; j < featureGeoSchema.getAttributeCount(); j++) { columnByAttribute = featureGeoSchema.getColumnByAttribute(j); colName = columnByAttribute.getName(); if (colName.toLowerCase().equals(GEOMETRY_ATR)) { // no lo mostramos continue; } // CAMBIAR: COMPROBAR SI SE DEBE SELECCIONAR id SI ES TIPO EIEL else if (colName.toLowerCase().equals(Constants.FIELD_ID)) { // lo ponemos al principio namedVector.add(0, new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false)); } else if (colName.toLowerCase().equals(Constants.FIELD_ID_MUNICIPIO)) { namedVector.add(1, new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false)); } // caso especial para licencias // la referencia castastral será el atributo clave para localizar la licencia else if (colName.toLowerCase().contains(Constants.CLAVE_METAINFO) && Utils.isInArray(Constants.TIPOS_LICENCIAS, layerSystemId)) { namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false)); } // caso especial para inventario de patrimonio else if (colName.toLowerCase().equals(Constants.NUM_BIENES_ID) && Utils.isInArray(Constants.TIPOS_INVENTARIO, layerSystemId)) { namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false)); } // caso especial para EIEL else if (Utils.isInArray(Constants.TIPOS_EIEL, layerSystemId)) { if (isPkFieldEIEL(eielFilesUtils, layerSystemId, colName)) namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), true, false)); else namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), false, true)); } else { // simplemente lo añadimos // if(!(licUtils.isInArray(Constants.TIPOS_LICENCIAS, layerSystemId) || // licUtils.isInArray(Constants.TIPOS_INVENTARIO, layerSystemId))){ if (!Utils.isInArray(Constants.TIPOS_LICENCIAS, layerSystemId)) { namedVector.add(new CheckBoxNode(featureGeoSchema.getAttributeName(j), false, true)); } } } returnVector[i] = namedVector; } } return returnVector; }