Refine search
@Override public Status insert(String table, String key, Map<String, ByteIterator> values) { try (ODatabaseDocumentTx db = databasePool.acquire()) { final ODocument document = new ODocument(CLASS); for (Map.Entry<String, String> entry : StringByteIterator.getStringMap(values).entrySet()) { document.field(entry.getKey(), entry.getValue()); } document.save(); final ODictionary<ORecord> dictionary = db.getMetadata().getIndexManager().getDictionary(); dictionary.put(key, document); return Status.OK; } catch (Exception e) { e.printStackTrace(); } return Status.ERROR; }
ODocument doc = new ODocument(documentType); doc.fromMap(fileContents); boolean cached = fileContents.get(String.valueOf(DocumentAttributes.CACHED)) != null ? Boolean.valueOf((String) fileContents.get(String.valueOf(DocumentAttributes.CACHED))) : true; doc.field(String.valueOf(DocumentAttributes.CACHED), cached); doc.save(); } else {
private void registerStringResourceRequest(String key, String language, String style, String variation) { ODocument doc = new ODocument(OCLASS_LOCALIZATION); doc.field(OPROPERTY_KEY, key); doc.field(OPROPERTY_LANG, language); doc.field(OPROPERTY_STYLE, style); doc.field(OPROPERTY_VARIATION, variation); doc.field(OPROPERTY_ACTIVE, false); doc.save(); }
@Override public void onClick(Optional<AjaxRequestTarget> targetOptional) { ODocument newLocalization = new ODocument(OrienteerLocalizationModule.OCLASS_LOCALIZATION); T schemaObject = AbstractSchemaLocalizationWidget.this.getModelObject(); newLocalization.field(OrienteerLocalizationModule.OPROPERTY_KEY, getLocalizationKey(schemaObject)); newLocalization.field(OrienteerLocalizationModule.OPROPERTY_LANG, ""); newLocalization.field(OrienteerLocalizationModule.OPROPERTY_STYLE, ""); newLocalization.field(OrienteerLocalizationModule.OPROPERTY_VARIATION, ""); newLocalization.field(OrienteerLocalizationModule.OPROPERTY_VALUE, ""); newLocalization.field(OrienteerLocalizationModule.OPROPERTY_ACTIVE, false); getDatabase().save(newLocalization); targetOptional.ifPresent(target -> target.add(table)); }
public static ODocument getOrCreateDashboard(ODatabaseDocument db, String className, String domain, String tab) { String sql = String.format("select from %s where %s = ?", OCLASS_DASHBOARD, OPROPERTY_CLASS); List<ODocument> docs = db.query(new OSQLSynchQuery<>(sql, 1), className); ODocument doc; if (docs == null || docs.isEmpty()) { doc = new ODocument(OCLASS_DASHBOARD); doc.field(OPROPERTY_DOMAIN, domain); doc.field(OPROPERTY_TAB, tab); doc.field(OPROPERTY_CLASS, className); doc.save(); } else doc = docs.get(0); return doc; }
private ODocument createMetadata(final FulltextIndex annotation) { final ODocument metadata = new ODocument(); metadata.field(INDEX_RADIX, annotation.indexRadix()); metadata.field(STOP_WORDS, Lists.newArrayList(annotation.stopWords())); metadata.field(SEPARATOR_CHARS, annotation.separatorChars()); metadata.field(IGNORE_CHARS, annotation.ignoreChars()); metadata.field(MIN_WORD_LENGTH, annotation.minWordLength()); return metadata; } }
@Override public String getFinalResultAsJson() { final ODocument json = new ODocument(); json.field("type", getName()); json.field("creates", createsResult.toJSON(), OType.EMBEDDED); json.field("scans", scansResult.toJSON(), OType.EMBEDDED); json.field("reads", readsResult.toJSON(), OType.EMBEDDED); json.field("updates", updatesResult.toJSON(), OType.EMBEDDED); json.field("deletes", deletesResult.toJSON(), OType.EMBEDDED); return json.toJSON(""); }