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

[VAS] Story 8084: add orphan node in filing leaves tree view #1416

Merged
merged 1 commit into from
Aug 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@
import fr.gouv.vitamui.archives.search.common.dto.UnitDescriptiveMetadataDto;
import fr.gouv.vitamui.archives.search.common.dto.VitamUIArchiveUnitResponseDto;
import fr.gouv.vitamui.commons.api.domain.AgencyModelDto;
import fr.gouv.vitamui.commons.api.dtos.VitamUiOntologyDto;
import fr.gouv.vitamui.commons.api.dtos.SearchCriteriaDto;
import fr.gouv.vitamui.commons.api.dtos.VitamUiOntologyDto;
import fr.gouv.vitamui.commons.api.exception.BadRequestException;
import fr.gouv.vitamui.commons.api.exception.InternalServerException;
import fr.gouv.vitamui.commons.api.exception.UnexpectedDataException;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,13 @@ public enum CriteriaOperators {
public static final String PRODUCER_SERVICE = "#originating_agency";
public static final String GUID = "#id";
public static final String ALL_UNIT_UPS = "#allunitups";
public static final String UNIT_UPS = "#unitups";
public static final String TITLE_OR_DESCRIPTION = "TITLE_OR_DESCRIPTION";
public static final String ELIMINATION_TECHNICAL_ID_APPRAISAL_RULE = "ELIMINATION_TECHNICAL_ID_APPRAISAL_RULE";
public static final String ELIMINATION_GUID = "#elimination.OperationId";
public static final String ALL_ARCHIVE_UNIT_TYPES = "#unitType";
public static final String ALL_ARCHIVE_UNIT_TYPES_CRITERIA = "ALL_ARCHIVE_UNIT_TYPES";
public static final String ORPHANS_NODE_CRITERIA = "ORPHANS_NODE";
public static final String DESCRIPTION_LEVEL_CRITERIA = "DESCRIPTION_LEVEL";
public static final String DESCRIPTION_LEVEL = "DescriptionLevel";
public static final String ARCHIVE_UNIT_OBJECTS = "#object";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@
import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.CriteriaCategory.NODES;
import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.CriteriaCategory.REUSE_RULE;
import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.CriteriaOperators.EQ;
import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.CriteriaOperators.MISSING;
import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.DEFAULT_DEPTH;
import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.FACETS_COMPUTE_RULES_AU_NUMBER;
import static fr.gouv.vitamui.commons.api.utils.ArchiveSearchConsts.FACETS_COUNT_BY_NODE;
Expand Down Expand Up @@ -1045,6 +1046,9 @@ public static void fillQueryFromCriteriaList(BooleanQuery queryToFill, List<Sear
searchCriteria.getValues().stream().map(CriteriaValue::getValue).collect(
Collectors.toList())));
break;
case ArchiveSearchConsts.ORPHANS_NODE_CRITERIA:
queryToFill.add(buildOrphansNodeQuery());
break;

