Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Activity feed implementation #789

Merged
merged 80 commits into from
Jul 20, 2022
Merged
Show file tree
Hide file tree
Changes from 79 commits
Commits
Show all changes
80 commits
Select commit Hold shift + click to select a range
4275daf
V1 API
damirabdul Jun 13, 2022
3a378a6
Merge branch 'main' of github.com:opendatadiscovery/odd-platform into…
Leshe4ka Jun 14, 2022
cf7d4d6
update activity event types
damirabdul Jun 15, 2022
cb15005
Merge branch 'main' into activity
damirabdul Jun 16, 2022
20e9c30
Rollback to old filters.
Leshe4ka Jun 22, 2022
fdd9e08
Merge main
Leshe4ka Jun 22, 2022
6852f49
Implemented new single filter for activities.
Leshe4ka Jun 22, 2022
a4f2f22
Finalized filters section.
Leshe4ka Jun 24, 2022
c051ed7
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jun 24, 2022
1a41462
activity handlers implementation
damirabdul Jun 29, 2022
99cd0c2
merge main into activity
damirabdul Jun 29, 2022
4d07841
Behind useUpdateActivityQuery
Leshe4ka Jun 29, 2022
dfff5f4
fix create table
damirabdul Jun 29, 2022
c2a6e6f
mappings + change contracts
damirabdul Jul 2, 2022
8f65ef7
fix specifications
damirabdul Jul 5, 2022
abefc5a
fix specifications
damirabdul Jul 5, 2022
7ce1e6b
Work commit
Leshe4ka Jul 5, 2022
8ed1259
Merge commit
Leshe4ka Jul 5, 2022
db147ad
fix build
damirabdul Jul 5, 2022
4ca4b50
Work commit
Leshe4ka Jul 5, 2022
d689036
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jul 5, 2022
0f95c20
activity list implementation
damirabdul Jul 5, 2022
71b8579
Work commit
Leshe4ka Jul 5, 2022
e1ef3b0
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jul 5, 2022
0d99147
activity count repository
damirabdul Jul 5, 2022
e033083
Work commit
Leshe4ka Jul 6, 2022
73c3e51
Main activity page without list.
Leshe4ka Jul 6, 2022
5059fbb
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jul 6, 2022
4158f6f
add test for mapper
damirabdul Jul 6, 2022
92c93f4
Merge remote-tracking branch 'origin/activity' into activity
damirabdul Jul 6, 2022
c089243
fix serializing
damirabdul Jul 6, 2022
45a4b75
Merge main into activity
damirabdul Jul 7, 2022
3f46340
rename migration file
damirabdul Jul 7, 2022
0ee7fc7
fix tests
damirabdul Jul 7, 2022
8374f37
fiz queries
damirabdul Jul 7, 2022
d0e6d9d
fiz queries
damirabdul Jul 7, 2022
560d36c
Work commit
Leshe4ka Jul 7, 2022
779189e
Merge commit
Leshe4ka Jul 7, 2022
dce34ce
Changed dates logic.
Leshe4ka Jul 8, 2022
1e5cd98
fix queries
damirabdul Jul 9, 2022
fe72be5
Refactor dates filter logic. Refactor filters logic.
Leshe4ka Jul 9, 2022
4d1ee93
Clean up
Leshe4ka Jul 9, 2022
a62ea32
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jul 10, 2022
624b376
Implemented new date range picker
Leshe4ka Jul 10, 2022
f0d9332
Updated dataentity activity logic.
Leshe4ka Jul 10, 2022
274cd1b
fix mapper
damirabdul Jul 12, 2022
1b20bca
Implemented owners activities.
Leshe4ka Jul 12, 2022
7edc240
work commit
Leshe4ka Jul 13, 2022
9a6787b
add activity id, term mapping
damirabdul Jul 14, 2022
f5b4043
activity improvements
damirabdul Jul 14, 2022
1000a9b
Fixed pagination at main activity page.
Leshe4ka Jul 14, 2022
86333e5
Merge commit
Leshe4ka Jul 14, 2022
e4e48a7
merge main into activity
damirabdul Jul 15, 2022
3b2f259
rename
damirabdul Jul 15, 2022
e8cffeb
fix build
damirabdul Jul 15, 2022
19cbd3e
FE Improvements.
Leshe4ka Jul 15, 2022
2a5dd20
fix
damirabdul Jul 15, 2022
5e598e3
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jul 15, 2022
dd532ad
work commit
Leshe4ka Jul 15, 2022
b4f302a
labels activity
damirabdul Jul 16, 2022
60d8e89
Merge remote-tracking branch 'origin/activity' into activity
damirabdul Jul 16, 2022
64baea0
work commit
Leshe4ka Jul 17, 2022
2364200
fix mapping
damirabdul Jul 17, 2022
d57fbfc
Merge remote-tracking branch 'origin/activity' into activity
damirabdul Jul 17, 2022
1b419ca
fix tests
damirabdul Jul 17, 2022
3ab595a
Main activity page.
Leshe4ka Jul 17, 2022
f89129f
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jul 17, 2022
2b965ee
rename custom name to business name
damirabdul Jul 18, 2022
26ea9ae
Implemented data entity activity page.
Leshe4ka Jul 18, 2022
3ef4dcc
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jul 18, 2022
951a2ce
Refactor. Cleanup.
Leshe4ka Jul 18, 2022
9f4381c
Refactor. Cleanup.
Leshe4ka Jul 18, 2022
665b84e
spec fix
Leshe4ka Jul 19, 2022
92e0669
plural fix
Leshe4ka Jul 19, 2022
855cf14
fix tag event
damirabdul Jul 19, 2022
8586b2c
Merge remote-tracking branch 'origin/activity' into activity
damirabdul Jul 19, 2022
41726ad
Merge main
Leshe4ka Jul 19, 2022
fc904c1
Merge branch 'activity' of github.com:opendatadiscovery/odd-platform …
Leshe4ka Jul 19, 2022
ad62447
Excluded not supported activities.
Leshe4ka Jul 19, 2022
788a952
fix pr issues
damirabdul Jul 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 0 additions & 13 deletions config/checkstyle/checkstyle.xml
Original file line number Diff line number Diff line change
Expand Up @@ -181,11 +181,6 @@
<message key="name.invalidPattern"
value="Type name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="MemberName">
<property name="format" value="^[a-z][a-z0-9][a-zA-Z0-9]*$"/>
<message key="name.invalidPattern"
value="Member name ''{0}'' must match pattern ''{1}''."/>
</module>
<module name="ParameterName">
<property name="format" value="^[a-z]([a-z0-9][a-zA-Z0-9]*)?$"/>
<message key="name.invalidPattern"
Expand Down Expand Up @@ -255,14 +250,6 @@
<property name="lineWrappingIndentation" value="4"/>
<property name="arrayInitIndent" value="4"/>
</module>
<module name="AbbreviationAsWordInName">
<property name="ignoreFinal" value="false"/>
<property name="allowedAbbreviationLength" value="5"/>
<property name="tokens"
value="CLASS_DEF, INTERFACE_DEF, ENUM_DEF, ANNOTATION_DEF, ANNOTATION_FIELD_DEF,
PARAMETER_DEF, VARIABLE_DEF, METHOD_DEF, PATTERN_VARIABLE_DEF, RECORD_DEF,
RECORD_COMPONENT_DEF"/>
</module>
<!-- <module name="NoWhitespaceBeforeCaseDefaultColon"/>--> <!-- java-->
<module name="OverloadMethodsDeclarationOrder"/>
<module name="VariableDeclarationUsageDistance"/>
Expand Down
4 changes: 3 additions & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ spring-security = { module = 'org.springframework.boot:spring-boot-starter-secur
spring-thymeleaf = { module = 'org.springframework.boot:spring-boot-starter-thymeleaf' }
spring-oauth2-client = { module = 'org.springframework.boot:spring-boot-starter-oauth2-client' }
spring-oauth2-rs = { module = 'org.springframework.boot:spring-boot-starter-oauth2-resource-server' }
spring-aop = { module = 'org.springframework.boot:spring-boot-starter-aop' }
spring-session = { module = 'org.springframework.session:spring-session-core' }
spring-ldap = { module = 'org.springframework.boot:spring-boot-starter-data-ldap' }
spring-security-ldap = { module = 'org.springframework.security:spring-security-ldap' }
Expand Down Expand Up @@ -96,7 +97,8 @@ spring = [
'spring-ldap',
'spring-security-ldap',
'spring-r2dbc',
'reactor-extra'
'reactor-extra',
'spring-aop'
]
spring-redis-session = [
'spring-data-session-redis',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@
import org.opendatadiscovery.oddplatform.notification.NotificationsProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.security.config.annotation.web.reactive.EnableWebFluxSecurity;
import org.springframework.transaction.annotation.EnableTransactionManagement;

@Configuration
@EnableTransactionManagement
@EnableWebFluxSecurity
@EnableAspectJAutoProxy
@EnableConfigurationProperties({MetricExporterProperties.class, NotificationsProperties.class})
public class ODDPlatformConfiguration {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
package org.opendatadiscovery.oddplatform.controller;

import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.opendatadiscovery.oddplatform.api.contract.api.ActivityApi;
import org.opendatadiscovery.oddplatform.api.contract.model.Activity;
import org.opendatadiscovery.oddplatform.api.contract.model.ActivityCountInfo;
import org.opendatadiscovery.oddplatform.api.contract.model.ActivityEventType;
import org.opendatadiscovery.oddplatform.api.contract.model.ActivityType;
import org.opendatadiscovery.oddplatform.service.activity.ActivityService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.server.ServerWebExchange;
import reactor.core.publisher.Flux;
import reactor.core.publisher.Mono;

@RestController
@RequiredArgsConstructor
public class ActivityController implements ActivityApi {
private final ActivityService activityService;

@Override
public Mono<ResponseEntity<Flux<Activity>>> getActivity(final LocalDate beginDate,
final LocalDate endDate,
final Integer size,
final Long datasourceId,
final Long namespaceId,
final List<Long> tagIds,
final List<Long> ownerIds,
final List<Long> userIds,
final ActivityType type,
final ActivityEventType eventType,
final Long lasEventId,
final OffsetDateTime lastEventDateTime,
final ServerWebExchange exchange) {
return Mono.just(
activityService.getActivityList(beginDate, endDate, size, datasourceId, namespaceId, tagIds, ownerIds,
userIds, type, eventType, lasEventId, lastEventDateTime))
.map(ResponseEntity::ok);
}

@Override
public Mono<ResponseEntity<ActivityCountInfo>> getActivityCounts(final LocalDate beginDate,
final LocalDate endDate,
final Long datasourceId,
final Long namespaceId,
final List<Long> tagIds,
final List<Long> ownerIds,
final List<Long> userIds,
final ActivityEventType eventType,
final ServerWebExchange exchange) {
return activityService.getActivityCounts(beginDate, endDate, datasourceId, namespaceId,
tagIds, ownerIds, userIds, eventType)
.map(ResponseEntity::ok);
}
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,13 @@
package org.opendatadiscovery.oddplatform.controller;

import java.time.LocalDate;
import java.time.OffsetDateTime;
import java.util.List;
import javax.validation.Valid;
import lombok.extern.slf4j.Slf4j;
import org.opendatadiscovery.oddplatform.api.contract.api.DataEntityApi;
import org.opendatadiscovery.oddplatform.api.contract.model.Activity;
import org.opendatadiscovery.oddplatform.api.contract.model.ActivityEventType;
import org.opendatadiscovery.oddplatform.api.contract.model.AlertList;
import org.opendatadiscovery.oddplatform.api.contract.model.DataEntity;
import org.opendatadiscovery.oddplatform.api.contract.model.DataEntityClassAndTypeDictionary;
Expand Down Expand Up @@ -33,6 +38,7 @@
import org.opendatadiscovery.oddplatform.service.DataEntityService;
import org.opendatadiscovery.oddplatform.service.LineageService;
import org.opendatadiscovery.oddplatform.service.OwnershipService;
import org.opendatadiscovery.oddplatform.service.activity.ActivityService;
import org.opendatadiscovery.oddplatform.service.term.TermService;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.RestController;
Expand All @@ -51,17 +57,20 @@ public class DataEntityController
private final AlertService alertService;
private final TermService termService;
private final LineageService lineageService;
private final ActivityService activityService;

public DataEntityController(final DataEntityService entityService,
final OwnershipService ownershipService,
final AlertService alertService,
final TermService termService,
final LineageService lineageService) {
final LineageService lineageService,
final ActivityService activityService) {
super(entityService);
this.ownershipService = ownershipService;
this.alertService = alertService;
this.termService = termService;
this.lineageService = lineageService;
this.activityService = activityService;
}

@Override
Expand Down Expand Up @@ -329,4 +338,20 @@ public Mono<ResponseEntity<Void>> deleteDataEntityFromDataEntityGroup(final Long
.ignoreElements()
.thenReturn(ResponseEntity.noContent().build());
}

@Override
public Mono<ResponseEntity<Flux<Activity>>> getDataEntityActivity(final Long dataEntityId,
final LocalDate beginDate,
final LocalDate endDate,
final Integer size,
final List<Long> userIds,
final ActivityEventType eventType,
final Long lastEventId,
final OffsetDateTime lastEventDateTime,
final ServerWebExchange exchange) {
return Mono.just(
activityService.getDataEntityActivityList(beginDate, endDate, size, dataEntityId, userIds, eventType,
lastEventId, lastEventDateTime)
).map(ResponseEntity::ok);
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.opendatadiscovery.oddplatform.controller;

import java.util.List;
import lombok.RequiredArgsConstructor;
import org.opendatadiscovery.oddplatform.api.contract.api.OwnerApi;
import org.opendatadiscovery.oddplatform.api.contract.model.Owner;
Expand Down Expand Up @@ -29,8 +30,9 @@ public Mono<ResponseEntity<Owner>> createOwner(final Mono<OwnerFormData> ownerFo
public Mono<ResponseEntity<OwnerList>> getOwnerList(final Integer page,
final Integer size,
final String query,
final List<Long> ids,
final ServerWebExchange exchange) {
return ownerService.list(page, size, query)
return ownerService.list(page, size, query, ids)
.map(ResponseEntity::ok);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package org.opendatadiscovery.oddplatform.controller;

import java.util.List;
import lombok.RequiredArgsConstructor;
import org.opendatadiscovery.oddplatform.api.contract.api.TagApi;
import org.opendatadiscovery.oddplatform.api.contract.model.Tag;
Expand Down Expand Up @@ -36,8 +37,9 @@ public Mono<ResponseEntity<Void>> deleteTag(final Long tagId, final ServerWebExc
public Mono<ResponseEntity<TagsResponse>> getPopularTagList(final Integer page,
final Integer size,
final String query,
final List<Long> ids,
final ServerWebExchange exchange) {
return tagService.listMostPopular(query, page, size)
return tagService.listMostPopular(query, ids, page, size)
.map(ResponseEntity::ok);
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import lombok.Builder;
import lombok.Getter;

@Builder
@Getter
public class ActivityContextInfo {
private Long dataEntityId;
private String oldState;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import lombok.Builder;
import lombok.Getter;

@Builder
@Getter
public class ActivityCreateEvent {
private long dataEntityId;
private ActivityEventTypeDto eventType;
private String oldState;
private String newState;
private boolean systemEvent;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import org.opendatadiscovery.oddplatform.model.tables.pojos.ActivityPojo;
import org.opendatadiscovery.oddplatform.model.tables.pojos.DataEntityPojo;
import org.opendatadiscovery.oddplatform.model.tables.pojos.OwnerPojo;

public record ActivityDto(ActivityPojo activity, OwnerPojo user, DataEntityPojo dataEntity) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
package org.opendatadiscovery.oddplatform.dto.activity;

public enum ActivityEventTypeDto {
OWNERSHIP_CREATED,
OWNERSHIP_UPDATED,
OWNERSHIP_DELETED,
TAGS_ASSOCIATION_UPDATED,
DATA_ENTITY_CREATED,
DATA_ENTITY_OVERVIEW_UPDATED,
DATA_ENTITY_METADATA_UPDATED,
DATA_ENTITY_SCHEMA_UPDATED,
DATA_ENTITY_RELATION_UPDATED,
TERM_ASSIGNED,
TERM_ASSIGNMENT_DELETED,
DESCRIPTION_UPDATED,
BUSINESS_NAME_UPDATED,
CUSTOM_METADATA_CREATED,
CUSTOM_METADATA_UPDATED,
CUSTOM_METADATA_DELETED,
DATASET_FIELD_VALUES_UPDATED,
DATASET_FIELD_DESCRIPTION_UPDATED,
DATASET_FIELD_LABELS_UPDATED,
CUSTOM_GROUP_CREATED,
CUSTOM_GROUP_UPDATED,
CUSTOM_GROUP_DELETED;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import com.fasterxml.jackson.annotation.JsonProperty;

public record BusinessNameActivityStateDto(@JsonProperty("internal_name") String internalName) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

public record CustomGroupActivityStateDto(Long id, String name,
@JsonProperty("entity_classes") List<Integer> entityClasses,
@JsonProperty("type_id") Integer typeId,
@JsonProperty("namespace_name") String namespaceName,
List<CustomGroupEntityActivityStateDto> entities) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

public record CustomGroupEntityActivityStateDto(Long id,
@JsonProperty("internal_name") String internalName,
@JsonProperty("external_name") String externalName,
@JsonProperty("entity_classes") List<Integer> entityClasses) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;

public record DataEntityCreatedActivityStateDto(Long id,
@JsonProperty("external_name") String externalName,
String oddrn,
List<Integer> classes,
@JsonProperty("type_id") Integer typeId) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.opendatadiscovery.oddplatform.dto.activity;

public record DatasetFieldEnumValuesActivityStateDto(Long id, String name) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import java.util.List;
import org.jooq.JSONB;

public record DatasetFieldInformationActivityStateDto(Long id, String name, JSONB type, String description,
List<DatasetFieldLabelActivityStateDto> labels) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.opendatadiscovery.oddplatform.dto.activity;

public record DatasetFieldLabelActivityStateDto(Long id, String name) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import com.fasterxml.jackson.annotation.JsonProperty;
import java.util.List;
import org.jooq.JSONB;

public record DatasetFieldValuesActivityStateDto(
Long id,
String name,
JSONB type,
String description,
@JsonProperty("enum_values") List<DatasetFieldEnumValuesActivityStateDto> enumValues) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.opendatadiscovery.oddplatform.dto.activity;

public record DescriptionActivityStateDto(String description) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import com.fasterxml.jackson.annotation.JsonProperty;

public record OwnershipActivityStateDto(@JsonProperty("owner_name") String ownerName,
@JsonProperty("role_name") String roleName) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
package org.opendatadiscovery.oddplatform.dto.activity;

public record TagActivityStateDto(Long id, String name, Boolean important) {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
package org.opendatadiscovery.oddplatform.dto.activity;

import com.fasterxml.jackson.annotation.JsonProperty;

public record TermActivityStateDto(@JsonProperty("term_id") Long termId, String term, String namespace) {
}
Loading