aboutsummaryrefslogtreecommitdiffstats
path: root/openecomp-be/tools/migration/1702_to_1707_zusammen/src/main/java/org/openecomp/core/migration/loaders/LKGCassandraLoader.java
blob: 891a69eb141a30674da6680dcef94797ec0e7fe7 (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.LicenseKeyGroupEntity;

import java.util.Collection;

/**
 * Created by ayalaben on 4/24/2017
 */
public class LKGCassandraLoader {

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

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

    @Accessor
    interface LKGAccessor {
        @Query("SELECT * FROM license_key_group")
        Result<LicenseKeyGroupEntity> getAll();

    }
}