aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LicenseAgreementCassandraLoader.java
blob: ca44209bdb09505772f3b2f14da44e7364dafec9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package org.openecomp.core.migration.loaders;

import com.datastax.driver.mapping.Result;
import com.datastax.driver.mapping.annotations.Accessor;
import com.datastax.driver.mapping.annotations.Query;
import org.openecomp.core.nosqldb.api.NoSqlDb;
import org.openecomp.core.nosqldb.factory.NoSqlDbFactory;
import org.openecomp.sdc.vendorlicense.dao.types.LicenseAgreementEntity;

import java.util.Collection;

/**
 * Created by ayalaben on 4/25/2017.
 */
public class LicenseAgreementCassandraLoader {

    private static final NoSqlDb noSqlDb = NoSqlDbFactory.getInstance().createInterface();
    private static final LicenseAgreementCassandraLoader.LicenseAgreementAccessor accessor =
            noSqlDb.getMappingManager().createAccessor(LicenseAgreementCassandraLoader.LicenseAgreementAccessor.class);

    public Collection<LicenseAgreementEntity> list() {
        return accessor.getAll().all();
    }

    @Accessor
    interface LicenseAgreementAccessor {
        @Query("SELECT * FROM license_agreement")
        Result<LicenseAgreementEntity> getAll();

    }
}