Package com.saasovation.common.port.adapter.persistence.leveldb

Examples of com.saasovation.common.port.adapter.persistence.leveldb.LevelDBKey


        LevelDBUnitOfWork uow = LevelDBUnitOfWork.current();

        for (Product product : aProductCollection) {
            if (!locked) {
                LevelDBKey lockKey = new LevelDBKey(PRIMARY, product.tenantId().id());

                uow.lock(lockKey.key());

                locked = true;
            }

            this.save(product, uow);
View Full Code Here


            this.save(product, uow);
        }
    }

    private void remove(Product aProduct, LevelDBUnitOfWork aUoW) {
        LevelDBKey primaryKey = new LevelDBKey(PRIMARY, aProduct.tenantId().id(), aProduct.productId().id());
        aUoW.remove(primaryKey);

        LevelDBKey productsOfTenant = new LevelDBKey(primaryKey, PRODUCTS_OF_TENANT, aProduct.tenantId().id());
        aUoW.removeKeyReference(productsOfTenant);

        if (aProduct.discussionInitiationId() != null) {
            LevelDBKey productsOfDiscussion = new LevelDBKey(primaryKey, PRODUCT_OF_DISCUSSION, aProduct.tenantId().id(), aProduct.discussionInitiationId());
            aUoW.removeKeyReference(productsOfDiscussion);
        }
    }
View Full Code Here

            aUoW.removeKeyReference(productsOfDiscussion);
        }
    }

    private void save(Product aProduct, LevelDBUnitOfWork aUoW) {
        LevelDBKey primaryKey = new LevelDBKey(PRIMARY, aProduct.tenantId().id(), aProduct.productId().id());
        aUoW.write(primaryKey, aProduct);

        LevelDBKey productsOfTenant = new LevelDBKey(primaryKey, PRODUCTS_OF_TENANT, aProduct.tenantId().id());
        aUoW.updateKeyReference(productsOfTenant);

        if (aProduct.discussionInitiationId() != null) {
            LevelDBKey productsOfDiscussion = new LevelDBKey(primaryKey, PRODUCT_OF_DISCUSSION, aProduct.tenantId().id(), aProduct.discussionInitiationId());
            aUoW.updateKeyReference(productsOfDiscussion);
        }
    }
View Full Code Here

    @Override
    public Collection<Release> allProductReleases(TenantId aTenantId, ProductId aProductId) {
        List<Release> releases = new ArrayList<Release>();

        LevelDBKey productReleases = new LevelDBKey(PRODUCT_RELEASES, aTenantId.id(), aProductId.id());

        LevelDBUnitOfWork uow = LevelDBUnitOfWork.readOnly(this.database());

        List<Object> keys = uow.readKeys(productReleases);
View Full Code Here

        return new ReleaseId(UUID.randomUUID().toString().toUpperCase());
    }

    @Override
    public Release releaseOfId(TenantId aTenantId, ReleaseId aReleaseId) {
        LevelDBKey primaryKey = new LevelDBKey(PRIMARY, aTenantId.id(), aReleaseId.id());

        Release release =
                LevelDBUnitOfWork.readOnly(this.database())
                    .readObject(primaryKey.key().getBytes(), Release.class);

        return release;
    }
View Full Code Here

        return release;
    }

    @Override
    public void remove(Release aRelease) {
        LevelDBKey lockKey = new LevelDBKey(PRIMARY, aRelease.tenantId().id());

        LevelDBUnitOfWork uow = LevelDBUnitOfWork.current();

        uow.lock(lockKey.key());

        this.remove(aRelease, uow);
    }
View Full Code Here

        LevelDBUnitOfWork uow = LevelDBUnitOfWork.current();

        for (Release release : aReleaseCollection) {
            if (!locked) {
                LevelDBKey lockKey = new LevelDBKey(PRIMARY, release.tenantId().id());

                uow.lock(lockKey.key());

                locked = true;
            }

            this.remove(release, uow);
View Full Code Here

        }
    }

    @Override
    public void save(Release aRelease) {
        LevelDBKey lockKey = new LevelDBKey(PRIMARY, aRelease.tenantId().id());

        LevelDBUnitOfWork uow = LevelDBUnitOfWork.current();

        uow.lock(lockKey.key());

        this.save(aRelease, uow);
    }
View Full Code Here

        LevelDBUnitOfWork uow = LevelDBUnitOfWork.current();

        for (Release release : aReleaseCollection) {
            if (!locked) {
                LevelDBKey lockKey = new LevelDBKey(PRIMARY, release.tenantId().id());

                uow.lock(lockKey.key());

                locked = true;
            }

            this.save(release, uow);
View Full Code Here

            this.save(release, uow);
        }
    }

    private void remove(Release aRelease, LevelDBUnitOfWork aUoW) {
        LevelDBKey primaryKey = new LevelDBKey(PRIMARY, aRelease.tenantId().id(), aRelease.releaseId().id());
        aUoW.remove(primaryKey);

        LevelDBKey productReleases = new LevelDBKey(primaryKey, PRODUCT_RELEASES, aRelease.tenantId().id(), aRelease.productId().id());
        aUoW.removeKeyReference(productReleases);
    }
View Full Code Here

TOP

Related Classes of com.saasovation.common.port.adapter.persistence.leveldb.LevelDBKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.