Commit dc1d2e47 authored by oussamasic's avatar oussamasic Committed by Ro3034
Browse files

add getRule service

parent d427aa86
......@@ -147,8 +147,7 @@ public class ArchiveSearchConsts {
ORIGINATING_AGENCY_ID_FIELD, "#originating_agency",
"START_DATE", "StartDate",
"END_DATE", "EndDate",
"SP_LABEL", "originating_agency_label",
"APPRAISAL_RULE_START_DATE", "#management.AppraisalRule.Rules.StartDate"
"SP_LABEL", "originating_agency_label"
);
......
......@@ -53,5 +53,6 @@ import java.io.Serializable;
public class RuleSearchCriteriaDto implements Serializable {
private SearchCriteriaDto searchCriteriaDto;
private VitamUiRuleActions ruleActions;
}
......@@ -54,6 +54,5 @@ import java.io.Serializable;
@Getter
public class VitamUiManagementMetadataAction implements Serializable {
@JsonProperty("ArchiveUnitProfile")
String archiveUnitProfile;
}
......@@ -55,12 +55,20 @@ import java.util.Set;
public class VitamUiRuleCategoryAction implements Serializable {
private List<VitamUiRuleAction> rules;
private String finalAction;
private String classificationLevel;
private String classificationOwner;
private String classificationAudience;
private String classificationReassessingDate;
private Boolean needReassessingAuthorization;
private Boolean preventInheritance;
private Set<String> preventRulesId;
}
......@@ -57,10 +57,16 @@ public class VitamUiRuleCategoryActionDeletion implements Serializable {
private Optional<List<VitamUiRuleAction>> rules;
private Optional<String> finalAction;
private Optional<String> classificationAudience;
private Optional<String> classificationReassessingDate;
private Optional<Boolean> needReassessingAuthorization;
private Optional<Boolean> preventInheritance;
private Optional<Set<String>> preventRulesId;
}
......@@ -204,7 +204,9 @@
<executable>true</executable>
<attach>false</attach> <!-- Need to use the original jar for integration-tests -->
<mainClass>fr.gouv.vitamui.archive.internal.server.ApiArchiveInternalServerApplication</mainClass>
<jvmArguments>-Xmx512m</jvmArguments>
<jvmArguments>
-Xmx512m
</jvmArguments>
<arguments>
<!-- use src/main/config/application-dev.yml when using mvn spring-boot:run -->
<!-- See : https://docs.spring.io/spring-boot/docs/current/reference/html/boot-features-external-config.html#boot-features-external-config-application-property-files -->
......
......@@ -60,6 +60,9 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Update Archive units Rules Converters
*/
@Getter
@Setter
public class RuleOperationsConverter {
......
......@@ -45,6 +45,9 @@ import fr.gouv.vitam.common.model.massupdate.RuleActions;
import java.util.Arrays;
/**
* Update Archive units Rules Common Service
*/
public class RulesUpdateCommonService {
public void deleteAttributesFromObjectNode(ObjectNode dslRequest, String ...attributes) {
......
......@@ -51,7 +51,6 @@ import fr.gouv.vitam.common.model.dip.DataObjectVersions;
import fr.gouv.vitam.common.model.elimination.EliminationRequestBody;
import fr.gouv.vitam.common.model.export.dip.DipExportType;
import fr.gouv.vitam.common.model.export.dip.DipRequest;
import fr.gouv.vitam.common.model.elimination.EliminationRequestBody;
import fr.gouv.vitam.common.model.massupdate.MassUpdateUnitRuleRequest;
import fr.gouv.vitam.common.model.massupdate.RuleActions;
import fr.gouv.vitamui.archive.internal.server.rulesupdate.converter.RuleOperationsConverter;
......@@ -700,8 +699,6 @@ public class ArchiveSearchInternalService {
ObjectNode dslRequest = (ObjectNode) dslQuery;
rulesUpdateCommonService.deleteAttributesFromObjectNode(dslRequest, "$projection" ,"$filter","$facets");
/* massUpdateUnitRuleRequest.setRuleActions(ruleActions);
massUpdateUnitRuleRequest.setDslRequest(dslRequest);*/
rulesUpdateCommonService.setMassUpdateUnitRuleRequest(massUpdateUnitRuleRequest, ruleActions, dslRequest);
objectMapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
......
......@@ -303,7 +303,9 @@
<executable>true</executable>
<attach>true</attach> <!-- Need to use the original jar for integration-tests -->
<mainClass>fr.gouv.vitamui.iam.internal.server.ApiIamInternalServerApplication</mainClass>
<jvmArguments>-Xmx512m</jvmArguments>
<jvmArguments>
-Xmx512m
</jvmArguments>
<arguments>
<argument>--spring.profiles.active=dev</argument>
</arguments>
......
# This configuration file indicates profiles , profiles groups and users automatically create when a new customer or customer tenant is created.
# Put as many as you want following the template given
customer-init:
# Default profiles for each customer created
profiles:
- name: Profil pour la gestion des profiles de sécurité
description: Gestion des profiles de sécurité dans Vitam
app-name: SECURITY_PROFILES_APP
level:
roles:
- ROLE_GET_SECURITY_PROFILES
- ROLE_CREATE_SECURITY_PROFILES
- ROLE_UPDATE_SECURITY_PROFILES
- ROLE_DELETE_SECURITY_PROFILES
- name: Profil pour la gestion des formats de fichiers
description: Gestion des formats de fichiers dans Vitam
app-name: FILE_FORMATS_APP
level:
roles:
- ROLE_GET_FILE_FORMATS
- ROLE_CREATE_FILE_FORMATS
- ROLE_UPDATE_FILE_FORMATS
- ROLE_DELETE_FILE_FORMATS
- name: Profil pour la gestion des ontologies
description: Gestion des ontologies dans Vitam
app-name: ONTOLOGY_APP
level:
roles:
- ROLE_GET_ONTOLOGIES
- ROLE_CREATE_ONTOLOGIES
- ROLE_DELETE_ONTOLOGIES
- name: Profil pour la gestion des contrats des contextes
description: Gestion des contrats des contextes dans Vitam
app-name: CONTEXTS_APP
level:
roles:
- ROLE_GET_CONTEXTS
- ROLE_CREATE_CONTEXTS
- ROLE_UPDATE_CONTEXTS
#- name: profileName
# description: desc
# level: 1
# app-name: app
# roles:
# - role_1
# - role_2
# - role_3
# ...
# Default profiles groups for each customer created
profiles-groups:
#- name: group1
# description: desc
# level: 2
# profiles:
# - profileName
# ...
# Default users for each customer created
users:
#- last-name: lastName
# first-name: firstName
# profiles-group-name: group1
# level: 1
# email-prefix: a@mail.com
# Default profiles for each tenant created
tenant-profiles:
- name: Profil pour la gestion des contrats d'accès
description: Gestion des contrats d'accès dans Vitam
app-name: ACCESS_APP
level:
roles:
- ROLE_GET_ACCESS_CONTRACTS
- ROLE_CREATE_ACCESS_CONTRACTS
- ROLE_UPDATE_ACCESS_CONTRACTS
- ROLE_GET_FILLING_PLAN_ACCESS
- name: Profil pour la gestion des contrats d'entrée
description: Gestion des contrats d'entrée dans Vitam
app-name: INGEST_APP
level:
roles:
- ROLE_GET_INGEST_CONTRACTS
- ROLE_CREATE_INGEST_CONTRACTS
- ROLE_UPDATE_INGEST_CONTRACTS
- ROLE_GET_FILLING_PLAN_ACCESS
- ROLE_GET_MANAGEMENT_CONTRACTS
- ROLE_GET_ARCHIVE_PROFILES
- name: Profil pour les services agents
description: Gestion des services agents dans Vitam
app-name: AGENCIES_APP
level:
roles:
- ROLE_GET_AGENCIES
- ROLE_CREATE_AGENCIES
- ROLE_UPDATE_AGENCIES
- ROLE_DELETE_AGENCIES
- ROLE_EXPORT_AGENCIES
- name: Profil pour la gestion des Audits
description: Gestion des audits dans Vitam
app-name: AUDIT_APP
level:
roles:
- ROLE_GET_AUDITS
- ROLE_RUN_AUDITS
- name: Profil Journal des Opérations
description: Gestion des applications des Journaux des Opérations
app-name: LOGBOOK_OPERATION_APP
level:
roles:
- ROLE_LOGBOOKS
- name: Profil pour le dépôt et suivi des versements
description: Gestion des applications de dépôt et suivi des versements
app-name: INGEST_MANAGEMENT_APP
level:
roles:
- ROLE_GET_INGEST
- ROLE_CREATE_INGEST
- ROLE_GET_ALL_INGEST
- ROLE_LOGBOOKS
- name: Profil Arbres et Plans
description: Gestion des application d'import d'arbres de positionnement et plans de classement
app-name: HOLDING_FILLING_SCHEME_APP
level:
roles:
- ROLE_CREATE_HOLDING_FILLING_SCHEME
- ROLE_GET_HOLDING_FILLING_SCHEME
- ROLE_GET_ALL_HOLDING_FILLING_SCHEME
- name: Profil pour la gestion des opérations
description: Gérer et consulter l'ensemble des opérations d'entrées qui sont en cours
app-name: LOGBOOK_MANAGEMENT_OPERATION_APP
level:
roles:
- ROLE_GET_LOGBOOK_OPERATION
- ROLE_GET_ALL_LOGBOOK_OPERATION
- ROLE_UPDATE_LOGBOOK_OPERATION
- name: Profil pour la création des profils paramétrage externe
description: Gérer et consulter l'ensemble des profils paramétrage externe
app-name: EXTERNAL_PARAM_PROFILE_APP
level:
roles:
- ROLE_CREATE_EXTERNAL_PARAM_PROFILE
- ROLE_EDIT_EXTERNAL_PARAM_PROFILE
- ROLE_SEARCH_EXTERNAL_PARAM_PROFILE
- ROLE_GET_PROFILES
- ROLE_UPDATE_PROFILES
- ROLE_LOGBOOKS
- name: Consultation
description: Profil pour la recherche et consultation des archives dans Vitam avec mises à jour des règles, sans export DIP et sans élimination
app-name: ARCHIVE_SEARCH_MANAGEMENT_APP
level:
roles:
- ROLE_CREATE_ARCHIVE_SEARCH
- ROLE_GET_ARCHIVE_SEARCH
- ROLE_GET_ALL_ARCHIVE_SEARCH
- ROLE_SEARCH_WITH_RULES
- name: Archiviste
description: Profil pour la recherche et consultation des archives dans Vitam avec mises à jour des règles de gestion, avec export DIP et sans élimination
app-name: ARCHIVE_SEARCH_MANAGEMENT_APP
level:
roles:
- ROLE_CREATE_ARCHIVE_SEARCH
- ROLE_GET_ARCHIVE_SEARCH
- ROLE_GET_ALL_ARCHIVE_SEARCH
- ROLE_EXPORT_DIP
- ROLE_SEARCH_WITH_RULES
- name: Archiviste administrateur
description: Profil pour la recherche et consultation des archives dans Vitam avec mises à jour des règles, export DIP et opérations d'élimination
app-name: ARCHIVE_SEARCH_MANAGEMENT_APP
level:
roles:
- ROLE_CREATE_ARCHIVE_SEARCH
- ROLE_GET_ARCHIVE_SEARCH
- ROLE_GET_ALL_ARCHIVE_SEARCH
- ROLE_SEARCH_WITH_RULES
- ROLE_EXPORT_DIP
- ROLE_ELIMINATION
- ROLE_UPDATE_MANAGEMENT_RULES
#- name: profileName
# description: desc
# level: 1
# app-name: app
# roles:
# - role_1
# - role_2
# - role_3
# ...
# Other Default profiles for admin group
admin-profiles:
#- name: profileName
# description: desc
# level: 1
# app-name: app
# roles:
# - role_1
# - role_2
# - role_3
# ...
......@@ -44,7 +44,6 @@ import fr.gouv.vitamui.commons.api.logger.VitamUILogger;
import fr.gouv.vitamui.commons.api.logger.VitamUILoggerFactory;
import fr.gouv.vitamui.commons.rest.AbstractUiRestController;
import fr.gouv.vitamui.commons.vitam.api.dto.ResultsDto;
import fr.gouv.vitamui.commons.vitam.api.dto.RuleCategoryDto;
import fr.gouv.vitamui.commons.vitam.api.dto.VitamUISearchResponseDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
......@@ -205,22 +204,11 @@ public class ArchivesSearchController extends AbstractUiRestController {
return jsonNodeResponseEntity.getBody();
}
@ApiOperation(value = "get Name")
@PostMapping("ruleName")
@ResponseStatus(HttpStatus.OK)
public String getName() {
String result = archivesSearchService.getName().getBody();
return result;
}
@ApiOperation(value = "Update Archive Units Rules by criteria")
@PostMapping(RestApi.MASSUPDATEUNITSRULES)
@ResponseStatus(HttpStatus.OK)
public String updateArchiveUnitsRules(@RequestBody final RuleSearchCriteriaDto ruleSearchCriteriaDto) {
LOGGER.debug("Update Archive Units Rules with criteria {}", ruleSearchCriteriaDto);
LOGGER.info("Oussama chabaaaaab2 {}", ruleSearchCriteriaDto.getRuleActions());
LOGGER.debug("Update Archive Units Rules with criteria {} ", ruleSearchCriteriaDto);
String result = archivesSearchService.updateArchiveUnitsRules(ruleSearchCriteriaDto, buildUiHttpContext()).getBody();
return result;
}
......
......@@ -185,11 +185,6 @@ public class ArchivesSearchService extends AbstractPaginateService<ArchiveUnitsD
return archiveSearchExternalRestClient.startEliminationAction(context, searchQuery);
}
public ResponseEntity<String> getName() {
return new ResponseEntity<String>("Rule Name", HttpStatus.OK);
// return "Rule Name ";
}
public ResponseEntity<String> updateArchiveUnitsRules(final RuleSearchCriteriaDto ruleSearchCriteriaDto,ExternalHttpContext context) {
LOGGER.info("Update Archive Units Rules with criteria {}", ruleSearchCriteriaDto);
return archiveSearchExternalRestClient.updateArchiveUnitsRules(ruleSearchCriteriaDto, context);
......
......@@ -32,7 +32,7 @@ const APPRAISAL_RULE_END_DATE = 'APPRAISAL_RULE_END_DATE';
const ELIMINATION_TECHNICAL_ID = 'ELIMINATION_TECHNICAL_ID';
@Component({
selector: 'appraisal-rule-search',
selector: 'app-appraisal-rule-search',
templateUrl: './appraisal-rule-search.component.html',
styleUrls: ['./appraisal-rule-search.component.css']
})
......
......@@ -90,7 +90,7 @@
'ARCHIVE_SEARCH.REMOVE_SEARCH_CRITERIA_BY_CATEGORY' | translate
}}</a>
</div>
<appraisal-rule-search></appraisal-rule-search>
<app-appraisal-rule-search></app-appraisal-rule-search>
</div>
</ng-container>
</mat-tab>
......@@ -182,7 +182,7 @@
{{ 'ARCHIVE_SEARCH.DIP.EXPORT_DIP' | translate }}
</button>
<button mat-menu-item (click)="updateManagementRule()" [disabled]="!hasUpdateManagementRuleRole || itemSelected === 0">
{{ 'ARCHIVE_SEARCH.RULE.UPDATE_RULE' | translate }}
{{ 'ARCHIVE_SEARCH.RULES_ACTION.UPDATE_RULE' | translate }}
</button>
<button mat-menu-item (click)="startEliminationAnalysis()" [disabled]="!hasEliminationAnalysisOrActionRole || itemSelected === 0">
{{ 'ARCHIVE_SEARCH.ELIMINATION.ANALYSIS' | translate }}
......
......@@ -52,7 +52,16 @@ import { FilingHoldingSchemeNode } from '../models/node.interface';
import { NodeData } from '../models/nodedata.interface';
import { ActionsRules } from '../models/ruleAction.interface';
import { SearchCriteriaEltements, SearchCriteriaHistory } from '../models/search-criteria-history.interface';
import { CriteriaValue, PagedResult, SearchCriteria, SearchCriteriaCategory, SearchCriteriaEltDto, SearchCriteriaStatusEnum, SearchCriteriaTypeEnum, SearchCriteriaValue } from '../models/search.criteria';
import {
CriteriaValue,
PagedResult,
SearchCriteria,
SearchCriteriaCategory,
SearchCriteriaEltDto,
SearchCriteriaStatusEnum,
SearchCriteriaTypeEnum,
SearchCriteriaValue,
} from '../models/search.criteria';
import { Unit } from '../models/unit.interface';
import { VitamUISnackBarComponent } from '../shared/vitamui-snack-bar';
import { DipRequestCreateComponent } from './dip-request-create/dip-request-create.component';
......@@ -1171,9 +1180,6 @@ export class ArchiveSearchComponent implements OnInit, OnChanges, OnDestroy {
}
updateManagementRule() {
// this.route.url.subscribe((data) => {
// console.log('salam', data);
// });
this.listOfUACriteriaSearch = this.prepareUAIdList(this.criteriaSearchList, this.listOfUAIdToInclude, this.listOfUAIdToExclude);
const criteriaSearchDSLQuery = {
criteriaList: this.listOfUACriteriaSearch,
......@@ -1181,10 +1187,7 @@ export class ArchiveSearchComponent implements OnInit, OnChanges, OnDestroy {
size: PAGE_SIZE,
language: this.translateService.currentLang,
};
console.log('hello2', this.router.url);
console.log('cooo', this.startupService.getConfigStringValue('UI_URL'));
// this.managementRulesSharedDataService.emitApplicationName('Hello from archive search');
this.managementRulesSharedDataService.emitselectedItems(this.itemSelected);
this.managementRulesSharedDataService.emitCriteriaSearchListToSave(this.criteriaSearchList);
this.managementRulesSharedDataService.emitCriteriaSearchDSLQuery(criteriaSearchDSLQuery);
......
......@@ -123,7 +123,7 @@ import { ManagementRulesValidatorService } from './validators/management-rules-v
SearchCriteriaSaverService,
RuleValidator,
ManagementRulesSharedDataService,
ManagementRulesValidatorService
ManagementRulesValidatorService,
],
declarations: [
ArchiveComponent,
......@@ -144,6 +144,6 @@ import { ManagementRulesValidatorService } from './validators/management-rules-v
DuaManagementRulesComponent,
AddUpdatePropertyComponent,
],
schemas: [CUSTOM_ELEMENTS_SCHEMA]
schemas: [CUSTOM_ELEMENTS_SCHEMA],
})
export class ArchiveModule {}
......@@ -89,8 +89,8 @@ export class ArchiveService extends SearchService<any> {
return pagedResult;
}
private static fetchTitle(title: string, title_: any) {
return title ? title : title_ ? (title_.fr ? title_.fr : title_.en) : title_.en;
private static fetchTitle(title: string, titleInLanguages: any) {
return title ? title : titleInLanguages ? (titleInLanguages.fr ? titleInLanguages.fr : titleInLanguages.en) : titleInLanguages.en;
}
public getOntologiesFromJson(): Observable<any> {
......@@ -184,14 +184,14 @@ export class ArchiveService extends SearchService<any> {
);
}
downloadObjectFromUnit(id: string, title?: string, title_?: any, headers?: HttpHeaders) {
downloadObjectFromUnit(id: string, title?: string, titleInLanguages?: any, headers?: HttpHeaders) {
return this.archiveApiService.downloadObjectFromUnit(id, headers).subscribe(
(response) => {
let filename;
if (response.headers.get('content-disposition').includes('filename')) {
filename = response.headers.get('content-disposition').split('=')[1];
} else {
filename = this.normalizeTitle(ArchiveService.fetchTitle(title, title_));
filename = this.normalizeTitle(ArchiveService.fetchTitle(title, titleInLanguages));
}
const element = document.createElement('a');
......@@ -250,10 +250,6 @@ export class ArchiveService extends SearchService<any> {
return this.archiveApiService.updateUnitsRules(ruleSearchCriteriaDto, headers);
}
getName(): string {
return 'hello from ui-archive-search';
}
openSnackBarForWorkflow(message: string, serviceUrl?: string) {
this.snackBar.openFromComponent(VitamUISnackBarComponent, {
panelClass: 'vitamui-snack-bar',
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment