Search in sources :

Example 1 with MembershipMongo

use of io.gravitee.am.repository.mongodb.management.internal.model.MembershipMongo in project gravitee-access-management by gravitee-io.

the class MongoMembershipRepository method convert.

private MembershipMongo convert(Membership membership) {
    MembershipMongo membershipMongo = new MembershipMongo();
    membershipMongo.setId(membership.getId());
    membershipMongo.setDomain(membership.getDomain());
    membershipMongo.setMemberId(membership.getMemberId());
    membershipMongo.setMemberType(membership.getMemberType().name());
    membershipMongo.setReferenceId(membership.getReferenceId());
    membershipMongo.setReferenceType(membership.getReferenceType().name());
    membershipMongo.setRole(membership.getRoleId());
    membershipMongo.setCreatedAt(membership.getCreatedAt());
    membershipMongo.setUpdatedAt(membership.getUpdatedAt());
    return membershipMongo;
}
Also used : MembershipMongo(io.gravitee.am.repository.mongodb.management.internal.model.MembershipMongo)

Example 2 with MembershipMongo

use of io.gravitee.am.repository.mongodb.management.internal.model.MembershipMongo in project gravitee-access-management by gravitee-io.

the class MongoMembershipRepository method create.

@Override
public Single<Membership> create(Membership item) {
    MembershipMongo membership = convert(item);
    membership.setId(membership.getId() == null ? RandomString.generate() : membership.getId());
    return Single.fromPublisher(membershipsCollection.insertOne(membership)).map(success -> convert(membership));
}
Also used : MembershipMongo(io.gravitee.am.repository.mongodb.management.internal.model.MembershipMongo)

Aggregations

MembershipMongo (io.gravitee.am.repository.mongodb.management.internal.model.MembershipMongo)2