Package com.cloud.utils.db

Examples of com.cloud.utils.db.TransactionLegacy.start()


        SearchBuilder<CloudStackUserVO> searchByAccessKey = createSearchBuilder();
        searchByAccessKey.and("apiKey", searchByAccessKey.entity().getApiKey(), SearchCriteria.Op.EQ);
        searchByAccessKey.done();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
        try {
            txn.start();
            SearchCriteria<CloudStackUserVO> sc = searchByAccessKey.create();
            sc.setParameters("apiKey", accessKey);
            user = findOneBy(sc);
            if (user != null && user.getSecretKey() != null) {
                // User secret key could be encrypted
View Full Code Here


        Filter filter = new Filter(MultiPartUploadsVO.class, "nameKey", Boolean.TRUE, null, null);
        filter.addOrderBy(MultiPartUploadsVO.class, "createTime", Boolean.TRUE);

        TransactionLegacy txn = TransactionLegacy.open("cloudbridge", TransactionLegacy.AWSAPI_DB, true);
        try {
            txn.start();
            SearchCriteria<MultiPartUploadsVO> sc = byBucket.create();
            sc.setParameters("BucketName", bucketName);
            if (null != prefix)
                sc.setParameters("NameKey", prefix);
            if (null != uploadIdMarker)
View Full Code Here

        SearchBuilder<SBucketVO> SearchByName = createSearchBuilder();
        SearchByName.and("Name", SearchByName.entity().getName(), SearchCriteria.Op.EQ);
        //Transaction txn = Transaction.open(Transaction.AWSAPI_DB);
        TransactionLegacy txn = TransactionLegacy.open("cloudbridge", TransactionLegacy.AWSAPI_DB, true);
        try {
            txn.start();
            SearchCriteria<SBucketVO> sc = SearchByName.create();
            sc.setParameters("Name", bucketName);
            return findOneBy(sc);

        } finally {
View Full Code Here

        SearchBuilder<SBucketVO> ByCanonicalID = createSearchBuilder();
        ByCanonicalID.and("OwnerCanonicalID", ByCanonicalID.entity().getOwnerCanonicalId(), SearchCriteria.Op.EQ);
        Filter filter = new Filter(SBucketVO.class, "createTime", Boolean.TRUE, null, null);
        TransactionLegacy txn = TransactionLegacy.currentTxn()// Transaction.open("cloudbridge", Transaction.AWSAPI_DB, true);
        try {
            txn.start();
            SearchCriteria<SBucketVO> sc = ByCanonicalID.create();
            sc.setParameters("OwnerCanonicalID", canonicalId);
            return listBy(sc, filter);
        } finally {
            txn.close();
View Full Code Here

    @Override
    public int getOfferingCount() {
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            return listAll().size();
        } finally {
            txn.commit();
            txn.close();
        }
View Full Code Here

        SearchBuilder<OfferingBundleVO> searchByAmazon = createSearchBuilder();
        searchByAmazon.and("AmazonEC2Offering", searchByAmazon.entity().getAmazonOffering(), SearchCriteria.Op.EQ);
        searchByAmazon.done();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            SearchCriteria<OfferingBundleVO> sc = searchByAmazon.create();
            sc.setParameters("AmazonEC2Offering", amazonEC2Offering);
            return findOneBy(sc).getCloudstackOffering();
        } finally {
            txn.commit();
View Full Code Here

        SearchBuilder<OfferingBundleVO> searchByAmazon = createSearchBuilder();
        searchByAmazon.and("CloudStackOffering", searchByAmazon.entity().getAmazonOffering(), SearchCriteria.Op.EQ);
        searchByAmazon.done();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            SearchCriteria<OfferingBundleVO> sc = searchByAmazon.create();
            sc.setParameters("CloudStackOffering", cloudStackOffering);
            return findOneBy(sc).getAmazonOffering();
        } finally {
            txn.commit();
View Full Code Here

        searchByAmazon.and("AmazonEC2Offering", searchByAmazon.entity().getCloudstackOffering(), SearchCriteria.Op.EQ);
        searchByAmazon.done();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        OfferingBundleVO offering = null;
        try {
            txn.start();
            SearchCriteria<OfferingBundleVO> sc = searchByAmazon.create();
            sc.setParameters("CloudStackOffering", cloudStackOffering);
            sc.setParameters("AmazonEC2Offering", amazonEC2Offering);
            offering = findOneBy(sc);
            if (null == offering) {
View Full Code Here

        SearchBuilder<OfferingBundleVO> searchByAmazon = createSearchBuilder();
        searchByAmazon.and("AmazonEC2Offering", searchByAmazon.entity().getAmazonOffering(), SearchCriteria.Op.EQ);
        searchByAmazon.done();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            SearchCriteria<OfferingBundleVO> sc = searchByAmazon.create();
            sc.setParameters("AmazonEC2Offering", amazonEC2Offering);
            remove(sc);
            txn.commit();
        } finally {
View Full Code Here

        SearchBuilder<SHostVO> HostSearch = createSearchBuilder();
        HostSearch.and("Host", HostSearch.entity().getHost(), SearchCriteria.Op.EQ);
        HostSearch.done();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            SearchCriteria<SHostVO> sc = HostSearch.create();
            sc.setParameters("Host", host);
            return findOneBy(sc);
        } finally {
            txn.commit();
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.