use of org.yamcs.studio.core.model.ArchiveCatalogue in project yamcs-studio by yamcs.
the class ArchiveIndexReceiver method updateTag.
public void updateTag(ArchiveTag oldTag, ArchiveTag newTag) {
EditTagRequest.Builder requestb = EditTagRequest.newBuilder();
if (newTag.hasName())
requestb.setName(newTag.getName());
if (newTag.hasColor())
requestb.setColor(newTag.getColor());
if (newTag.hasDescription())
requestb.setDescription(newTag.getDescription());
if (newTag.hasStart())
requestb.setStart(TimeEncoding.toString(newTag.getStart()));
if (newTag.hasStop())
requestb.setStop(TimeEncoding.toString(newTag.getStop()));
long tagTime = oldTag.hasStart() ? oldTag.getStart() : 0;
int tagId = oldTag.getId();
ArchiveCatalogue catalogue = ArchiveCatalogue.getInstance();
catalogue.editTag(tagTime, tagId, requestb.build()).thenRun(() -> {
archiveView.tagChanged(oldTag, newTag);
});
}
use of org.yamcs.studio.core.model.ArchiveCatalogue in project yamcs-studio by yamcs.
the class ArchiveIndexReceiver method createTag.
public void createTag(ArchiveTag tag) {
CreateTagRequest.Builder requestb = CreateTagRequest.newBuilder();
if (tag.hasName())
requestb.setName(tag.getName());
if (tag.hasColor())
requestb.setColor(tag.getColor());
if (tag.hasDescription())
requestb.setDescription(tag.getDescription());
if (tag.hasStart())
requestb.setStart(TimeEncoding.toString(tag.getStart()));
if (tag.hasStop())
requestb.setStop(TimeEncoding.toString(tag.getStop()));
ArchiveCatalogue catalogue = ArchiveCatalogue.getInstance();
catalogue.createTag(requestb.build()).whenComplete((data, exc) -> {
if (exc != null) {
ArchiveTag response;
try {
response = ArchiveTag.parseFrom(data);
archiveView.tagAdded(response);
} catch (InvalidProtocolBufferException e) {
log.log(Level.SEVERE, "Failed to decode server message", e);
}
}
});
}
Aggregations