Package com.cloud.utils.db

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


    public String getDefaultZoneId(String accountId) {

        SearchBuilder<CloudStackAccountVO> SearchByUUID = createSearchBuilder();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.CLOUD_DB);
        try {
            txn.start();
            SearchByUUID.and("uuid", SearchByUUID.entity().getUuid(), SearchCriteria.Op.EQ);
            SearchByUUID.done();
            SearchCriteria<CloudStackAccountVO> sc = SearchByUUID.create();
            sc.setParameters("uuid", accountId);
            CloudStackAccountVO account = findOneBy(sc);
View Full Code Here


    public MHostMountVO getHostMount(long mHostId, long sHostId) {
        SearchByMHostID.and("MHostID", SearchByMHostID.entity().getmHostID(), SearchCriteria.Op.EQ);
        SearchByMHostID.and("SHostID", SearchByMHostID.entity().getsHostID(), SearchCriteria.Op.EQ);
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            SearchCriteria<MHostMountVO> sc = SearchByMHostID.create();
            sc.setParameters("MHostID", mHostId);
            sc.setParameters("SHostID", sHostId);
            return findOneBy(sc);
        } finally {
View Full Code Here

    @Override
    public UserCredentialsVO getByAccessKey(String cloudAccessKey) {
        SearchBuilder<UserCredentialsVO> SearchByAccessKey = createSearchBuilder();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            SearchByAccessKey.and("AccessKey", SearchByAccessKey.entity().getAccessKey(), SearchCriteria.Op.EQ);
            SearchByAccessKey.done();
            SearchCriteria<UserCredentialsVO> sc = SearchByAccessKey.create();
            sc.setParameters("AccessKey", cloudAccessKey);
            return findOneBy(sc);
View Full Code Here

    public UserCredentialsVO getByCertUniqueId(String certId) {
        SearchBuilder<UserCredentialsVO> SearchByCertID = createSearchBuilder();
        SearchByCertID.and("CertUniqueId", SearchByCertID.entity().getCertUniqueId(), SearchCriteria.Op.EQ);
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            SearchCriteria<UserCredentialsVO> sc = SearchByCertID.create();
            sc.setParameters("CertUniqueId", certId);
            return findOneBy(sc);
        } finally {
            txn.commit();
View Full Code Here

    @DB
    public void update(long id, long runid, String name, String version, String serviceIP, int servicePort, Date lastUpdate) {
        TransactionLegacy txn = TransactionLegacy.currentTxn();
        PreparedStatement pstmt = null;
        try {
            txn.start();

            pstmt =
                txn.prepareAutoCloseStatement("update mshost set name=?, version=?, service_ip=?, service_port=?, last_update=?, removed=null, alert_count=0, runid=?, state=? where id=?");
            pstmt.setString(1, name);
            pstmt.setString(2, version);
View Full Code Here

    @DB
    public boolean remove(Long id) {
        TransactionLegacy txn = TransactionLegacy.currentTxn();

        try {
            txn.start();

            ManagementServerHostVO msHost = findById(id);
            msHost.setState(ManagementServerHost.State.Down);
            super.remove(id);
View Full Code Here

    @DB
    public void update(long id, long runid, Date lastUpdate) {
        TransactionLegacy txn = TransactionLegacy.currentTxn();
        PreparedStatement pstmt = null;
        try {
            txn.start();

            pstmt = txn.prepareAutoCloseStatement("update mshost set last_update=?, removed=null, alert_count=0 where id=? and runid=?");
            pstmt.setString(1, DateUtil.getDateDisplayString(TimeZone.getTimeZone("GMT"), lastUpdate));
            pstmt.setLong(2, id);
            pstmt.setLong(3, runid);
View Full Code Here

    public int increaseAlertCount(long id) {
        TransactionLegacy txn = TransactionLegacy.currentTxn();
        PreparedStatement pstmt = null;
        int changedRows = 0;
        try {
            txn.start();

            pstmt = txn.prepareAutoCloseStatement("update mshost set alert_count=alert_count+1 where id=? and alert_count=0");
            pstmt.setLong(1, id);

            changedRows = pstmt.executeUpdate();
View Full Code Here

    @Override
    @DB
    public void updatePeerInfo(long ownerMshost, long peerMshost, long peerRunid, ManagementServerHost.State peerState) {
        TransactionLegacy txn = TransactionLegacy.currentTxn();
        try {
            txn.start();

            SearchCriteria<ManagementServerHostPeerVO> sc = FindForUpdateSearch.create();
            sc.setParameters("ownerMshost", ownerMshost);
            sc.setParameters("peerMshost", peerMshost);
            sc.setParameters("peerRunid", peerRunid);
View Full Code Here

        SearchBuilder<MultipartMetaVO> searchByUID = createSearchBuilder();
        searchByUID.and("UploadID", searchByUID.entity().getUploadID(), SearchCriteria.Op.EQ);
        searchByUID.done();
        TransactionLegacy txn = TransactionLegacy.open(TransactionLegacy.AWSAPI_DB);
        try {
            txn.start();
            SearchCriteria<MultipartMetaVO> sc = searchByUID.create();
            sc.setParameters("UploadID", uploadID);
            return listBy(sc);

        } finally {
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.