http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqMetricsValue.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqMetricsValue.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqMetricsValue.java deleted file mode 100644 index 5b9aac2..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqMetricsValue.java +++ /dev/null @@ -1,111 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - - -import javax.validation.constraints.Min; -import javax.validation.constraints.NotNull; -import javax.validation.constraints.Pattern; - -import com.ebay.oss.griffin.vo.BaseObj; -import com.google.code.morphia.annotations.Id; - - -/** - * Metrics is the value of a DQ perspective (DqModel) execution/calculation. - * - * TODO: should introduce UnitOfMeasure in, so that a Metrics could be render independently. - */ -// uniq{modelName, timestamp} -public class DqMetricsValue extends BaseObj implements Comparable<DqMetricsValue> { - - @Id - private Long _id; - - // model.name - @NotNull - @Pattern(regexp="\\A([0-9a-zA-Z\\_\\-\\.])+$") - private String metricName; - - private String assetId; - - @Min(0) - private long timestamp; - - @Min(0) - private float value; - - public DqMetricsValue() { } - - public DqMetricsValue(String name, long timestamp, float value) { - this.metricName = name; - this.timestamp = timestamp; - this.value = value; - } - - public Long get_id() { - return _id; - } - - public void set_id(Long _id) { - this._id = _id; - } - - public String getMetricName() { - return metricName; - } - - public void setMetricName(String metricName) { - this.metricName = metricName; - } - - public String getAssetId() { - return assetId; - } - - public void setAssetId(String assetId) { - this.assetId = assetId; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public float getValue() { - return value; - } - - public void setValue(float value) { - this.value = value; - } - - @Override - public int compareTo(DqMetricsValue o) { - return (int) Math.signum(o.getTimestamp() - this.getTimestamp()); -// return o.getTimestamp() == this.getTimestamp() ? 0 : -// (o.getTimestamp() > this.getTimestamp() ? 1 : -1); - } - - @Override - public String toString() { - return "DqMetricsValue [_id=" + _id + ", metricName=" + metricName + ", timestamp=" - + timestamp + ", value=" + value + "]"; - } - -} \ No newline at end of file
http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqModel.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqModel.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqModel.java deleted file mode 100644 index 5347af7..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqModel.java +++ /dev/null @@ -1,231 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -import com.google.code.morphia.annotations.Entity; -import com.google.code.morphia.annotations.Property; - -/** - * It is a specification of Data Quality perspective, which defines: - * <ol> - * <li> what data against, DataAsset(s) </li> - * <li> which type of DQ, ModelType </li> - * <li> related meta data based on the concrete modelType, modelContent </li> - * </ul> - */ -@Entity("dq_model") -public class DqModel extends IdEntity{ - - // same as modelName - @Property("modelId") - private String modelId; - - @Property("modelName") - private String modelName; - - @Property("modelType") - private int modelType; - - @Property("modelDesc") - private String modelDesc; - - @Property("assetId") - private long assetId; - - @Property("assetName") - private String assetName; - - @Property("threshold") - private float threshold; - - @Property("notificationEmail") - private String notificationEmail; - - @Property("owner") - private String owner; - - @Property("status") - private int status; - - // @see ScheduleType - @Property("schedule") - private int schedule; - - /** - * <ul> - * <li>ModelType.ACCURACY</li> - * <pre> - * srcDb | srcDataSet | dstDB | dstDataSet | [MappingItemInput.src, MII.dst, MII.isPk, MII.matchedMethod]; - * </pre> - * <li>ModelType.VALIDITY</li> - * <pre> srcDb | srcDataSet | validityType | column </pre> - * <li>ModelType.Anomaly</li> - * <pre> srcDb | srcDataSet | anomalType </pre> - * <li>ModelType.Publish</li> - * <pre> publishUrl </pre> - */ - // FIXME should model this explicitly, ASAP. - @Property("modelContent") - private String modelContent; - - // @See SystemType - @Property("system") - private int system; - - /** - * for a AnormalyDetection model need a reference model, say a count_model. So a count mound will - * hold a reference to Anomaly model. - */ - @Property("referenceModel") - private String referenceModel; - - @Property("timestamp") - private long timestamp; - - @Property("starttime") - private long starttime; - - public String getModelId() { - return modelId; - } - - public void setModelId(String modelId) { - this.modelId = modelId; - } - - public String getModelName() { - return modelName; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public int getModelType() { - return modelType; - } - - public void setModelType(int modelType) { - this.modelType = modelType; - } - - public String getModelDesc() { - return modelDesc; - } - - public void setModelDesc(String modelDesc) { - this.modelDesc = modelDesc; - } - - public long getAssetId() { - return assetId; - } - - public void setAssetId(long assetId) { - this.assetId = assetId; - } - - public float getThreshold() { - return threshold; - } - - public void setThreshold(float threshold) { - this.threshold = threshold; - } - - public String getNotificationEmail() { - return notificationEmail; - } - - public void setNotificationEmail(String notificationEmail) { - this.notificationEmail = notificationEmail; - } - - public String getOwner() { - return owner; - } - - public void setOwner(String owner) { - this.owner = owner; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public String getModelContent() { - return modelContent; - } - - public void setModelContent(String modelContent) { - this.modelContent = modelContent; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - - public int getSchedule() { - return schedule; - } - - public void setSchedule(int schedule) { - this.schedule = schedule; - } - - public int getSystem() { - return system; - } - - public void setSystem(int system) { - this.system = system; - } - - public String getAssetName() { - return assetName; - } - - public void setAssetName(String assetName) { - this.assetName = assetName; - } - - public String getReferenceModel() { - return referenceModel; - } - - public void setReferenceModel(String referenceModel) { - this.referenceModel = referenceModel; - } - - public long getStarttime() { - return starttime; - } - - public void setStarttime(long starttime) { - this.starttime = starttime; - } - - - - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqSchedule.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqSchedule.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqSchedule.java deleted file mode 100644 index 5ead6f1..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/DqSchedule.java +++ /dev/null @@ -1,123 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -import com.google.code.morphia.annotations.Property; - -/** - * This is a representation of model execution(s) schedule. <p/> - * - * A DqSchedule has muliple DqJob, based on the ScheduleType. - * - * A DqModel defines what DQ should be calculated, there - * will be a corresponding algo model (defined in bark-models) describing how to calculate. - * - * @see DqJob - * @see ScheduleType - */ -public class DqSchedule extends IdEntity { - - /** a list of modelName, seprated by ScheduleModelSeperator.SEPERATOR. - * if ModelType.VALIDITY, there will be multiple model included, or only one model. - */ - @Property("modelList") - private String modelList; - - @Property("assetId") - private long assetId; - - /** Inherits from DqModel.modelType. In case of modelList has more models, they should share a - * same modelType, specifically the VALIDITY. - * - * @see ModelType - * */ - @Property("jobType") - private int jobType; - - // @see ScheduleType - @Property("scheduleType") - private int scheduleType; - - /** @see JobStatus */ - @Property("status") - private int status; - - @Property("starttime") - private long starttime; - - @Property("content") - private String content; - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public long getStarttime() { - return starttime; - } - - public void setStarttime(long starttime) { - this.starttime = starttime; - } - - public String getContent() { - return content; - } - - public void setContent(String content) { - this.content = content; - } - - public int getScheduleType() { - return scheduleType; - } - - public void setScheduleType(int scheduleType) { - this.scheduleType = scheduleType; - } - - public String getModelList() { - return modelList; - } - - public void setModelList(String modelList) { - this.modelList = modelList; - } - - public long getAssetId() { - return assetId; - } - - public void setAssetId(long assetId) { - this.assetId = assetId; - } - - public int getJobType() { - return jobType; - } - - public void setJobType(int jobType) { - this.jobType = jobType; - } - - - - - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/IdEntity.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/IdEntity.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/IdEntity.java deleted file mode 100644 index e42b5ad..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/IdEntity.java +++ /dev/null @@ -1,28 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -import com.google.code.morphia.annotations.Id; - -public class IdEntity { - - @Id - private Long _id; // table id primary key - - public Long get_id() { return _id; } - - public void set_id(Long _id) { this._id = _id; } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/JobStatus.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/JobStatus.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/JobStatus.java deleted file mode 100644 index 1bc1c9d..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/JobStatus.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -public class JobStatus { - - public static final int READY = 0; - public static final int WAITING = 1; - public static final int STARTED = 2; - public static final int FINISHED = 3; - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/MetricType.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/MetricType.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/MetricType.java deleted file mode 100644 index 78b0691..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/MetricType.java +++ /dev/null @@ -1,25 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -/** conceptually same as AnomalyType, should be unified. - * @see AnomalType - */ -public enum MetricType { - NORMAL, - Bollinger, - Trend, - MAD -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ModelStatus.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ModelStatus.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ModelStatus.java deleted file mode 100644 index 4f83251..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ModelStatus.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -public class ModelStatus { - - public static final int TESTING = 0; - public static final int VERIFIED = 1; - public static final int DEPLOYED = 2; - - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ModelType.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ModelType.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ModelType.java deleted file mode 100644 index 12c32a9..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ModelType.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -public class ModelType { - - public static final int ACCURACY = 0; - public static final int VALIDITY = 1; - public static final int ANOMALY = 2; - public static final int PUBLISH = 3; - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/PartitionFormat.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/PartitionFormat.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/PartitionFormat.java deleted file mode 100644 index 27fa1fe..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/PartitionFormat.java +++ /dev/null @@ -1,59 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -import com.google.code.morphia.annotations.Embedded; -import com.google.code.morphia.annotations.Property; - -/** - * In some cases, such as tera-data or hive, partition is used to distribute the data in different - * storage(file). This is an abstract of naming pattern of partition. - */ -@Embedded -public class PartitionFormat { - - @Property("name") - private String name; - - @Property("format") - private String format; - - public PartitionFormat() { - } - - public PartitionFormat(String name, String format) { - this.name = name; - this.format = format; - } - - public String getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } - - public String getFormat() { - return format; - } - - public void setFormat(String format) { - this.format = format; - } - - - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/SampleFilePathLKP.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/SampleFilePathLKP.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/SampleFilePathLKP.java deleted file mode 100644 index ee7a214..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/SampleFilePathLKP.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (c) 2016 eBay Software Foundation. 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 com.ebay.oss.griffin.domain; - -import com.google.code.morphia.annotations.Entity; -import com.google.code.morphia.annotations.Property; - -/** - * In Accuracy DQ, the mismatched data is actually stored to file. <p/> - * - * Each of this has a corresponding DqMetricsValue, by {modelName, timestamp} - */ -// uniq{model, timestamp} -@Entity("dq_missed_file_path_lkp") -public class SampleFilePathLKP extends IdEntity { - - @Property("modelName") - private String modelName; - - @Property("hdfsPath") - private String hdfsPath; - - @Property("timestamp") - private long timestamp; - - public String getModelName() { - return modelName; - } - - public void setModelName(String modelName) { - this.modelName = modelName; - } - - public String getHdfsPath() { - return hdfsPath; - } - - public void setHdfsPath(String hdfsPath) { - this.hdfsPath = hdfsPath; - } - - public long getTimestamp() { - return timestamp; - } - - public void setTimestamp(long timestamp) { - this.timestamp = timestamp; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ScheduleType.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ScheduleType.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ScheduleType.java deleted file mode 100644 index dc3c2f7..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ScheduleType.java +++ /dev/null @@ -1,24 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -public class ScheduleType { - - public static final int DAILY = 0; - public static final int WEEKLY = 1; - public static final int MONTHLY = 2; - public static final int HOURLY = 3; - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/SystemType.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/SystemType.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/SystemType.java deleted file mode 100644 index 20f322b..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/SystemType.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - - -/** - * A system is actually an application (or sth else, like data container), managing data which - * involved the data quality. A System could be considered a set of DataAssets. - * <p/> - * here lists the different type of bark involved System. - */ -public class SystemType { - - public static final int BULLSEYE = 0; - public static final int GPS = 1; - public static final int HADOOP = 2; - public static final int PDS = 3; - public static final int IDLS = 4; - public static final int PULSAR = 5; - public static final int KAFKA = 6; - public static final int SOJOURNER= 7; - public static final int SITESPEED = 8; - public static final int EDW = 9; - -// private final int value; -// -// private final String desc; -// -// public SystemType(int value, String desc) { -// super(); -// this.value = value; -// this.desc = desc; -// } - - private static final String[] array = {"Bullseye", "GPS", "Hadoop", "PDS", "IDLS", "Pulsar", "Kafka", "Sojourner", "SiteSpeed", "EDW"}; - - public static String val(int type){ - if(type < array.length && type >=0){ - return array[type]; - }else{ - return type + ""; - } - - - } - - public static int indexOf(String desc){ - for(int i = 0;i < array.length; i ++){ - if(array[i].equals(desc)){ - return i; - } - } - - return -1; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/UserSubscription.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/UserSubscription.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/UserSubscription.java deleted file mode 100644 index 192ce8c..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/UserSubscription.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -import java.util.List; - -import com.ebay.oss.griffin.vo.PlatformSubscription; -import com.ebay.oss.griffin.vo.SystemSubscription; - -/** - * User could define the model/metrics by subscribe the DataAssets. - */ -// FIXME uid+List<asset> is enough, group by platform/system is just a rendering issue, which should -// not impact the model design. -public class UserSubscription { - // same as ntaccount? - String _id; - - String ntaccount; - - List<PlatformSubscription> subscribes; - - public UserSubscription() { } - - public UserSubscription(String user) { - ntaccount = user; - } - - public String getId() { - return _id; - } - - public void setId(String _id) { - this._id = _id; - } - - public String getNtaccount() { - return ntaccount; - } - - public void setNtaccount(String ntaccount) { - this.ntaccount = ntaccount; - } - - public List<PlatformSubscription> getSubscribes() { - return subscribes; - } - - public void setSubscribes(List<PlatformSubscription> subscribes) { - this.subscribes = subscribes; - } - - public boolean isPlatformSelected(String platform) { - for(PlatformSubscription item : subscribes) { - if(item.getPlatform().equals(platform) && item.isSelectAll()) { - return true; - } - } - return false; - } - - public boolean isSystemSelected(String platform, String system) { - for(PlatformSubscription item : subscribes) { - if(item.getPlatform().equals(platform)) { - for(SystemSubscription eachSystem : item.getSystems()) { - if(eachSystem.getSystem().equals(system) && eachSystem.isSelectAll()) { - return true; - } - } - } - } - return false; - } - - public boolean isDataAssetSelected(String platform, String system, String dataasset) { - for(PlatformSubscription item : subscribes) { - if(item.getPlatform().equals(platform)) { - for(SystemSubscription eachSystem : item.getSystems()) { - if(eachSystem.getSystem().equals(system) - && eachSystem.getDataassets().contains(dataasset)) { - return true; - } - } - } - } - return false; - } - -} \ No newline at end of file http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ValidityType.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ValidityType.java b/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ValidityType.java deleted file mode 100644 index f834579..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/domain/ValidityType.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.domain; - -/** the type of Validity model */ -public class ValidityType { - public static final int DEFAULT_COUNT = 0; - public static final int TOTAL_COUNT = 1; - public static final int NULL_COUNT = 2; - public static final int UNIQUE_COUNT = 3; - public static final int DUPLICATE_COUNT = 4; - public static final int MAXIMUM = 5; - public static final int MINIMUM = 6; - public static final int MEAN = 7; - public static final int MEDIAN = 8; - public static final int REGULAR_EXPRESSION_MATCHING = 9; - public static final int PATTERN_FREQUENCY = 10; - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkDbOperationException.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkDbOperationException.java b/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkDbOperationException.java deleted file mode 100644 index 88d88f2..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkDbOperationException.java +++ /dev/null @@ -1,105 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.error; - - - -public class BarkDbOperationException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = 2137866000039215687L; - - - /** - * Constructs a new exception with {@code null} as its detail message. - * The cause is not initialized, and may subsequently be initialized by a - * call to {@link #initCause}. - */ - public BarkDbOperationException() { - super(); - } - - - - /** - * Constructs a new exception with the specified detail message. The - * cause is not initialized, and may subsequently be initialized by - * a call to {@link #initCause}. - * - * @param message the detail message. The detail message is saved for - * later retrieval by the {@link #getMessage()} method. - */ - public BarkDbOperationException(String message) { - super(message); - } - - /** - * Constructs a new exception with the specified detail message and - * cause. <p>Note that the detail message associated with - * {@code cause} is <i>not</i> automatically incorporated in - * this exception's detail message. - * - * @param message the detail message (which is saved for later retrieval - * by the {@link #getMessage()} method). - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A <tt>null</tt> value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.4 - */ - public BarkDbOperationException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Constructs a new exception with the specified cause and a detail - * message of <tt>(cause==null ? null : cause.toString())</tt> (which - * typically contains the class and detail message of <tt>cause</tt>). - * This constructor is useful for exceptions that are little more than - * wrappers for other throwables (for example, {@link - * java.security.PrivilegedActionException}). - * - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A <tt>null</tt> value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.4 - */ - public BarkDbOperationException(Throwable cause) { - super(cause); - } - - /** - * Constructs a new exception with the specified detail message, - * cause, suppression enabled or disabled, and writable stack - * trace enabled or disabled. - * - * @param message the detail message. - * @param cause the cause. (A {@code null} value is permitted, - * and indicates that the cause is nonexistent or unknown.) - * @param enableSuppression whether or not suppression is enabled - * or disabled - * @param writableStackTrace whether or not the stack trace should - * be writable - * @since 1.7 - */ - protected BarkDbOperationException(String message, Throwable cause, - boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkWebException.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkWebException.java b/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkWebException.java deleted file mode 100644 index 7bba6f5..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkWebException.java +++ /dev/null @@ -1,136 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.error; - - - -public class BarkWebException extends RuntimeException { - - /** - * - */ - private static final long serialVersionUID = -4108849854769426970L; - - - private int status; - - private ErrorMessage err; - - public ErrorMessage getErr() { - return err; - } - - public void setErr(ErrorMessage err) { - this.err = err; - } - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - /** - * Constructs a new exception with {@code null} as its detail message. - * The cause is not initialized, and may subsequently be initialized by a - * call to {@link #initCause}. - */ - public BarkWebException() { - super(); - } - - public BarkWebException(int status, String message) { - super(message); - this.status = status; - - } - - public BarkWebException(int status, Throwable cause) { - super(cause); - this.status = status; - - } - - - /** - * Constructs a new exception with the specified detail message. The - * cause is not initialized, and may subsequently be initialized by - * a call to {@link #initCause}. - * - * @param message the detail message. The detail message is saved for - * later retrieval by the {@link #getMessage()} method. - */ - public BarkWebException(String message) { - super(message); - } - - /** - * Constructs a new exception with the specified detail message and - * cause. <p>Note that the detail message associated with - * {@code cause} is <i>not</i> automatically incorporated in - * this exception's detail message. - * - * @param message the detail message (which is saved for later retrieval - * by the {@link #getMessage()} method). - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A <tt>null</tt> value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.4 - */ - public BarkWebException(String message, Throwable cause) { - super(message, cause); - } - - /** - * Constructs a new exception with the specified cause and a detail - * message of <tt>(cause==null ? null : cause.toString())</tt> (which - * typically contains the class and detail message of <tt>cause</tt>). - * This constructor is useful for exceptions that are little more than - * wrappers for other throwables (for example, {@link - * java.security.PrivilegedActionException}). - * - * @param cause the cause (which is saved for later retrieval by the - * {@link #getCause()} method). (A <tt>null</tt> value is - * permitted, and indicates that the cause is nonexistent or - * unknown.) - * @since 1.4 - */ - public BarkWebException(Throwable cause) { - super(cause); - } - - /** - * Constructs a new exception with the specified detail message, - * cause, suppression enabled or disabled, and writable stack - * trace enabled or disabled. - * - * @param message the detail message. - * @param cause the cause. (A {@code null} value is permitted, - * and indicates that the cause is nonexistent or unknown.) - * @param enableSuppression whether or not suppression is enabled - * or disabled - * @param writableStackTrace whether or not the stack trace should - * be writable - * @since 1.7 - */ - protected BarkWebException(String message, Throwable cause, - boolean enableSuppression, - boolean writableStackTrace) { - super(message, cause, enableSuppression, writableStackTrace); - } -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkWebExceptionMapper.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkWebExceptionMapper.java b/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkWebExceptionMapper.java deleted file mode 100644 index a3a0595..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/error/BarkWebExceptionMapper.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.error; - -import javax.ws.rs.core.MediaType; -import javax.ws.rs.core.Response; -import javax.ws.rs.ext.ExceptionMapper; -import javax.ws.rs.ext.Provider; - -import org.springframework.stereotype.Component; - -@Provider -@Component -public class BarkWebExceptionMapper implements -ExceptionMapper<BarkWebException> { - - @Override - public Response toResponse(BarkWebException ex) { - int status = ex.getStatus(); - if (status == 0) { - status = 500; - } - - return Response.status(status) - .entity(new ErrorMessage(status, ex.getMessage())) - .type(MediaType.APPLICATION_JSON) // this has to be set to get - // the generated JSON - .build(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/error/ErrorMessage.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/error/ErrorMessage.java b/griffin-core/src/main/java/com/ebay/oss/griffin/error/ErrorMessage.java deleted file mode 100644 index 3f633f0..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/error/ErrorMessage.java +++ /dev/null @@ -1,101 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.error; - -import javax.ws.rs.core.Response; -import javax.xml.bind.annotation.XmlElement; -import javax.xml.bind.annotation.XmlRootElement; - -@XmlRootElement -public class ErrorMessage { - /** contains the same HTTP Status code returned by the server */ - @XmlElement(name = "status") - int status; - - /** application specific error code */ - @XmlElement(name = "code") - int code; - - /** message describing the error */ - @XmlElement(name = "message") - String message; - - /** link point to page where the error message is documented */ - @XmlElement(name = "link") - String link; - - /** extra information that might useful for developers */ - @XmlElement(name = "developerMessage") - String developerMessage; - - public int getStatus() { - return status; - } - - public void setStatus(int status) { - this.status = status; - } - - public int getCode() { - return code; - } - - public void setCode(int code) { - this.code = code; - } - - public String getMessage() { - return message; - } - - public void setMessage(String message) { - this.message = message; - } - - public String getDeveloperMessage() { - return developerMessage; - } - - public void setDeveloperMessage(String developerMessage) { - this.developerMessage = developerMessage; - } - - public String getLink() { - return link; - } - - public void setLink(String link) { - this.link = link; - } - - public ErrorMessage(Throwable ex) { - this.status = Response.Status.INTERNAL_SERVER_ERROR.getStatusCode(); - this.message = ex.getMessage(); - - } - - public ErrorMessage() { - } - - public ErrorMessage(String msg) { - this.message = msg; - } - - public ErrorMessage(int status, String msg) { - this.status = status; - this.message = msg; - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BarkIdRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BarkIdRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BarkIdRepo.java deleted file mode 100644 index 2a3c7df..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BarkIdRepo.java +++ /dev/null @@ -1,11 +0,0 @@ -package com.ebay.oss.griffin.repo; - -public interface BarkIdRepo<T> extends BarkRepo<T> { - - Long getNextId(); - - T getById(Long id); - - void delete(Long id); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BarkRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BarkRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BarkRepo.java deleted file mode 100644 index c003e84..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BarkRepo.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.util.List; - -import com.ebay.oss.griffin.common.Pair; -import com.mongodb.DBObject; - -public interface BarkRepo<T> { - - List<T> getAll(); - - DBObject getByCondition(List<Pair> queryList); - - void save(T t); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BaseIdRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BaseIdRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BaseIdRepo.java deleted file mode 100644 index c6f8b53..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BaseIdRepo.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import org.springframework.beans.factory.annotation.Autowired; - -import com.mongodb.BasicDBObject; -import com.mongodb.DBObject; - -public abstract class BaseIdRepo<T> extends BaseRepo<T> implements BarkIdRepo<T> { - - @Autowired - private SequenceRepo seqRepo; - - private final String idKey; - - protected BaseIdRepo(String collectionName, String idKey, Class<T> clz) { - super(collectionName, clz); - this.idKey = idKey; - } - - @Override - synchronized final public T getById(Long id) { - DBObject o = dbCollection.findOne(new BasicDBObject("_id", id)); - return o != null ? toEntity(o) : null; - } - - @Override - final public void delete(Long id) { - DBObject temp = dbCollection.findOne(new BasicDBObject("_id", id)); - if (temp != null) { - dbCollection.remove(temp); - } - } - - @Override - final public Long getNextId() { - return seqRepo.getNextSequence(idKey); - } -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BaseRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BaseRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BaseRepo.java deleted file mode 100644 index 0d34d78..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/BaseRepo.java +++ /dev/null @@ -1,95 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.io.IOException; -import java.util.LinkedList; -import java.util.List; -import java.util.Properties; - -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.ebay.oss.griffin.common.Pair; -import com.google.gson.Gson; -import com.mongodb.BasicDBObject; -import com.mongodb.DB; -import com.mongodb.DBCollection; -import com.mongodb.DBObject; -import com.mongodb.MongoClient; -import com.mongodb.util.JSON; - -public abstract class BaseRepo<T> implements BarkRepo<T> { - - protected static Logger logger = LoggerFactory.getLogger(BaseRepo.class); - - protected final DBCollection dbCollection; - - private final Class<T> clz; - - protected BaseRepo(String collectionName, Class<T> clz) throws RuntimeException { - this.clz = clz; - Properties env = new Properties(); - try { - env.load(Thread.currentThread().getContextClassLoader() - .getResourceAsStream("application.properties")); - String mongoServer = env.getProperty("spring.data.mongodb.host"); - int mongoPort = Integer.parseInt(env - .getProperty("spring.data.mongodb.port")); - - DB db = new MongoClient(mongoServer, mongoPort).getDB("unitdb0"); - - dbCollection = db.getCollection(collectionName); - - } catch (IOException e) { - throw new RuntimeException(e); - } - - } - - @Override - final public List<T> getAll() { - List<T> result = new LinkedList<T>(); - for(DBObject dbo : dbCollection.find()) { - result.add(toEntity(dbo)); - } - return result; - - } - - protected T toEntity(DBObject dbo) { - Gson gson = new Gson(); - return gson.fromJson(dbo.toString(), clz); - } - - @Override - final public void save(T t) { - Gson gson = new Gson(); - DBObject t1 = (DBObject) JSON.parse(gson.toJson(t)); - dbCollection.save(t1); - } - - @Override - final public DBObject getByCondition(List<Pair> queryList) { - BasicDBObject query = new BasicDBObject(); - for (Pair k : queryList) { - query.put(k.key, k.value); - } - - return dbCollection.findOne(query); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DataAssetRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DataAssetRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DataAssetRepo.java deleted file mode 100644 index d3003d5..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DataAssetRepo.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import com.ebay.oss.griffin.domain.DataAsset; -import com.mongodb.DBObject; - -public interface DataAssetRepo extends BarkIdRepo<DataAsset> { - - // FIXME why DBO here, how save & update - void update(DataAsset asset, DBObject dbo); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DataAssetRepoImpl.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DataAssetRepoImpl.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DataAssetRepoImpl.java deleted file mode 100644 index dde275c..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DataAssetRepoImpl.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import org.springframework.stereotype.Repository; - -import com.ebay.oss.griffin.domain.DataAsset; -import com.google.gson.Gson; -import com.mongodb.DBObject; -import com.mongodb.util.JSON; - -@Repository -public class DataAssetRepoImpl extends BaseIdRepo<DataAsset> implements DataAssetRepo { - - public DataAssetRepoImpl() { - super("data_assets", "DQ_DATA_ASSET_SEQ_NO", DataAsset.class); - } - - @Override - public void update(DataAsset entity, DBObject old) { - Gson gson = new Gson(); - // DBObject t1 = gson.fromJson(gson.toJson(entity), - // BasicDBObject.class); - DBObject t1 = (DBObject) JSON.parse(gson.toJson(entity)); - dbCollection.remove(old); - dbCollection.save(t1); - } - - @Override - protected DataAsset toEntity(DBObject o) { - return new DataAsset(o); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqJobRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqJobRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqJobRepo.java deleted file mode 100644 index 837cbd1..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqJobRepo.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.util.List; - -import com.ebay.oss.griffin.domain.DqJob; - -public interface DqJobRepo extends BarkRepo<DqJob> { - - int newJob(DqJob job); - - void update(DqJob DqJob); - - /** return null if not found. */ - DqJob getById(String jobID); - - List<DqJob> getByStatus(int ready); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqJobRepoImpl.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqJobRepoImpl.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqJobRepoImpl.java deleted file mode 100644 index 2900dff..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqJobRepoImpl.java +++ /dev/null @@ -1,102 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -import com.ebay.oss.griffin.common.NumberUtils; -import com.ebay.oss.griffin.domain.DqJob; -import com.google.gson.Gson; -import com.mongodb.BasicDBObject; -import com.mongodb.DBObject; -import com.mongodb.util.JSON; - -// FIXME why DqJob use a string id -@Repository -public class DqJobRepoImpl extends BaseRepo<DqJob> implements DqJobRepo { - - public DqJobRepoImpl() { - super("dq_job", DqJob.class); - } - - @Override - public void update(DqJob job) { - DBObject dbo = dboOf(job); - if (dbo != null) - dbCollection.remove(dbo); - - save(job); - } - - DBObject dboOf(DqJob job) { - return dbCollection.findOne(new BasicDBObject("_id", job.getId())); - } - @Override - public int newJob(DqJob job) { - try { - DBObject temp = dboOf(job); - if (temp != null) - return 0; - Gson gson = new Gson(); - DBObject t1 = (DBObject) JSON.parse(gson.toJson(job)); - dbCollection.save(t1); - return 1; - } catch (Exception e) { - logger.warn("===========insert new job error===============" - + e.getMessage()); - return 0; - } - } - - @Override - public DqJob getById(String jobId) { - DBObject dbo = dbCollection.findOne(new BasicDBObject("_id", jobId)); - if (dbo == null) { - return null; - } - return toEntity(dbo); - } - - @Override - protected DqJob toEntity(DBObject o) { - DqJob entity = new DqJob(); - entity.setId((String)o.get("_id")); - entity.setModelList((String)o.get("modelList")); - entity.setJobType(NumberUtils.parseInt( o.get("jobType"))); - entity.setStatus(NumberUtils.parseInt( o.get("status"))); - entity.setStarttime(NumberUtils.parseLong(o.get("starttime"))); - entity.setContent((String) o.get("content")); - entity.setEndtime(NumberUtils.parseLong( o.get("endtime"))); - entity.setValue(NumberUtils.parseLong(o.get("value"))); - - return entity; - } - - @Override - public List<DqJob> getByStatus(int status) { - List<DqJob> list = new ArrayList<>(); - - List<DBObject> dboList = dbCollection.find(new BasicDBObject("status", status)).toArray(); - for (DBObject dbo : dboList) { - list.add(toEntity(dbo)); - } - - return list; - } -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqMetricsRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqMetricsRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqMetricsRepo.java deleted file mode 100644 index 829824d..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqMetricsRepo.java +++ /dev/null @@ -1,31 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.util.List; - -import com.ebay.oss.griffin.domain.DqMetricsValue; -import com.mongodb.DBObject; - -public interface DqMetricsRepo extends BarkIdRepo<DqMetricsValue> { - - List<DqMetricsValue> getByMetricsName(String modelName); - - void update(DqMetricsValue metrics, DBObject item); - - DqMetricsValue getLatestByAssetId(String assetId); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqMetricsRepoImpl.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqMetricsRepoImpl.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqMetricsRepoImpl.java deleted file mode 100644 index 9baba2a..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqMetricsRepoImpl.java +++ /dev/null @@ -1,85 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.util.ArrayList; -import java.util.List; - -import org.springframework.stereotype.Repository; - -import com.ebay.oss.griffin.domain.DqMetricsValue; -import com.google.gson.Gson; -import com.mongodb.BasicDBObject; -import com.mongodb.DBCursor; -import com.mongodb.DBObject; -import com.mongodb.util.JSON; - -@Repository -public class DqMetricsRepoImpl extends BaseIdRepo<DqMetricsValue> implements DqMetricsRepo { - - public DqMetricsRepoImpl() { - super("dq_metrics_values", "DQ_METRICS_SEQ_NO", DqMetricsValue.class); - } - - @Override - public void update(DqMetricsValue entity, DBObject old) { - Gson gson = new Gson(); - // DBObject t1 = gson.fromJson(gson.toJson(entity), - // BasicDBObject.class); - DBObject t1 = (DBObject) JSON.parse(gson.toJson(entity)); - dbCollection.update(old, t1); - } - - @Override - public DqMetricsValue getLatestByAssetId(String assetId) { - DBCursor temp = dbCollection.find(new BasicDBObject("assetId", - assetId)); - List<DBObject> all = temp.toArray(); - long latest = 0L; - DBObject latestObject = null; - for (DBObject o : all) { - if (Long.parseLong(o.get("timestamp").toString()) - latest > 0) { - latest = Long.parseLong(o.get("timestamp").toString()); - latestObject = o; - } - } - - if (latestObject == null) { - return null; - } - return new DqMetricsValue( - latestObject.get("metricName").toString(), - Long.parseLong(latestObject.get("timestamp").toString()), - Float.parseFloat(latestObject.get("value").toString())); - } - - @Override - public List<DqMetricsValue> getByMetricsName(String name) { - DBCursor temp = dbCollection.find(new BasicDBObject("metricName", - name)); - List<DBObject> all = temp.toArray(); - List<DqMetricsValue> result = new ArrayList<DqMetricsValue>(); - for (DBObject o : all) { - result.add( toEntity(o)); - } - return result; - } - - -// new DqMetricsValue(o.get("metricName").toString(), Long -// .parseLong(o.get("timestamp").toString()), Float -// .parseFloat(o.get("value").toString()))); -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqModelRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqModelRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqModelRepo.java deleted file mode 100644 index 3800508..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqModelRepo.java +++ /dev/null @@ -1,40 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.util.List; - -import com.ebay.oss.griffin.domain.DataAsset; -import com.ebay.oss.griffin.domain.DqModel; - -public interface DqModelRepo extends BarkIdRepo<DqModel> { - - DqModel update(DqModel model); - - /////////// - DqModel findCountModelByAssetID(long dataasetId); - - List<DqModel> getByDataAsset(DataAsset da); - - List<DqModel> getByStatus(int testing); - - DqModel findByColumn(String string, String modelid); - - DqModel findByName(String name); - - void addReference(DqModel countModel, String name); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqModelRepoImpl.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqModelRepoImpl.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqModelRepoImpl.java deleted file mode 100644 index 722821a..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqModelRepoImpl.java +++ /dev/null @@ -1,162 +0,0 @@ -/* - * Copyright (c) 2016 eBay Software Foundation. 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 com.ebay.oss.griffin.repo; - -import java.util.ArrayList; -import java.util.Iterator; -import java.util.List; - -import org.apache.commons.lang.StringUtils; -import org.springframework.stereotype.Repository; - -import com.ebay.oss.griffin.domain.DataAsset; -import com.ebay.oss.griffin.domain.DqModel; -import com.ebay.oss.griffin.domain.ModelType; -import com.ebay.oss.griffin.domain.ValidityType; -import com.google.gson.Gson; -import com.mongodb.BasicDBObject; -import com.mongodb.DBCursor; -import com.mongodb.DBObject; -import com.mongodb.util.JSON; - -@Repository -public class DqModelRepoImpl extends BaseIdRepo<DqModel> implements DqModelRepo { - - public DqModelRepoImpl() { - super("dq_model", "DQ_MODEL_NO", DqModel.class); - } - - @Override - public List<DqModel> getByStatus(int status) { - List<DqModel> result = new ArrayList<DqModel>(); - DBCursor cursor = dbCollection.find(new BasicDBObject("status", status)); - for (DBObject dbo : cursor) { - result.add(toEntity(dbo)); - } - return result; - } - - // FIXME what's the difference with save(T) - @Override - public DqModel update(DqModel entity) { - DBObject temp = dbCollection.findOne(new BasicDBObject("modelId", entity.getModelName())); - if (temp != null) { - dbCollection.remove(temp); - } - - Gson gson = new Gson(); - DBObject t1 = (DBObject) JSON.parse(gson.toJson(entity)); - dbCollection.save(t1); - - return toEntity(t1); - } - - // FIXME concerned could be removed - // get models concerned with data asset - // allConcerned: false- only the models directly concerned with the data asset - // true - the models directly concerned and non-directly concerned(eg. as the source asset of - // accuracy model) -// -// } else if (allConcerned) { // check the non-directly concerned models -// if (me.getModelType() == ModelType.ACCURACY) { // accuracy -// // find model -// DqModel entity = findByName(me.getModelName()); -// ModelInput mi = new ModelInput(); -// mi.parseFromString(entity.getModelContent()); -// -// // get mapping list to get the asset name -// String otherAsset = ""; -// List<MappingItemInput> mappingList = mi.getMappings(); -// Iterator<MappingItemInput> mpitr = mappingList.iterator(); -// while (mpitr.hasNext()) { -// MappingItemInput mapping = mpitr.next(); -// // since the target data asset is directly concerned, we should get source -// // as the other one -// String col = mapping.getSrc(); -// otherAsset = col.replaceFirst("\\..+", ""); // delete from the first .xxxx -// if (!otherAsset.isEmpty()) -// break; -// } -// -// // check the other asset name equals to this asst or not -// if (otherAsset.equals(da.getAssetName())) { // concerned non-directly -// result.add(me); -// } -// } - @Override - public List<DqModel> getByDataAsset(DataAsset da) { - List<DqModel> result = new ArrayList<DqModel>(); - List<DqModel> allModels = getAll(); - Iterator<DqModel> itr = allModels.iterator(); - while (itr.hasNext()) { - DqModel me = itr.next(); - if (me.getAssetId() == da.get_id()) { // concerned directly - result.add(me); - } - } - return result; - } - - @Override - public DqModel findByColumn(String colName, String value) { - - DBObject temp = dbCollection.findOne(new BasicDBObject(colName, value)); - - if (temp == null) { - return null; - } else { - Gson gson = new Gson(); - return gson.fromJson(temp.toString(), DqModel.class); - } - - } - - @Override - public DqModel findByName(String name) { - - DBObject temp = dbCollection.findOne(new BasicDBObject("modelName", name)); - - if (temp == null) { - return null; - } else { - return new Gson().fromJson(temp.toString(), DqModel.class); - } - - } - - @Override - public DqModel findCountModelByAssetID(long assetID) { - - DBCursor cursor = dbCollection.find(new BasicDBObject("assetId", assetID)); - for (DBObject tempDBObject : cursor) { - if (tempDBObject.get("modelType").equals(ModelType.VALIDITY)) { - String content = tempDBObject.get("modelContent").toString(); - String[] contents = content.split("\\|"); - if (contents[2].equals(ValidityType.TOTAL_COUNT + "")) { - return toEntity(tempDBObject); - } - } - } - - return null; - - } - - @SuppressWarnings("deprecation") - @Override - public void addReference(DqModel dqModel, String reference) { - if (!StringUtils.isBlank(dqModel.getReferenceModel())) { - reference = dqModel.getReferenceModel() + "," + reference; - } - dqModel.setReferenceModel(reference); - save(dqModel); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqScheduleRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqScheduleRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqScheduleRepo.java deleted file mode 100644 index f38bd81..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqScheduleRepo.java +++ /dev/null @@ -1,33 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import com.ebay.oss.griffin.domain.DqSchedule; -import com.mongodb.DBObject; - -public interface DqScheduleRepo extends BarkIdRepo<DqSchedule> { - - /////////// - void updateByModelType(DqSchedule schedule, int modelType); - - // is it required??? - void updateModelType(DBObject currentSchedule, int modelType); - - void deleteByModelList(String name); - - DBObject getValiditySchedule(long assetId); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqScheudleRepoImpl.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqScheudleRepoImpl.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqScheudleRepoImpl.java deleted file mode 100644 index 6b55674..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/DqScheudleRepoImpl.java +++ /dev/null @@ -1,82 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import org.springframework.stereotype.Repository; - -import com.ebay.oss.griffin.domain.DqSchedule; -import com.ebay.oss.griffin.domain.ModelType; -import com.google.gson.Gson; -import com.mongodb.BasicDBObject; -import com.mongodb.DBObject; -import com.mongodb.util.JSON; - -@Repository -public class DqScheudleRepoImpl extends BaseIdRepo<DqSchedule> implements DqScheduleRepo { - - public DqScheudleRepoImpl() { - super("dq_schedule", "DQ_JOB_SEQ_NO", DqSchedule.class); - } - - @Override - public DBObject getValiditySchedule(long assetId) { - BasicDBObject document = new BasicDBObject(); - document.put("assetId", assetId); - document.put("jobType", ModelType.VALIDITY); - return dbCollection.findOne(document); - } - - @Override - public void updateByModelType(DqSchedule schedule, int type) { - DBObject dbo = null; - if (type == ModelType.ACCURACY) { - dbo = dbCollection.findOne(new BasicDBObject("modelList", schedule.getModelList())); - } else if (type == ModelType.VALIDITY) { - dbo = getValiditySchedule(schedule.getAssetId()); - } - - if (dbo != null) { - dbCollection.remove(dbo); - } - - Gson gson = new Gson(); - DBObject t1 = (DBObject) JSON.parse(gson.toJson(schedule)); - dbCollection.save(t1); - } - - @Override - public void updateModelType(DBObject schedule, int type) { - DBObject dbo = null; - if (type == ModelType.ACCURACY) { - dbo = dbCollection.findOne(new BasicDBObject("modelList", schedule - .get("modelList"))); - } else if (type == ModelType.VALIDITY) { - dbo = getValiditySchedule(Integer.parseInt(schedule.get("assetId").toString())); - } - if (dbo != null) - dbCollection.remove(dbo); - dbCollection.save(schedule); - } - - @Override - public void deleteByModelList(String modelList) { - DBObject dbo = dbCollection.findOne(new BasicDBObject("modelList", modelList)); - if (dbo != null) { - dbCollection.remove(dbo); - } - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SampleFilePathRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SampleFilePathRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SampleFilePathRepo.java deleted file mode 100644 index 0b03023..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SampleFilePathRepo.java +++ /dev/null @@ -1,27 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.util.List; - -import com.ebay.oss.griffin.domain.SampleFilePathLKP; -import com.mongodb.DBObject; - -public interface SampleFilePathRepo extends BarkIdRepo<SampleFilePathLKP> { - - List<DBObject> findByModelName(String modelName); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SampleFilePathRepoImpl.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SampleFilePathRepoImpl.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SampleFilePathRepoImpl.java deleted file mode 100644 index e4595be..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SampleFilePathRepoImpl.java +++ /dev/null @@ -1,43 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import java.util.List; - -import org.springframework.stereotype.Repository; - -import com.ebay.oss.griffin.domain.SampleFilePathLKP; -import com.mongodb.BasicDBObject; -import com.mongodb.DBCursor; -import com.mongodb.DBObject; - -@Repository -public class SampleFilePathRepoImpl extends BaseIdRepo<SampleFilePathLKP> implements SampleFilePathRepo { - - public SampleFilePathRepoImpl() { - super("dq_missed_file_path_lkp", "DQ_MISSED_FILE_SEQ_NO", SampleFilePathLKP.class); - } - - @Override - public List<DBObject> findByModelName(String name) { - - DBCursor temp = dbCollection - .find(new BasicDBObject("modelName", name)).limit(20) - .sort(new BasicDBObject("timestamp", -1)); - return temp.toArray(); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SequenceRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SequenceRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SequenceRepo.java deleted file mode 100644 index 44c2e79..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SequenceRepo.java +++ /dev/null @@ -1,22 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -public interface SequenceRepo { - - Long getNextSequence(String seq); - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SequenceRepoImpl.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SequenceRepoImpl.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SequenceRepoImpl.java deleted file mode 100644 index 46fba24..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/SequenceRepoImpl.java +++ /dev/null @@ -1,44 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import org.springframework.stereotype.Repository; - -import com.mongodb.BasicDBObject; -import com.mongodb.DBObject; - -@SuppressWarnings({"unchecked", "rawtypes"}) -@Repository -public class SequenceRepoImpl extends BaseRepo implements SequenceRepo { - - public SequenceRepoImpl() { - super("SEQUENCES", Object.class); - } - - @Override - public synchronized Long getNextSequence(String seq) { - DBObject temp = dbCollection.findOne(new BasicDBObject("_id", seq)); - - BasicDBObject document = new BasicDBObject(); - document.put("_id", seq); - document.put(seq, Long.parseLong(temp.get(seq).toString()) + 1); - - dbCollection.save(document); - - return new Long((Long.parseLong(temp.get(seq).toString()) + 1)); - } - -} http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/f629d0f4/griffin-core/src/main/java/com/ebay/oss/griffin/repo/UserSubscriptionRepo.java ---------------------------------------------------------------------- diff --git a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/UserSubscriptionRepo.java b/griffin-core/src/main/java/com/ebay/oss/griffin/repo/UserSubscriptionRepo.java deleted file mode 100644 index fee43d7..0000000 --- a/griffin-core/src/main/java/com/ebay/oss/griffin/repo/UserSubscriptionRepo.java +++ /dev/null @@ -1,26 +0,0 @@ -/* - Copyright (c) 2016 eBay Software Foundation. - 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 com.ebay.oss.griffin.repo; - -import com.ebay.oss.griffin.domain.UserSubscription; - -public interface UserSubscriptionRepo { - - void upsertUserSubscribe(UserSubscription item); - - UserSubscription getUserSubscribeItem(String user); - -}
