/** * Add this event to the queue entries in IndexUpdates. */ @Override public void addToQueue(DocStoreUpdates docStoreUpdates) { switch (type) { case INSERT: docStoreUpdates.queueIndex(beanDescriptor.getDocStoreQueueId(), idValue); break; case UPDATE: case DELETE_SOFT: docStoreUpdates.queueIndex(beanDescriptor.getDocStoreQueueId(), idValue); break; case DELETE: docStoreUpdates.queueDelete(beanDescriptor.getDocStoreQueueId(), idValue); break; default: throw new IllegalStateException("Invalid type " + type); } }
private void registerBeanDescriptor(DeployBeanInfo<?> info) { BeanDescriptor desc = new BeanDescriptor<>(this, info.getDescriptor()); descMap.put(desc.getBeanType().getName(), desc); if (desc.isDocStoreMapped()) { descQueueMap.put(desc.getDocStoreQueueId(), desc); } }
/** * For requests that update document store add this event to either the list * of queue events or list of update events. */ public void addDocStoreUpdates(DocStoreUpdates docStoreUpdates) { if (type == Type.UPDATE) { beanDescriptor.docStoreUpdateEmbedded(this, docStoreUpdates); } switch (docStoreMode) { case UPDATE: { docStoreUpdates.addPersist(this); return; } case QUEUE: { if (type == Type.DELETE) { docStoreUpdates.queueDelete(beanDescriptor.getDocStoreQueueId(), idValue); } else { docStoreUpdates.queueIndex(beanDescriptor.getDocStoreQueueId(), idValue); } } break; default: break; } }
/** * Add the deletes to the DocStoreUpdates. */ void addDocStoreUpdates(DocStoreUpdates docStoreUpdates, DocStoreMode txnIndexMode) { for (BeanPersistIds deleteIds : beanMap.values()) { BeanDescriptor<?> desc = deleteIds.getBeanDescriptor(); DocStoreMode mode = desc.getDocStoreMode(PersistRequest.Type.DELETE, txnIndexMode); if (DocStoreMode.IGNORE != mode) { // Add to queue or bulk update entries boolean queue = (DocStoreMode.QUEUE == mode); String queueId = desc.getDocStoreQueueId(); List<Object> idValues = deleteIds.getIds(); if (idValues != null) { for (Object idValue : idValues) { if (queue) { docStoreUpdates.queueDelete(queueId, idValue); } else { docStoreUpdates.addDelete(new DocStoreDeleteEvent(desc, idValue)); } } } } } } }
/** * Register invalidation paths for embedded documents. */ @Override public void registerPaths() { if (mapped && !registerPaths) { Collection<PathProperties.Props> pathProps = docStructure.doc().getPathProps(); for (PathProperties.Props pathProp : pathProps) { String path = pathProp.getPath(); if (path != null) { BeanDescriptor<?> targetDesc = desc.getBeanDescriptor(path); BeanProperty idProperty = targetDesc.getIdProperty(); if (idProperty != null) { // embedded beans don't have id property String fullPath = path + "." + idProperty.getName(); targetDesc.docStoreAdapter().registerInvalidationPath(desc.getDocStoreQueueId(), fullPath, pathProp.getProperties()); } } } registerPaths = true; } }
/** * Add this event to the queue entries in IndexUpdates. */ @Override public void addToQueue(DocStoreUpdates docStoreUpdates) { switch (type) { case INSERT: docStoreUpdates.queueIndex(beanDescriptor.getDocStoreQueueId(), idValue); break; case UPDATE: case DELETE_SOFT: docStoreUpdates.queueIndex(beanDescriptor.getDocStoreQueueId(), idValue); break; case DELETE: docStoreUpdates.queueDelete(beanDescriptor.getDocStoreQueueId(), idValue); break; default: throw new IllegalStateException("Invalid type " + type); } }
private void registerBeanDescriptor(DeployBeanInfo<?> info) { BeanDescriptor desc = new BeanDescriptor<>(this, info.getDescriptor()); descMap.put(desc.getBeanType().getName(), desc); if (desc.isDocStoreMapped()) { descQueueMap.put(desc.getDocStoreQueueId(), desc); } }
/** * For requests that update document store add this event to either the list * of queue events or list of update events. */ public void addDocStoreUpdates(DocStoreUpdates docStoreUpdates) { if (type == Type.UPDATE) { beanDescriptor.docStoreUpdateEmbedded(this, docStoreUpdates); } switch (docStoreMode) { case UPDATE: { docStoreUpdates.addPersist(this); return; } case QUEUE: { if (type == Type.DELETE) { docStoreUpdates.queueDelete(beanDescriptor.getDocStoreQueueId(), idValue); } else { docStoreUpdates.queueIndex(beanDescriptor.getDocStoreQueueId(), idValue); } } break; default: break; } }
/** * Add the deletes to the DocStoreUpdates. */ void addDocStoreUpdates(DocStoreUpdates docStoreUpdates, DocStoreMode txnIndexMode) { for (BeanPersistIds deleteIds : beanMap.values()) { BeanDescriptor<?> desc = deleteIds.getBeanDescriptor(); DocStoreMode mode = desc.getDocStoreMode(PersistRequest.Type.DELETE, txnIndexMode); if (DocStoreMode.IGNORE != mode) { // Add to queue or bulk update entries boolean queue = (DocStoreMode.QUEUE == mode); String queueId = desc.getDocStoreQueueId(); List<Object> idValues = deleteIds.getIds(); if (idValues != null) { for (Object idValue : idValues) { if (queue) { docStoreUpdates.queueDelete(queueId, idValue); } else { docStoreUpdates.addDelete(new DocStoreDeleteEvent(desc, idValue)); } } } } } } }
/** * Register invalidation paths for embedded documents. */ @Override public void registerPaths() { if (mapped && !registerPaths) { Collection<PathProperties.Props> pathProps = docStructure.doc().getPathProps(); for (PathProperties.Props pathProp : pathProps) { String path = pathProp.getPath(); if (path != null) { BeanDescriptor<?> targetDesc = desc.getBeanDescriptor(path); BeanProperty idProperty = targetDesc.getIdProperty(); if (idProperty != null) { // embedded beans don't have id property String fullPath = path + "." + idProperty.getName(); targetDesc.docStoreAdapter().registerInvalidationPath(desc.getDocStoreQueueId(), fullPath, pathProp.getProperties()); } } } registerPaths = true; } }