case ArchiveSearchConsts.DESCRIPTION_LEVEL_CRITERIA:
queryToFill.add(buildArchiveUnitDescriptionLevelQuery(
Expand Down Expand Up @@ -1182,6 +1186,11 @@ private static Query buildStartDateEndDateQuery(String searchCriteria, final Lis
return subQueryAnd;
}

private static Query buildOrphansNodeQuery()
throws InvalidCreateOperationException {
return and().add(VitamQueryHelper.buildSubQueryByOperator(ArchiveSearchConsts.UNIT_UPS, null, MISSING));
}

private static Query buildArchiveUnitTypeQuery(final List<String> searchValues)
throws InvalidCreateOperationException {
BooleanQuery subQueryAnd = and();
Expand Down Expand Up @@ -1275,8 +1284,10 @@ public static void handleSimpleFieldCriteria(BooleanQuery queryToFill, SearchCri
SIMPLE_FIELDS_VALUES_MAPPING.get(searchCriteria.getCriteria()) :
searchCriteria.getCriteria();

List<String> stringValues = searchCriteria.getValues().stream().map(CriteriaValue::getValue)
.collect(Collectors.toList());
List<String> stringValues =
searchCriteria.getValues().stream().filter(Objects::nonNull)
.map(CriteriaValue::getValue).filter(Objects::nonNull)
.collect(Collectors.toList());
if (isADateToReplace(searchCriteria)) {
String stringDate = searchCriteria.getValues().get(0).getValue();
LocalDateTime date = LocalDateTime.parse(stringDate, ArchiveSearchConsts.ISO_FRENCH_FORMATER);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
@SpringBootApplication
@EnableDiscoveryClient
public class ArchiveSearchApplication implements CommandLineRunner {

@Autowired
private Environment env;

Expand Down
2 changes: 1 addition & 1 deletion ui/ui-frontend-common/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "ui-frontend-common",
"version": "2.1.57",
"version": "2.1.58",
"main": "src/index.ts",
"pki": {
"path": "../../dev-deployment/environments/certs/server/hosts/localhost",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,5 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/
export * from './node.interface';
export * from './vitamui-tree-node.component';
export * from './vitamui-tree-node.module';

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
* accept its terms.
*/
import { AfterContentChecked, ChangeDetectorRef, Component, EventEmitter, Input, Output } from '@angular/core';
import { FilingHoldingSchemeNode } from './node.interface';
import { FilingHoldingSchemeNode } from '../../models/nodes';

@Component({
selector: 'vitamui-tree-node',
Expand All @@ -37,6 +37,7 @@ export class VitamuiTreeNodeComponent implements AfterContentChecked {
@Input() icon: string;
@Input() expanded: boolean;
@Input() disabled: boolean;
@Input() hasCheckBox = true;
@Input() labelIsLinkedToCheckbox = false;
@Output() nodeToggle = new EventEmitter<void>();
@Output() checkboxClick = new EventEmitter<void>();
Expand Down
1 change: 0 additions & 1 deletion ui/ui-frontend-common/src/app/modules/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,4 +119,3 @@ export * from './vitamui-global-error-handler';
export * from './vitamui-icons.enum';
export * from './vitamui-roles.enum';
export * from './vitamui-table/index';
export * from './vitamui-unit-types.enum';
Original file line number Diff line number Diff line change
Expand Up @@ -34,23 +34,9 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/

import { Id } from 'ui-frontend-common';
import { CriteriaValue } from './search.criteria';

export interface SearchCriteriaHistory extends Id {
name: string;
userId?: string;
savingDate: string;
searchCriteriaList: SearchCriteriaEltements[];
}

export interface SearchCriteriaEltements {
criteria: string;
operator: string;
keyTranslated: boolean;
valueTranslated: boolean;
values: CriteriaValue[];
category: string;
dataType: string;
}
export * from './criteria.enums';
export * from './criteria.interface';
export * from './criterion.interface';
export * from './search-criteria-history.interface';
export * from './search-criteria.interface';
export * from './search-response.interface';
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/

import { Id } from 'ui-frontend-common';
import { CriteriaValue } from './search.criteria';
import { Id } from '../id.interface';
import { CriteriaValue } from './search-criteria.interface';

export interface SearchCriteriaHistory extends Id {
name: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
* The fact that you are presently reading this means that you have had
* knowledge of the CeCILL-C license and that you accept its terms.
*/

export enum SearchCriteriaStatusEnum {
NOT_INCLUDED = 'NOT_INCLUDED',
INCLUDED = 'INCLUDED',
Expand Down Expand Up @@ -105,6 +106,7 @@ export interface SearchCriteriaEltDto {
values: CriteriaValue[];
dataType: string;
}

export interface SearchCriteriaDto {
criteriaList: SearchCriteriaEltDto[];
pageNumber: number;
Expand All @@ -126,10 +128,12 @@ export interface ResultFacetList {
name: string;
buckets: ResultBucket[];
}

export interface ResultBucket {
value: string;
count: number;
}

export interface ResultFacet {
node: string;
count: number;
Expand All @@ -144,9 +148,11 @@ export interface SearchCriteriaCategory {
name: string;
index: number;
}

export interface CriteriaValue {
id: string;
value?: string;
label?: string;
beginInterval?: string;
endInterval?: string;
}
Expand All @@ -165,8 +171,8 @@ export class ArchiveSearchResultFacets {
export class RuleFacets {
waitingToRecalculateRulesListFacets: ResultFacet[];
expiredRulesListFacets: ResultFacet[];
unexpiredRulesListFacets: ResultFacet[];
rulesListFacets: ResultFacet[];
finalActionsFacets?: ResultFacet[];
noRulesFacets: ResultFacet[];
unexpiredRulesListFacets: ResultFacet[];
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,22 +35,10 @@
* knowledge of the CeCILL-C license and that you accept its terms.
*/

import { Id } from 'ui-frontend-common';
import { CriteriaValue } from './search.criteria';
import { Unit } from '../units';

export interface SearchCriteriaHistory extends Id {
name: string;
userId?: string;
savingDate: string;
searchCriteriaList: SearchCriteriaEltements[];
}

export interface SearchCriteriaEltements {
criteria: string;
operator: string;
keyTranslated: boolean;
valueTranslated: boolean;
values: CriteriaValue[];
category: string;
dataType: string;
export interface SearchResponse<T = Unit> {
$hits: any;
$results: T[];
$facetResults?: any[];
}
5 changes: 2 additions & 3 deletions ui/ui-frontend-common/src/app/modules/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,15 @@ export * from './application/index';
export * from './breadcrumb/breadcrumb.interface';
export * from './collect/index';
export * from './content-disposition.enum';
export * from './criteria/criteria.enums';
export * from './criteria/criteria.interface';
export * from './criteria/criterion.interface';
export * from './criteria/index';
export * from './customer/index';
export * from './externalparamprofile/index';
export * from './group/index';
export * from './id.interface';
export * from './ingest-contract/index';
export * from './logbook/index';
export * from './managementContract/index';
export * from './nodes/index';
export * from './ontology/index';
export * from './operation/index';
export * from './position/index';
Expand Down
Loading