Example usage for org.joda.time DateTime parse

List of usage examples for org.joda.time DateTime parse

Introduction

In this page you can find the example usage for org.joda.time DateTime parse.

Prototype

@FromString
public static DateTime parse(String str) 

Source Link

Document

Parses a DateTime from the specified string.

Usage

From source file:org.graylog2.restclient.models.alerts.Alert.java

License:Open Source License

public Alert(AlertSummaryResponse asr) {
    this.id = asr.id;
    this.streamId = asr.streamId;
    this.conditionId = asr.conditionId;
    this.triggeredAt = DateTime.parse(asr.triggeredAt);
    this.description = asr.description;
    this.conditionParameters = asr.conditionParameters;
}

From source file:org.graylog2.restclient.models.alerts.AlertCondition.java

License:Open Source License

@AssistedInject
private AlertCondition(UserService userService, @Assisted AlertConditionSummaryResponse acsr) {
    this.id = acsr.id;
    this.type = Type.valueOf(acsr.type.toUpperCase());
    this.parameters = acsr.parameters;
    this.inGrace = acsr.inGrace;
    this.createdAt = DateTime.parse(acsr.createdAt);
    this.creatorUser = userService.load(acsr.creatorUserId);
}

From source file:org.graylog2.restclient.models.api.responses.SearchResultResponse.java

License:Open Source License

public DateTime getFromDataTime() {
    return from != null ? DateTime.parse(from) : null;
}

From source file:org.graylog2.restclient.models.api.responses.SearchResultResponse.java

License:Open Source License

public DateTime getToDataTime() {
    return to != null ? DateTime.parse(to) : null;
}

From source file:org.graylog2.restclient.models.dashboards.Dashboard.java

License:Open Source License

@AssistedInject
private Dashboard(UserService userService, ApiClient api, @Assisted DashboardSummaryResponse dsr) {
    this.id = dsr.id;
    this.title = dsr.title;
    this.description = dsr.description;
    this.createdAt = DateTime.parse(dsr.createdAt);
    this.creatorUser = userService.load(dsr.creatorUserId);
    this.api = api;
    this.positions = dsr.positions == null ? new HashMap<String, WidgetPositionResponse>() : dsr.positions;
    this.widgets = parseWidgets(dsr.widgets);
    this.contentPack = dsr.contentPack;
}

From source file:org.graylog2.restclient.models.Input.java

License:Open Source License

@AssistedInject
private Input(ApiClient api, UniversalSearch.Factory searchFactory, UserService userService,
        FieldMapper fieldMapper, @Assisted InputSummaryResponse is, @Assisted ClusterEntity node) {
    this.api = api;
    this.searchFactory = searchFactory;
    this.fieldMapper = fieldMapper;
    this.node = node;
    this.type = is.type;
    this.id = is.inputId;
    this.persistId = is.persistId;
    this.name = is.name;
    this.title = is.title;
    this.global = is.global;
    this.creatorUser = userService.load(is.creatorUserId);
    this.attributes = is.attributes;
    this.staticFields = is.staticFields;
    this.createdAt = DateTime.parse(is.createdAt);
    this.contentPack = is.contentPack;

    // We might get a double parsed from JSON here. Make sure to round it to Integer. (would be .0 anyways)
    for (Map.Entry<String, Object> e : attributes.entrySet()) {
        if (e.getValue() instanceof Double) {
            attributes.put(e.getKey(), Math.round((Double) e.getValue()));
        }/*from ww  w  .  j  a v  a 2s  . c  o m*/
    }
}

From source file:org.graylog2.restclient.models.InputState.java

License:Open Source License

@AssistedInject
private InputState(ApiClient api, UniversalSearch.Factory searchFactory, Input.Factory inputFactory,
        UserService userService, @Assisted InputStateSummaryResponse issr, @Assisted ClusterEntity node) {
    this.api = api;
    this.searchFactory = searchFactory;
    this.inputFactory = inputFactory;
    this.userService = userService;
    this.node = node;

    this.id = issr.id;
    this.state = InputStateType.valueOf(issr.state.toUpperCase());
    this.startedAt = DateTime.parse(issr.startedAt);
    this.input = inputFactory.fromSummaryResponse(issr.messageinput, node);
    this.detailedMessage = issr.detailedMessage;
}

From source file:org.graylog2.restclient.models.Notification.java

License:Open Source License

public Notification(NotificationSummaryResponse x) {
    this.type = Type.valueOf(x.type.toUpperCase());
    this.timestamp = DateTime.parse(x.timestamp);
    this.severity = Severity.valueOf(x.severity.toUpperCase());
    this.nodeId = x.node_id;
    this.details = x.details;
}

From source file:org.graylog2.restclient.models.Stream.java

License:Open Source License

public DateTime getCreatedAt() {
    return DateTime.parse(createdAt);
}

From source file:org.graylog2.restclient.models.SystemJob.java

License:Open Source License

@AssistedInject
public SystemJob(NodeService nodeService, @Assisted SystemJobSummaryResponse s) {
    this.id = UUID.fromString(s.id);
    this.name = s.name;
    this.description = s.description;
    this.startedAt = DateTime.parse(s.startedAt);
    this.percentComplete = s.percentComplete;
    this.isCancelable = s.isCancelable;
    this.providesProgress = s.providesProgress;

    try {/*from w ww  .  j a va  2s  .c  om*/
        this.node = nodeService.loadNode(s.nodeId);
    } catch (NodeService.NodeNotFoundException e) {
        throw new RuntimeException(e);
    }
}