@Override public JSONObject getJSONObject() { return wrapped.getJSONObject(); }
@Override public SchemaExportInfo getExportInfo(String schemaName) throws Exception { if( exportInfoFromSchemaName.containsKey(schemaName) ){ return exportInfoFromSchemaName.get(schemaName); } SchemaExportInfo exportInfo = null; try { Document doc = getSchema(schemaName); if( null != doc ) { JSONArray jsonExport = doc.getJSONObject().optJSONArray("export"); if( null != jsonExport ) { exportInfo = SchemaExportInfo.parseJson(jsonExport); } } } catch(Exception e) { throw new Exception("Error parsing export field for schema: "+schemaName); } exportInfoFromSchemaName.put(schemaName,exportInfo); return exportInfo; }
@Override public SchemaExportInfo getCsvExportInfo(String schemaName) throws Exception { if( csvExportInfoFromSchemaName.containsKey(schemaName) ){ return csvExportInfoFromSchemaName.get(schemaName); } SchemaExportInfo exportInfo = null; try { Document doc = getSchema(schemaName); if( null != doc ) { JSONArray jsonExport = doc.getJSONObject().optJSONArray("csvExport"); if( null != jsonExport ) { exportInfo = SchemaExportInfo.parseJson(jsonExport); } } } catch(Exception e) { throw new Exception("Error parsing CSV export field for schema: "+schemaName,e); } csvExportInfoFromSchemaName.put(schemaName,exportInfo); return exportInfo; } }
@Override public boolean accepts(Document doc) throws Exception { if( filterType == Filter.ALL ) { return true; } Geometry geometry = null; try { JSONObject jsonDoc = doc.getJSONObject(); if( JSONSupport.containsKey(jsonDoc, "nunaliit_geom") ) { JSONObject jsonGeom = jsonDoc.getJSONObject("nunaliit_geom"); String wkt = jsonGeom.optString("wkt", null); if( null != wkt ){ geometry = wktParser.parseWkt(wkt); } } } catch(Exception e) { throw new Exception("Error while filtering on geometry", e); } return acceptsGeometry(geometry); }
JSONObject jsonDoc = doc.getJSONObject(); String docId = jsonDoc.optString("_id",null); String nunaliitType = jsonDoc.optString("nunaliit_type",null); JSONObject jsonDoc = doc.getJSONObject(); String nunaliitType = jsonDoc.optString("nunaliit_type",null); String name = jsonDoc.optString("name",null); Document doc = documentsByDocId.get(docId); File schemaDir = dirByDocId.get(docId); JSONObject jsonDoc = doc.getJSONObject(); String name = jsonDoc.getString("name"); JSONObject jsonDef = jsonDoc.getJSONObject("definition");
removeUndesiredFiles(doc.getJSONObject(), dir); JSONObject jsonObj = doc.getJSONObject(); Iterator<?> it = jsonObj.keys(); while( it.hasNext() ){
JSONObject jsonDoc = doc.getJSONObject(); diskVersion = jsonDoc.optInt(PROP_NAME_VERSION, 0);
if( 0 != objectComparator.compare(sourceDoc.getJSONObject(), targetDoc) ){ result.setDocumentModified(true);
JSONObject sourceJson = sourceDoc.getJSONObject(); if( null != jsonObjectConverter ){ sourceJson = jsonObjectConverter.convertObject(sourceJson);
@Override public DocumentDigest computeDocumentDigest(Document doc) throws Exception { try { JSONObject json = doc.getJSONObject(); // Initialize digest DocumentDigest dd = new DocumentDigest(); dd.setType(DIGEST_COMPUTER_TYPE); // Compute digest of main document String mainDigest = this.computeDigestFromJsonObject(json); dd.setDocDigest(mainDigest); // Process each attachment Collection<Attachment> attachments = doc.getAttachments(); if( null != attachments ) { for(Attachment attachment : attachments){ String digest = computeAttachmentDigest(attachment); dd.addAttachmentDigest(attachment.getName(), digest); } } return dd; } catch(Exception e) { throw new Exception("Error while computing document digest for "+doc.getId(), e); } }