Commit 7c9428d9 authored by Baptiste Toulemonde's avatar Baptiste Toulemonde
Browse files

fix MV standalone

parent 71f8b764
......@@ -132,11 +132,11 @@ public class BaliseXML {
// When a value is declared in a profile element, the <rng:data> tag must be suppressed
// to assure that the generated profile is successfully imported by VITAM
if (null != node.getValueOrData() && !node.getValueOrData().equals(UNDEFINED) &&
node.getValueOrData().equals("data") && !node.getName().equals("CodeListVersions")) {
node.getValueOrData().equals("data") && !node.getName().equals("CodeListVersions") && null == node.getValue()) {
dataRNG = new DataXML();
}
if ((node.getName() != null && ((node.getName().equals("CodeListVersions")&& presenceChildrenNode) || presenceChildrenNode))
if ((node.getName() != null && ((node.getName().equals("CodeListVersions")&& presenceChildrenNode) || presenceChildrenNode) && null == node.getValue())
&& (valueRNG == null && RNGConstants.getTypesMap().containsKey(node.getName()))) {
dataRNG = new DataXML();
dataRNG.setDataType(RNGConstants.getTypesMap().get(node.getName()).getLabel());
......
......@@ -489,7 +489,7 @@ public class PuaPastisValidator {
ObjectMapper mapper = new ObjectMapper();
mapper.setSerializationInclusion(JsonInclude.Include.NON_NULL);
JSONObject childProperties =
new JSONObject(mapper.writeValueAsString(childOfRuleDetails.serialiseString()));
new JSONObject(mapper.writeValueAsString(childOfRuleDetails));
grandChildrenOfRule.put(grandChild.getName(), childProperties);
ruleTypeMetadataDetails.setProperties(grandChildrenOfRule);
}
......
......@@ -41,13 +41,20 @@ package fr.gouv.vitamui.pastis.standalone;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.event.EventListener;
import java.awt.*;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
@SpringBootApplication
public class ApiPastisStandaloneApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(ApiPastisStandaloneApplication.class, args);
new SpringApplicationBuilder(ApiPastisStandaloneApplication.class).headless(false).run(args);
}
@Override
......@@ -55,4 +62,9 @@ public class ApiPastisStandaloneApplication extends SpringBootServletInitializer
return application.sources(ApiPastisStandaloneApplication.class);
}
@EventListener(ApplicationReadyEvent.class)
public void openBrowserAfterStartup() throws IOException, URISyntaxException {
Desktop.getDesktop().browse(new URI(("http://localhost:8096")));
}
}
......@@ -138,7 +138,7 @@ export class SedaService {
x.Cardinality !== CardinalityConstants.Obligatoire.valueOf())
||
(fileNodesNames.includes(x.Name) &&
(x.Cardinality === CardinalityConstants['Zero or More'].valueOf())
(x.Cardinality === CardinalityConstants['Zero or More'].valueOf() || x.Cardinality === CardinalityConstants["One Or More"].valueOf())
));
return allowedSelectableList;
}
......
......@@ -222,9 +222,9 @@
</mat-checkbox>
<!-- @Supprimer-->
<mat-divider *ngIf="!isSedaObligatory(element.nomDuChamp)" style="border-top-color:#E0E0E0;">
<mat-divider *ngIf="isDeltable(element.nomDuChamp)" style="border-top-color:#E0E0E0;">
</mat-divider>
<button (click)="onDeleteNode(element.id)" *ngIf="!isSedaObligatory(element.nomDuChamp)" mat-menu-item>
<button (click)="onDeleteNode(element.id)" *ngIf="isDeltable(element.nomDuChamp)" mat-menu-item>
<mat-icon style="color:#757575">delete</mat-icon>
<span class="text normal">{{'PROFILE.EDIT_PROFILE.FILE_TREE_METADATA.SUPPRIMER' | translate}}</span>
</button>
......
......@@ -787,10 +787,13 @@ export class FileTreeMetadataComponent {
}
isSedaObligatory(name: string): boolean {
return this.sedaService.isSedaNodeObligatory(name, this.selectedSedaNode);
isDeltable(name: string): boolean {
const node = this.fileService.getFileNodeByName(this.clickedNode, name);
return ((node.parent.children.filter(child => child.name === name).length > 1 && this.sedaService.isSedaNodeObligatory(name, this.selectedSedaNode))
|| !this.sedaService.isSedaNodeObligatory(name, this.selectedSedaNode));
}
getSedaDefinition(elementName: string) {
const node = this.getSedaNode(elementName);
if (node != null) {
......
......@@ -167,10 +167,10 @@ export class FileTreeMetadataService {
if (sedaNode.Name === fileNode.name) {
allowedCardinalityListResult = this.allowedCardinality.get(sedaNode.Cardinality);
}
if (sedaNode.Children.length > 0) {
if (sedaNode.Children.length > 0 ) {
// Search the sedaNode children to find the correnpondent cardinality list
for (const child of sedaNode.Children) {
if ((child.Name === fileNode.name) || (sedaNode.Name === fileNode.name)) {
if ((child.Name === fileNode.name) ) {
// Used in the case we wish to "correct" the node's cardinality, since
// the seda cardinality wont include the cardinality retrieved by node's rng file.
// In this case, the condition will return the rng file cardinality list
......
......@@ -42,11 +42,11 @@ import { FileService } from '../../core/services/file.service';
import { PopupService } from '../../core/services/popup.service';
import { ProfileService } from '../../core/services/profile.service';
import { SedaService } from '../../core/services/seda.service';
import { FileNode } from '../../models/file-node';
import { SedaCardinalityConstants, SedaData, SedaElementConstants } from '../../models/seda-data';
import { PastisDialogData } from '../../shared/pastis-dialog/classes/pastis-dialog-data';
import { PastisDialogConfirmComponent } from '../../shared/pastis-dialog/pastis-dialog-confirm/pastis-dialog-confirm.component';
import { PastisPopupMetadataLanguageService } from '../../shared/pastis-popup-metadata-language/pastis-popup-metadata-language.service';
import {FileNode} from "../../models/file-node";
@Component({
selector: 'pastis-user-action-add-metadata',
......@@ -150,7 +150,7 @@ export class UserActionAddMetadataComponent implements OnInit {
onAddSelectedElement(element: SedaData) {
this.addedItems.push(element);
if (element.Cardinality !== (SedaCardinalityConstants.zeroOrMore || SedaCardinalityConstants.oreOrMore)) {
if (element.Cardinality.endsWith("1")) {
this.allowedChildren = this.allowedChildren.filter(e => e != element);
}
this.addedItems.length > 0 ? this.atLeastOneIsSelected = true : this.atLeastOneIsSelected = false;
......
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