Skip to content

Commit

Permalink
Merge branch 'develop' into EPMRPP-87165-pbkdf2-ldap
Browse files Browse the repository at this point in the history
  • Loading branch information
IvanKustau committed Dec 4, 2023
2 parents 8994fa5 + 126ee2e commit eb63883
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 46 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1080,7 +1080,8 @@ protected Collection<? extends SelectField> selectFields() {
ATTACHMENT.FILE_SIZE,
ATTACHMENT.PROJECT_ID,
ATTACHMENT.LAUNCH_ID,
ATTACHMENT.ITEM_ID
ATTACHMENT.ITEM_ID,
ATTACHMENT.FILE_NAME
);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,8 @@ public List<Attachment> findByItemIdsAndLogTimeBefore(Collection<Long> itemIds,
ATTACHMENT.FILE_SIZE,
ATTACHMENT.ITEM_ID,
ATTACHMENT.LAUNCH_ID,
ATTACHMENT.PROJECT_ID
ATTACHMENT.PROJECT_ID,
ATTACHMENT.FILE_NAME
)
.from(ATTACHMENT)
.join(LOG)
Expand All @@ -173,7 +174,8 @@ public List<Attachment> findByLaunchIdsAndLogTimeBefore(Collection<Long> launchI
ATTACHMENT.FILE_SIZE,
ATTACHMENT.ITEM_ID,
ATTACHMENT.LAUNCH_ID,
ATTACHMENT.PROJECT_ID
ATTACHMENT.PROJECT_ID,
ATTACHMENT.FILE_NAME
)
.from(ATTACHMENT)
.join(LOG)
Expand All @@ -194,7 +196,8 @@ public List<Attachment> findByProjectIdsAndLogTimeBefore(Long projectId, LocalDa
ATTACHMENT.FILE_SIZE,
ATTACHMENT.ITEM_ID,
ATTACHMENT.LAUNCH_ID,
ATTACHMENT.PROJECT_ID
ATTACHMENT.PROJECT_ID,
ATTACHMENT.FILE_NAME
)
.from(ATTACHMENT)
.join(LOG)
Expand Down
85 changes: 43 additions & 42 deletions src/main/java/com/epam/ta/reportportal/dao/util/RecordMappers.java
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
*/
public class RecordMappers {

private static final ObjectMapper objectMapper;
private static final ObjectMapper objectMapper;

static {
objectMapper = new ObjectMapper();
Expand Down Expand Up @@ -220,6 +220,7 @@ public class RecordMappers {
attachment.setProjectId(r.get(ATTACHMENT.PROJECT_ID));
attachment.setLaunchId(r.get(ATTACHMENT.LAUNCH_ID));
attachment.setItemId(r.get(ATTACHMENT.ITEM_ID));
attachment.setFileName(r.get(ATTACHMENT.FILE_NAME));

return attachment;
}).orElse(null);
Expand Down Expand Up @@ -323,8 +324,8 @@ public class RecordMappers {
);

/**
* Maps record into {@link PatternTemplate} object (only {@link PatternTemplate#id} and
* {@link PatternTemplate#name} fields)
* Maps record into {@link PatternTemplate} object (only {@link PatternTemplate#id} and {@link
* PatternTemplate#name} fields)
*/
public static final Function<? super Record, Optional<PatternTemplate>> PATTERN_TEMPLATE_NAME_RECORD_MAPPER = r -> ofNullable(
r.get(
Expand Down Expand Up @@ -409,45 +410,45 @@ public class RecordMappers {
return new ReportPortalUser.ProjectDetails(projectId, projectName, projectRole);
};

public static final RecordMapper<? super Record, Activity> ACTIVITY_MAPPER = r -> {
Activity activity = new Activity();
activity.setId(r.get(ACTIVITY.ID));
activity.setCreatedAt(r.get(ACTIVITY.CREATED_AT, LocalDateTime.class));
activity.setAction(EventAction.valueOf(r.get(ACTIVITY.ACTION)));
activity.setEventName(r.get(ACTIVITY.EVENT_NAME));
activity.setPriority(EventPriority.valueOf(r.get(ACTIVITY.PRIORITY)));
activity.setObjectId(r.get(ACTIVITY.OBJECT_ID));
activity.setObjectName(r.get(ACTIVITY.OBJECT_NAME));
activity.setObjectType(EventObject.valueOf(r.get(ACTIVITY.OBJECT_TYPE)));
activity.setProjectId(r.get(ACTIVITY.PROJECT_ID));
activity.setProjectName(r.get(PROJECT.NAME));
String detailsJson = r.get(ACTIVITY.DETAILS, String.class);
ofNullable(detailsJson).ifPresent(s -> {
try {
ActivityDetails details = objectMapper.readValue(s, ActivityDetails.class);
activity.setDetails(details);
} catch (IOException e) {
throw new ReportPortalException(ErrorType.UNCLASSIFIED_REPORT_PORTAL_ERROR);
}
});
activity.setSubjectId(r.get(ACTIVITY.SUBJECT_ID));
activity.setSubjectName(ofNullable(r.get(USERS.LOGIN)).orElse(r.get(ACTIVITY.SUBJECT_NAME)));
activity.setSubjectType(EventSubject.valueOf(r.get(ACTIVITY.SUBJECT_TYPE)));
return activity;
};

public static final RecordMapper<? super Record, OwnedEntity> OWNED_ENTITY_RECORD_MAPPER = r -> r.into(
OwnedEntity.class);

private static final BiConsumer<Widget, ? super Record> WIDGET_USER_FILTER_MAPPER = (widget, res) -> ofNullable(
res.get(FILTER.ID)).ifPresent(
id -> {
Set<UserFilter> filters = ofNullable(widget.getFilters()).orElseGet(Sets::newLinkedHashSet);
UserFilter filter = new UserFilter();
filter.setId(id);
filters.add(filter);
widget.setFilters(filters);
});
public static final RecordMapper<? super Record, Activity> ACTIVITY_MAPPER = r -> {
Activity activity = new Activity();
activity.setId(r.get(ACTIVITY.ID));
activity.setCreatedAt(r.get(ACTIVITY.CREATED_AT, LocalDateTime.class));
activity.setAction(EventAction.valueOf(r.get(ACTIVITY.ACTION)));
activity.setEventName(r.get(ACTIVITY.EVENT_NAME));
activity.setPriority(EventPriority.valueOf(r.get(ACTIVITY.PRIORITY)));
activity.setObjectId(r.get(ACTIVITY.OBJECT_ID));
activity.setObjectName(r.get(ACTIVITY.OBJECT_NAME));
activity.setObjectType(EventObject.valueOf(r.get(ACTIVITY.OBJECT_TYPE)));
activity.setProjectId(r.get(ACTIVITY.PROJECT_ID));
activity.setProjectName(r.get(PROJECT.NAME));
String detailsJson = r.get(ACTIVITY.DETAILS, String.class);
ofNullable(detailsJson).ifPresent(s -> {
try {
ActivityDetails details = objectMapper.readValue(s, ActivityDetails.class);
activity.setDetails(details);
} catch (IOException e) {
throw new ReportPortalException(ErrorType.UNCLASSIFIED_REPORT_PORTAL_ERROR);
}
});
activity.setSubjectId(r.get(ACTIVITY.SUBJECT_ID));
activity.setSubjectName(ofNullable(r.get(USERS.LOGIN)).orElse(r.get(ACTIVITY.SUBJECT_NAME)));
activity.setSubjectType(EventSubject.valueOf(r.get(ACTIVITY.SUBJECT_TYPE)));
return activity;
};

public static final RecordMapper<? super Record, OwnedEntity> OWNED_ENTITY_RECORD_MAPPER = r -> r.into(
OwnedEntity.class);

private static final BiConsumer<Widget, ? super Record> WIDGET_USER_FILTER_MAPPER = (widget, res) -> ofNullable(
res.get(FILTER.ID)).ifPresent(
id -> {
Set<UserFilter> filters = ofNullable(widget.getFilters()).orElseGet(Sets::newLinkedHashSet);
UserFilter filter = new UserFilter();
filter.setId(id);
filters.add(filter);
widget.setFilters(filters);
});

private static final BiConsumer<Widget, ? super Record> WIDGET_OPTIONS_MAPPER = (widget, res) -> {
ofNullable(res.get(WIDGET.WIDGET_OPTIONS, String.class)).ifPresent(wo -> {
Expand Down

0 comments on commit eb63883

Please sign in to comment.