Skip to content
This repository has been archived by the owner on Sep 19, 2023. It is now read-only.

Commit

Permalink
Add decommissionTime to dataset deprecation (datahub-project#994)
Browse files Browse the repository at this point in the history
  • Loading branch information
alyiwang authored and alisaraa committed Mar 22, 2018
1 parent cd7657a commit b8933be
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ public DictDatasetDao(@Nonnull EntityManagerFactory factory) {
private static final String SET_DATASET_DEPRECATION =
"UPDATE DictDataset SET isDeprecated = :deprecated WHERE id = :datasetId";

private static final String SET_DATASET_ACTIVE =
"UPDATE DictDataset SET isActive = :active WHERE urn = :datasetUrn";
private static final String SET_DATASET_ACTIVE = "UPDATE DictDataset SET isActive = :active WHERE urn = :datasetUrn";

public DictDataset findByUrn(@Nonnull String urn) {
return findBy(DictDataset.class, "urn", urn);
Expand Down Expand Up @@ -192,8 +191,8 @@ public void setDatasetDeprecation(int datasetId, @Nonnull String datasetUrn, boo
executeUpdate(SET_DATASET_DEPRECATION, params);
}

public void setDatasetDeprecation(@Nonnull String datasetUrn, boolean isDeprecated,
@Nonnull String deprecationNote, @Nonnull String user) throws Exception {
public void setDatasetDeprecation(@Nonnull String datasetUrn, boolean isDeprecated, @Nonnull String deprecationNote,
@Nullable Long decommissionTime, @Nonnull String user) throws Exception {
throw new UnsupportedOperationException("Not implemented yet");
}

Expand Down
8 changes: 4 additions & 4 deletions wherehows-frontend/app/controllers/api/v2/Dataset.java
Original file line number Diff line number Diff line change
Expand Up @@ -91,8 +91,8 @@ public static Promise<Result> listDatasets(@Nullable String platform, @Nonnull S
int page = NumberUtils.toInt(request().getQueryString("page"), 0);
int start = page * _DEFAULT_PAGE_SIZE;

return Promise.promise(() -> ok(
Json.toJson(DATASET_VIEW_DAO.listDatasets(platform, "PROD", prefix, start, _DEFAULT_PAGE_SIZE))));
return Promise.promise(
() -> ok(Json.toJson(DATASET_VIEW_DAO.listDatasets(platform, "PROD", prefix, start, _DEFAULT_PAGE_SIZE))));
} catch (Exception e) {
Logger.error("Fail to list datasets", e);
return Promise.promise(() -> internalServerError(errorResponse(e)));
Expand Down Expand Up @@ -151,10 +151,10 @@ public static Promise<Result> updateDatasetDeprecation(String datasetUrn) {
JsonNode record = request().body().asJson();

boolean deprecated = record.get("deprecated").asBoolean();

String deprecationNote = record.hasNonNull("deprecationNote") ? record.get("deprecationNote").asText() : "";
Long decommissionTime = record.hasNonNull("decommissionTime") ? record.get("decommissionTime").asLong() : null;

DICT_DATASET_DAO.setDatasetDeprecation(datasetUrn, deprecated, deprecationNote, username);
DICT_DATASET_DAO.setDatasetDeprecation(datasetUrn, deprecated, deprecationNote, decommissionTime, username);
} catch (Exception e) {
Logger.error("Update dataset deprecation fail", e);
return Promise.promise(() -> internalServerError(errorResponse(e)));
Expand Down

0 comments on commit b8933be

Please sign in to comment.