object.getId(), Field.Store.YES)); doc.add(new StringField(MetaObject.META_OBJECT_TYPE, object.getType().getName(), Field.Store.YES)); doc.add(new TextField(MetaObject.META_OBJECT_KEY, object.getKey(), Field.Store.YES)); doc.add(new StringField(MetaObject.META_OBJECT_CLUSTER_ID, object.getClusterId(), Field.Store.YES)); doc.add(new StringField(MetaObject.META_OBJECT_SEGMENT_ID, object.getSegmentId(), Field.Store.YES)); final StringBuilder allText = new StringBuilder(object.getKey()).append('\n'); for (final KProperty<?> property : object.getProperties()) { final IndexableField[] fields = fieldFactory.build(property); for (final IndexableField field : fields) { if (object.fullText()) { doc.add(new TextField(FULL_TEXT_FIELD, allText.toString().toLowerCase(),
private static String generateUniqueIdentifierForKObject(final KObject kObject) { return kObject.getClusterId() + kObject.getKey(); }
private void deleteIfExists(KObject object) { if (this.exists(object.getClusterId(), object.getId())) { this.delete(object.getClusterId(), object.getId()); } }
public MetaObject newMetaObject(final KObject object) { final Set<MetaProperty> properties = new HashSet<>(); Optional.ofNullable(object.getProperties()).ifPresent(kProperties -> StreamSupport.stream(kProperties.spliterator(), false).forEach(property -> properties.add(newMetaProperty(property)))); return new MetaObjectImpl(object.getType(), properties); }
@Override public List<RefactoringPageRow> buildResponse(final List<KObject> kObjects) { final List<RefactoringPageRow> result = new ArrayList<RefactoringPageRow>(kObjects.size()); for (final KObject kObject : kObjects) { final Path path = Paths.convert(ioService.get(URI.create(kObject.getKey()))); final RefactoringPathPageRow row = new RefactoringPathPageRow(); row.setValue(path); result.add(row); } return result; } }
@Override public List<RefactoringPageRow> buildResponse(final List<KObject> kObjects) { final List<RefactoringPageRow> result = new ArrayList<RefactoringPageRow>(kObjects.size()); for (final KObject kObject : kObjects) { String formId = findFormId(kObject.getProperties()); if (formId != null) { final Path path = Paths.convert(ioService.get(URI.create(kObject.getKey()))); Map<String, Path> map = new HashMap<String, Path>(); map.put(formId, path); RefactoringMapPageRow row = new RefactoringMapPageRow(); row.setValue(map); result.add(row); } } return result; }
@Override public Iterable<KProperty<?>> getProperties() { return ((KObject) delegate).getProperties(); }
public void updateMetaModel(KObject object, MetaObject metaObject) { List<MetaProperty> dirtyProperties = new ArrayList<>(); Optional<MappingMetaData> mappingOptional = this.indexProvider.getMapping(object.getClusterId(), object.getType().getName()); if (!mappingOptional.isPresent()) { this.indexProvider.putMapping(object.getClusterId(), object.getType().getName(), metaObject); } else { Map<String, Object> mapping = mappingOptional.get().getSourceAsMap(); Optional.ofNullable(object.getProperties()) .ifPresent(kProperties -> { for (final KProperty property : object.getProperties()) { Object config = mapping.get(property.getName()); if (config == null) { Optional<MetaProperty> prop = metaObject.getProperty(property.getName()); prop.ifPresent(metaProperty -> dirtyProperties.add(metaProperty)); } } }); this.indexProvider.putMapping(object.getClusterId(), object.getType().getName(), dirtyProperties); } }
@Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (!(obj instanceof KObject)) { return false; } final KObject kobj = (KObject) obj; return getClusterId().equals(kobj.getClusterId()) && getId().equals(kobj.getId()) && getKey().equals(kobj.getKey()) && getType().getName().equals(kobj.getType().getName()); }
public Schema buildSchema(KObject kObject, Set<Message> messages) { return new Schema(kObject.getClusterId(), ORG_KIE, messages); }
public void updateSchema(KObject kObject) { String clustedId = toProtobufFormat(kObject.getClusterId()); Optional<Schema> storedSchema = this.infinispanContext.getSchema(clustedId); this.infinispanContext.addProtobufSchema(kObject.getClusterId(), newSchema); } else { String type = toProtobufFormat(kObject.getClusterId() + "_" + kObject.getType().getName()); Optional<Message> storedMessage = this.getMessage(storedSchema.get(), type); messages); this.infinispanContext.addSchema(newSchema); this.infinispanContext.addProtobufSchema(kObject.getClusterId(), newSchema);
@Override public void index(List<KObject> elements) { elements.forEach(ko -> { final LuceneIndex index = (LuceneIndex) indexManager.indexOf(ko); index.indexDocument(ko.getId(), newDocument(ko)); }); elements.stream() .map(ko -> (LuceneIndex) indexManager.indexOf(ko)) .collect(Collectors.toSet()) .forEach(luceneIndex -> luceneIndex.commit()); }
@Override public List<RefactoringPageRow> buildResponse(final List<KObject> kObjects) { final List<RefactoringPageRow> result = new ArrayList<RefactoringPageRow>(kObjects.size()); for (final KObject kObject : kObjects) { final Path path = Paths.convert(ioService.get(URI.create(kObject.getKey()))); final RefactoringPathPageRow row = new RefactoringPathPageRow(); row.setValue(path); result.add(row); } return result; } }
@Override public List<RefactoringPageRow> buildResponse(final List<KObject> kObjects) { final List<RefactoringPageRow> result = new ArrayList<RefactoringPageRow>(kObjects.size()); for (final KObject kObject : kObjects) { for (KProperty property : kObject.getProperties()) { if (property.getName().equals(processIdResourceType.toString())) { String bpmnProcessId = (String) property.getValue(); final Path path = Paths.convert(ioService.get(URI.create(kObject.getKey()))); Map<String, Path> map = new HashMap<String, Path>(); map.put(bpmnProcessId, path); RefactoringMapPageRow row = new RefactoringMapPageRow(); row.setValue(map); result.add(row); } } } return result; } }
@Override public Iterable<KProperty<?>> getProperties() { return ((KObject) delegate).getProperties(); }
public void updateMetaModel(KObject object, MetaObject metaObject) { List<MetaProperty> dirtyProperties = new ArrayList<>(); Optional<MappingMetaData> mappingOptional = this.indexProvider.getMapping(object.getClusterId(), object.getType().getName()); if (!mappingOptional.isPresent()) { this.indexProvider.putMapping(object.getClusterId(), object.getType().getName(), metaObject); } else { Map<String, Object> mapping = mappingOptional.get().getSourceAsMap(); Optional.ofNullable(object.getProperties()) .ifPresent(kProperties -> { for (final KProperty property : object.getProperties()) { Object config = mapping.get(property.getName()); if (config == null) { Optional<MetaProperty> prop = metaObject.getProperty(property.getName()); prop.ifPresent(metaProperty -> dirtyProperties.add(metaProperty)); } } }); this.indexProvider.putMapping(object.getClusterId(), object.getType().getName(), dirtyProperties); } }
public void updateMetaModel(final KObject object) { final MetaObject metaObject = metaModelStore.getMetaObject(object.getType().getName()); if (metaObject == null) { metaModelStore.add(newMetaObject(object)); } else { Optional.ofNullable(object.getProperties()) .ifPresent(kProperties -> { for (final KProperty property : object.getProperties()) { final Optional<MetaProperty> metaProperty = metaObject.getProperty(property.getName()); if (!metaProperty.isPresent()) { metaObject.addProperty(newMetaProperty(property)); } else { metaProperty.get().addType(property.getValue().getClass()); if (property.isSearchable()) { metaProperty.get().setAsSearchable(); } } } metaModelStore.update(metaObject); }); } }
public Schema buildSchema(KObject kObject, Set<Message> messages) { return new Schema(kObject.getClusterId(), ORG_KIE, messages); }
private void deleteIfExists(KObject object) { if (this.exists(object.getClusterId(), object.getId())) { this.delete(object.getClusterId(), object.getId()); } }
public void updateSchema(KObject kObject) { String clustedId = toProtobufFormat(kObject.getClusterId()); Optional<Schema> storedSchema = this.infinispanContext.getSchema(clustedId); this.infinispanContext.addProtobufSchema(kObject.getClusterId(), newSchema); } else { String type = toProtobufFormat(kObject.getClusterId() + "_" + kObject.getType().getName()); Optional<Message> storedMessage = this.getMessage(storedSchema.get(), type); messages); this.infinispanContext.addSchema(newSchema); this.infinispanContext.addProtobufSchema(kObject.getClusterId(), newSchema);