Search in sources :

Example 1 with SpeakerFrame

use of org.openkilda.persistence.ferma.frames.SpeakerFrame in project open-kilda by telstra.

the class FermaSwitchConnectRepository method doAdd.

@Override
protected SwitchConnectFrame doAdd(SwitchConnectData data) {
    Switch owner = data.getOwner();
    if (owner == null || owner.getSwitchId() == null) {
        throw new IllegalArgumentException("Owner or owner switchId field is null");
    }
    SwitchFrame ownerFrame = SwitchFrame.load(framedGraph(), SwitchIdConverter.INSTANCE.toGraphProperty(owner.getSwitchId())).orElseThrow(() -> new IllegalArgumentException(String.format("Unable to locate the switch %s", owner.getSwitchId())));
    Speaker speaker = data.getSpeaker();
    if (speaker == null || speaker.getName() == null) {
        throw new IllegalArgumentException("Speaker or speaker name is null");
    }
    SpeakerFrame speakerFrame = SpeakerFrame.load(framedGraph(), speaker.getName()).orElseThrow(() -> new IllegalArgumentException("Unable to locate speaker " + speaker.getName()));
    SwitchConnectFrame frame = KildaBaseEdgeFrame.addNewFramedEdge(framedGraph(), ownerFrame, speakerFrame, SwitchConnectFrame.FRAME_LABEL, SwitchConnectFrame.class);
    SwitchConnectCloner.INSTANCE.copyWithoutRelations(data, frame);
    return frame;
}
Also used : Switch(org.openkilda.model.Switch) SwitchConnectFrame(org.openkilda.persistence.ferma.frames.SwitchConnectFrame) SpeakerFrame(org.openkilda.persistence.ferma.frames.SpeakerFrame) SwitchFrame(org.openkilda.persistence.ferma.frames.SwitchFrame) Speaker(org.openkilda.model.Speaker)

Example 2 with SpeakerFrame

use of org.openkilda.persistence.ferma.frames.SpeakerFrame in project open-kilda by telstra.

the class FermaSpeakerRepository method doAdd.

@Override
protected SpeakerFrame doAdd(SpeakerData data) {
    SpeakerFrame frame = KildaBaseVertexFrame.addNewFramedVertex(framedGraph(), SpeakerFrame.FRAME_LABEL, SpeakerFrame.class);
    Speaker.SpeakerCloner.INSTANCE.copy(data, frame);
    return frame;
}
Also used : SpeakerFrame(org.openkilda.persistence.ferma.frames.SpeakerFrame)

Aggregations

SpeakerFrame (org.openkilda.persistence.ferma.frames.SpeakerFrame)2 Speaker (org.openkilda.model.Speaker)1 Switch (org.openkilda.model.Switch)1 SwitchConnectFrame (org.openkilda.persistence.ferma.frames.SwitchConnectFrame)1 SwitchFrame (org.openkilda.persistence.ferma.frames.SwitchFrame)1