Compare commits
No commits in common. "42c7712763aad1216724604856255973f178b564" and "23559c1bf44717410d4bd82bbc26e9e131a11125" have entirely different histories.
42c7712763
...
23559c1bf4
|
@ -14,6 +14,8 @@ import org.opencdmp.commons.enums.DescriptionStatus;
|
|||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.commons.scope.user.UserScope;
|
||||
import org.opencdmp.data.*;
|
||||
import org.opencdmp.elastic.data.nested.NestedTagElasticEntity;
|
||||
import org.opencdmp.elastic.elasticbuilder.nested.NestedTagElasticBuilder;
|
||||
import org.opencdmp.model.PublicDescription;
|
||||
import org.opencdmp.model.description.Description;
|
||||
import org.opencdmp.query.utils.QueryUtilsService;
|
||||
|
@ -23,6 +25,7 @@ import org.springframework.stereotype.Component;
|
|||
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Component
|
||||
@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||||
|
@ -39,7 +42,6 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
private DmpQuery dmpQuery;
|
||||
|
||||
private DescriptionReferenceQuery descriptionReferenceQuery;
|
||||
private DescriptionTagQuery descriptionTagQuery;
|
||||
|
||||
private Instant createdAfter;
|
||||
|
||||
|
@ -160,11 +162,6 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
return this;
|
||||
}
|
||||
|
||||
public DescriptionQuery descriptionTagSubQuery(DescriptionTagQuery subQuery) {
|
||||
this.descriptionTagQuery = subQuery;
|
||||
return this;
|
||||
}
|
||||
|
||||
public DescriptionQuery excludedIds(Collection<UUID> values) {
|
||||
this.excludedIds = values;
|
||||
return this;
|
||||
|
@ -348,10 +345,6 @@ public class DescriptionQuery extends QueryBase<DescriptionEntity> {
|
|||
QueryContext<DescriptionReferenceEntity, UUID> subQuery = this.applySubQuery(this.descriptionReferenceQuery, queryContext, UUID.class, descriptionReferenceEntityRoot -> descriptionReferenceEntityRoot.get(DescriptionReferenceEntity._descriptionId));
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._id)).value(subQuery.Query));
|
||||
}
|
||||
if (this.descriptionTagQuery != null) {
|
||||
QueryContext<DescriptionTagEntity, UUID> subQuery = this.applySubQuery(this.descriptionTagQuery, queryContext, UUID.class, descriptionTagEntityRoot -> descriptionTagEntityRoot.get(DescriptionTagEntity._descriptionId));
|
||||
predicates.add(queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._id)).value(subQuery.Query));
|
||||
}
|
||||
if (this.dmpDescriptionTemplateIds != null) {
|
||||
CriteriaBuilder.In<UUID> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionEntity._dmpDescriptionTemplateId));
|
||||
for (UUID item : this.dmpDescriptionTemplateIds)
|
||||
|
|
|
@ -6,6 +6,7 @@ import org.apache.commons.lang3.StringUtils;
|
|||
import org.opencdmp.commons.enums.DescriptionStatus;
|
||||
import org.opencdmp.commons.enums.IsActive;
|
||||
import org.opencdmp.elastic.query.DescriptionElasticQuery;
|
||||
import org.opencdmp.model.reference.Reference;
|
||||
import org.opencdmp.query.DescriptionQuery;
|
||||
|
||||
import java.time.Instant;
|
||||
|
@ -26,7 +27,6 @@ public class DescriptionLookup extends Lookup {
|
|||
|
||||
private DmpLookup dmpSubQuery;
|
||||
private DescriptionReferenceLookup descriptionReferenceSubQuery;
|
||||
private DescriptionTagLookup descriptionTagSubQuery;
|
||||
|
||||
private List<IsActive> isActive;
|
||||
|
||||
|
@ -84,10 +84,6 @@ public class DescriptionLookup extends Lookup {
|
|||
|
||||
public void setDescriptionReferenceSubQuery(DescriptionReferenceLookup descriptionReferenceSubQuery) { this.descriptionReferenceSubQuery = descriptionReferenceSubQuery; }
|
||||
|
||||
public DescriptionTagLookup getDescriptionTagSubQuery() { return this.descriptionTagSubQuery; }
|
||||
|
||||
public void setDescriptionTagSubQuery(DescriptionTagLookup descriptionTagSubQuery) { this.descriptionTagSubQuery = descriptionTagSubQuery; }
|
||||
|
||||
public Instant getCreatedAfter() {
|
||||
return this.createdAfter;
|
||||
}
|
||||
|
@ -127,7 +123,6 @@ public class DescriptionLookup extends Lookup {
|
|||
if (this.excludedIds != null) query.excludedIds(this.excludedIds);
|
||||
if (this.dmpSubQuery != null) query.dmpSubQuery(this.dmpSubQuery.enrich(queryFactory));
|
||||
if (this.descriptionReferenceSubQuery != null) query.descriptionReferenceSubQuery(this.descriptionReferenceSubQuery.enrich(queryFactory));
|
||||
if (this.descriptionTagSubQuery != null) query.descriptionTagSubQuery(this.descriptionTagSubQuery.enrich(queryFactory));
|
||||
if (this.isActive != null) query.isActive(this.isActive);
|
||||
if (this.statuses != null) query.statuses(this.statuses);
|
||||
if (this.createdAfter != null) query.createdAfter(this.createdAfter);
|
||||
|
|
|
@ -4,9 +4,9 @@ import { IsActive } from '../common/enum/is-active.enum';
|
|||
import { DescriptionStatus } from '../common/enum/description-status';
|
||||
import { DmpLookup } from './dmp.lookup';
|
||||
import { DmpUserRole } from '../common/enum/dmp-user-role';
|
||||
import { DescriptionTag } from '../model/description/description';
|
||||
import { ReferenceType } from '../model/reference-type/reference-type';
|
||||
import { DescriptionReferenceLookup } from './reference.lookup';
|
||||
import { DescriptionTagLookup } from './tag.lookup';
|
||||
import { DescriptionReferenceLookup, ReferenceLookup } from './reference.lookup';
|
||||
|
||||
export class DescriptionLookup extends Lookup implements DescriptionFilter {
|
||||
ids: Guid[];
|
||||
|
@ -24,7 +24,7 @@ export class DescriptionLookup extends Lookup implements DescriptionFilter {
|
|||
descriptionTemplateIds: Guid[]; //TODO
|
||||
associatedDmpIds: Guid[]; //TODO
|
||||
roleInDmp: DmpUserRole[]; //TODO
|
||||
descriptionTagSubQuery: DescriptionTagLookup;
|
||||
tags: DescriptionTag[]; //TODO
|
||||
descriptionReferenceSubQuery: DescriptionReferenceLookup;
|
||||
|
||||
constructor() {
|
||||
|
@ -47,7 +47,7 @@ export interface DescriptionFilter {
|
|||
descriptionTemplateIds: Guid[];
|
||||
associatedDmpIds: Guid[];
|
||||
roleInDmp: DmpUserRole[];
|
||||
descriptionTagSubQuery: DescriptionTagLookup;
|
||||
tags: DescriptionTag[];
|
||||
descriptionReferenceSubQuery: DescriptionReferenceLookup;
|
||||
}
|
||||
|
||||
|
|
|
@ -14,17 +14,6 @@ export class TagLookup extends Lookup implements TagFilter {
|
|||
}
|
||||
}
|
||||
|
||||
export class DescriptionTagLookup extends Lookup {
|
||||
tagIds: Guid[];
|
||||
excludedIds: Guid[];
|
||||
like: string;
|
||||
isActive: IsActive[];
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
}
|
||||
}
|
||||
|
||||
export interface TagFilter {
|
||||
ids: Guid[];
|
||||
excludedIds: Guid[];
|
||||
|
|
|
@ -16,20 +16,20 @@
|
|||
</div>
|
||||
</div>
|
||||
<div class="col-auto">
|
||||
<div *ngIf="listingItems && listingItems.length > 0 || lookup.like" class="row">
|
||||
<div *ngIf="listingItems && listingItems.length > 0 || this.lookup.like" class="row">
|
||||
<div class="col-12">
|
||||
<app-navigation-breadcrumb />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="listingItems && listingItems.length > 0 && !isPublic || lookup.like" class="ml-auto">
|
||||
<div *ngIf="listingItems && listingItems.length > 0 && !isPublic || this.lookup.like" class="ml-auto">
|
||||
<div class="col-auto">
|
||||
<button mat-raised-button class="add-description align-self-center yellow-btn" (click)="addNewDescription()">
|
||||
{{'DESCRIPTION-LISTING.ACTIONS.ADD-DESCRIPTION' | translate}}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div *ngIf="listingItems && listingItems.length > 0 || lookup.like || lookup.descriptionTemplateIds || lookup.associatedDmpIds || lookup.roleInDmp || lookup.descriptionTagSubQuery || lookup.descriptionReferenceSubQuery"
|
||||
<div *ngIf="listingItems && listingItems.length > 0 || this.lookup.like || this.lookup.descriptionTemplateIds || this.lookup.associatedDmpIds || this.lookup.roleInDmp || this.lookup.tags || this.lookup.descriptionReferenceSubQuery"
|
||||
class="filter-btn" [style.right]="dialog.getDialogById('filters') ? '446px' : '0px'" [style.width]="listingItems.length > 2 ? '57px' : '37px'" (click)="openFiltersDialog()">
|
||||
<button mat-raised-button class="p-0">
|
||||
<mat-icon class="mr-4 filter-icon">filter_alt</mat-icon>
|
||||
|
|
|
@ -8,7 +8,7 @@ import { IsActive } from '@app/core/common/enum/is-active.enum';
|
|||
import { AppPermission } from '@app/core/common/enum/permission.enum';
|
||||
import { RecentActivityOrder } from '@app/core/common/enum/recent-activity-order';
|
||||
import { DescriptionTemplate } from '@app/core/model/description-template/description-template';
|
||||
import { BaseDescription, Description, DescriptionReference, DescriptionTag } from '@app/core/model/description/description';
|
||||
import { BaseDescription, Description, DescriptionReference } from '@app/core/model/description/description';
|
||||
import { DmpBlueprint, DmpBlueprintDefinition, DmpBlueprintDefinitionSection } from '@app/core/model/dmp-blueprint/dmp-blueprint';
|
||||
import { Dmp, DmpDescriptionTemplate, DmpUser } from '@app/core/model/dmp/dmp';
|
||||
import { DmpReference } from '@app/core/model/dmp/dmp-reference';
|
||||
|
@ -37,8 +37,6 @@ import { QueryParamsService } from '@app/core/services/utilities/query-params.se
|
|||
import { UiNotificationService } from '@app/core/services/notification/ui-notification-service';
|
||||
import { Guid } from '@common/types/guid';
|
||||
import { DescriptionReferenceLookup } from '@app/core/query/reference.lookup';
|
||||
import { DescriptionTagLookup } from '@app/core/query/tag.lookup';
|
||||
import { Tag } from '@app/core/model/tag/tag';
|
||||
|
||||
@Component({
|
||||
selector: 'app-description-listing-component',
|
||||
|
@ -203,19 +201,6 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
|
||||
return lookup;
|
||||
}
|
||||
|
||||
protected initializeTagLookup(): DescriptionTagLookup {
|
||||
const lookup = new DescriptionTagLookup();
|
||||
lookup.metadata = { countAll: true };
|
||||
lookup.isActive = [IsActive.Active];
|
||||
lookup.project = {
|
||||
fields: [
|
||||
[nameof<DescriptionTag>(x => x.tag), nameof<Tag>(x => x.id)].join('.'),
|
||||
]
|
||||
};
|
||||
|
||||
return lookup;
|
||||
}
|
||||
|
||||
protected setupColumns() {
|
||||
}
|
||||
|
@ -394,17 +379,10 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
lookup.statuses = formGroup.get("status")?.value !== null ? [formGroup.get("status")?.value] : null;
|
||||
lookup.showAllVersions = formGroup.get("showAllVersions")?.value ?? false;
|
||||
lookup.roleInDmp = formGroup.get("role")?.value !== null ? [formGroup.get("role")?.value] : null;
|
||||
lookup.tags = formGroup.get("tags")?.value ?? null;
|
||||
lookup.associatedDmpIds = formGroup.get("associatedDmpIds")?.value ?? null;
|
||||
lookup.descriptionTemplateIds = formGroup.get("descriptionTemplates")?.value ?? null;
|
||||
|
||||
// Tags
|
||||
let tags = formGroup.get("tags")?.value ?? null;
|
||||
if (tags && tags.length > 0) {
|
||||
lookup.descriptionTagSubQuery = this.initializeTagLookup();
|
||||
lookup.descriptionTagSubQuery.tagIds = tags;
|
||||
} else lookup.descriptionTagSubQuery = null;
|
||||
|
||||
// References
|
||||
let references: Guid[] = formGroup.get("references")?.value
|
||||
?.filter((reference: ReferencesWithType) => reference.referenceType != null && reference.references?.length > 0)
|
||||
?.flatMap((referencesWithType: ReferencesWithType) => referencesWithType.references) as Guid[];
|
||||
|
@ -412,7 +390,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
if (references && references?.length > 0) {
|
||||
lookup.descriptionReferenceSubQuery = this.initializeReferenceLookup();
|
||||
lookup.descriptionReferenceSubQuery.referenceIds = references;
|
||||
} else lookup.descriptionReferenceSubQuery = null;
|
||||
} else lookup.descriptionReferenceSubQuery = null;
|
||||
|
||||
return lookup;
|
||||
}
|
||||
|
@ -439,7 +417,7 @@ export class DescriptionListingComponent extends BaseListingComponent<BaseDescri
|
|||
showAllVersions: [lookup.showAllVersions ?? false],
|
||||
descriptionTemplates: [lookup.descriptionTemplateIds],
|
||||
associatedDmpIds: [lookup.associatedDmpIds],
|
||||
tags: lookup.descriptionTagSubQuery?.tagIds ? [lookup.descriptionTagSubQuery?.tagIds] : [],
|
||||
tags: [lookup.tags],
|
||||
references: formArray
|
||||
});
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue