pkg persistence GraphStore - yshehab/SchoolRoomBooking GitHub Wiki

DbService Class

Description

A coordinating class to provide the services of the persistence layer. All services required from the persistence layer should be requested from this class.

Package

persistence

Constructor

None defined in the class.

Static Members

Neo4j mediator object that provides access to Neoj services.

private static final Neo4jTemplate neo4jMediator

Entity repositories. (Each provides CRUD operations for one entity)

private static final MemberRepository memberRepository
private static final AddressRepository addressRepository
private static final OrganizationRepository organizationRepo
private static final PermitRepository permitRepo
private static final BookingRepository bookingRepo

Attributes

None

Links

None

Protocol

This is a service class, hence all protocol is static.

Static Methods

public static Member persistMember(Member aMember

Persists aMember into the graphDb.

Post condition: Nodes for the Name, Address and Email objects linked to aMember would have been created, and relationships called, reached_at and has_email should have been created between aMember node and the Name, Address and Email nodes respectively.

public static Organization persistOrganization(Organization org)
public static Booking perisitBooking(Booking aBooking)
public static void persistTimeSlot(TimeSlot aSlot)
public static void persistRange(Range<TimeSlot> slots)


public static Member retrieveMember(Member aMember) 

Searches for and retrieves aMember object.

Post condition: Returns aMember if it exists in the database, null otherwise.

public static Iterable<Member> retrieveAllMembers()

Retrieves all Member objects in the database.

public static Address retrieveAddressByIdentifier(String addressIdentifier)

Searches for and retrieves an Address by its identifier.

Post condition: Return The address with identifier addressIdentifier if it exists, null otherwise.

Inner Classes

None

Examples

Using retrieveAddressByIdentifier to ensure addresses are unique.

public static Address createNewAddress()
{
    Address newAddress = GraphStore.retrieveAddressByIdentifier(aHouseNum + aPostCode);
    if (newAddress == null) {
        newAddress = new Address(aHouseNum, aFirstLine, aSecondLine, aTown, aCounty, aPostCode);
    }
    return newAddress;
}

Discussion

⚠️ **GitHub.com Fallback** ⚠️