-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
901 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
144 changes: 144 additions & 0 deletions
144
accio-base/src/main/java/io/accio/base/dto/CumulativeMetric.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,144 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.accio.base.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import io.airlift.units.Duration; | ||
|
||
import java.util.Objects; | ||
|
||
public class CumulativeMetric | ||
implements PreAggregationInfo | ||
{ | ||
public static CumulativeMetric cumulativeMetric( | ||
String name, | ||
String baseModel, | ||
Measure measure, | ||
Window window) | ||
{ | ||
return new CumulativeMetric(name, baseModel, measure, window, false, null, null); | ||
} | ||
|
||
private final String name; | ||
private final String baseModel; | ||
private final Measure measure; | ||
private final Window window; | ||
private final boolean preAggregated; | ||
private final Duration refreshTime; | ||
private final String description; | ||
|
||
@JsonCreator | ||
public CumulativeMetric( | ||
@JsonProperty("name") String name, | ||
@JsonProperty("baseModel") String baseModel, | ||
@JsonProperty("measure") Measure measure, | ||
@JsonProperty("window") Window window, | ||
@JsonProperty("preAggregated") boolean preAggregated, | ||
@JsonProperty("refreshTime") Duration refreshTime, | ||
@JsonProperty("description") String description) | ||
{ | ||
this.name = name; | ||
this.baseModel = baseModel; | ||
this.measure = measure; | ||
this.window = window; | ||
this.preAggregated = preAggregated; | ||
this.refreshTime = refreshTime; | ||
this.description = description; | ||
} | ||
|
||
@JsonProperty | ||
public String getName() | ||
{ | ||
return name; | ||
} | ||
|
||
@JsonProperty | ||
public String getBaseModel() | ||
{ | ||
return baseModel; | ||
} | ||
|
||
@JsonProperty | ||
public Measure getMeasure() | ||
{ | ||
return measure; | ||
} | ||
|
||
@JsonProperty | ||
public Window getWindow() | ||
{ | ||
return window; | ||
} | ||
|
||
@JsonProperty | ||
public boolean isPreAggregated() | ||
{ | ||
return preAggregated; | ||
} | ||
|
||
@JsonProperty | ||
public Duration getRefreshTime() | ||
{ | ||
return refreshTime; | ||
} | ||
|
||
@JsonProperty | ||
public String getDescription() | ||
{ | ||
return description; | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return Objects.hash(name, baseModel, measure, window, preAggregated, refreshTime, description); | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) | ||
{ | ||
if (this == o) { | ||
return true; | ||
} | ||
|
||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
|
||
CumulativeMetric that = (CumulativeMetric) o; | ||
return preAggregated == that.preAggregated && | ||
Objects.equals(name, that.name) && | ||
Objects.equals(baseModel, that.baseModel) && | ||
Objects.equals(measure, that.measure) && | ||
Objects.equals(window, that.window) && | ||
Objects.equals(refreshTime, that.refreshTime) && | ||
Objects.equals(description, that.description); | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "CumulativeMetric{" + | ||
"name='" + name + '\'' + | ||
", baseModel='" + baseModel + '\'' + | ||
", measure=" + measure + | ||
", window=" + window + | ||
", preAggregated=" + preAggregated + | ||
", refreshTime=" + refreshTime + | ||
", description='" + description + '\'' + | ||
'}'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
/* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package io.accio.base.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonCreator; | ||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
|
||
import java.util.Objects; | ||
|
||
public class DateSpine | ||
{ | ||
public static final DateSpine DEFAULT = new DateSpine(TimeUnit.DAY, "1970-01-01", "2077-12-31"); | ||
|
||
private final TimeUnit unit; | ||
private final String start; | ||
private final String end; | ||
|
||
@JsonCreator | ||
public DateSpine( | ||
@JsonProperty("unit") TimeUnit unit, | ||
@JsonProperty("start") String start, | ||
@JsonProperty("end") String end) | ||
{ | ||
this.unit = unit; | ||
this.start = start; | ||
this.end = end; | ||
} | ||
|
||
@JsonProperty | ||
public TimeUnit getUnit() | ||
{ | ||
return unit; | ||
} | ||
|
||
@JsonProperty | ||
public String getStart() | ||
{ | ||
return start; | ||
} | ||
|
||
@JsonProperty | ||
public String getEnd() | ||
{ | ||
return end; | ||
} | ||
|
||
@Override | ||
public String toString() | ||
{ | ||
return "DateSpine{" + | ||
"unit=" + unit + | ||
", start='" + start + '\'' + | ||
", end='" + end + '\'' + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) | ||
{ | ||
if (this == o) { | ||
return true; | ||
} | ||
if (o == null || getClass() != o.getClass()) { | ||
return false; | ||
} | ||
DateSpine dateSpine = (DateSpine) o; | ||
return unit == dateSpine.unit && | ||
Objects.equals(start, dateSpine.start) && | ||
Objects.equals(end, dateSpine.end); | ||
} | ||
|
||
@Override | ||
public int hashCode() | ||
{ | ||
return Objects.hash(unit, start, end); | ||
} | ||
} |
Oops, something went wrong.