aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java8
-rw-r--r--catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java2
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java3
-rw-r--r--catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java4
-rw-r--r--catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java7
-rw-r--r--catalog-ui/src/app/models/data-types.ts2
-rw-r--r--catalog-ui/src/app/ng2/pages/type-workspace/type-workspace.component.html2
-rw-r--r--common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java2
8 files changed, 23 insertions, 7 deletions
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java
index d488c65b22..3ebd0bee5b 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/components/impl/DataTypeImportManager.java
@@ -66,7 +66,7 @@ public class DataTypeImportManager {
public Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat> createDataTypes(final String dataTypeYml, final String modelName,
final boolean includeToModelDefaultImports) {
final Either<List<ImmutablePair<DataTypeDefinition, Boolean>>, ResponseFormat> elementTypes = commonImportManager.createElementTypes(
- dataTypeYml, dataTypesFromYml -> createDataTypesFromYml(dataTypeYml, modelName), this::createDataTypesByDao, ElementTypeEnum.DATA_TYPE);
+ dataTypeYml, dataTypesFromYml -> createDataTypesFromYml(dataTypeYml, modelName, !includeToModelDefaultImports), this::createDataTypesByDao, ElementTypeEnum.DATA_TYPE);
if (includeToModelDefaultImports && StringUtils.isNotEmpty(modelName)) {
commonImportManager.addTypesToDefaultImports(ElementTypeEnum.DATA_TYPE, dataTypeYml, modelName);
@@ -77,7 +77,7 @@ public class DataTypeImportManager {
return elementTypes;
}
- private Either<List<DataTypeDefinition>, ActionStatus> createDataTypesFromYml(final String dataTypesYml, final String modelName) {
+ private Either<List<DataTypeDefinition>, ActionStatus> createDataTypesFromYml(final String dataTypesYml, final String modelName, final boolean normative) {
final Either<List<DataTypeDefinition>, ActionStatus> dataTypesEither = commonImportManager.createElementTypesFromYml(dataTypesYml,
this::createDataType);
if (dataTypesEither.isRight()) {
@@ -87,10 +87,12 @@ public class DataTypeImportManager {
if (StringUtils.isNotEmpty(modelName)) {
final Optional<Model> modelOptional = modelOperation.findModelByName(modelName);
if (modelOptional.isPresent()) {
- dataTypes.forEach(dataType -> dataType.setModel(modelName));
+ dataTypes.forEach(dataType -> {dataType.setModel(modelName); dataType.setNormative(normative);});
} else {
return Either.right(ActionStatus.INVALID_MODEL);
}
+ } else {
+ dataTypes.forEach(dataType -> dataType.setNormative(normative));
}
if (log.isTraceEnabled()) {
log.trace("Unsorted datatypes order:");
diff --git a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java
index f07a742ab5..786c0338c4 100644
--- a/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java
+++ b/catalog-be/src/main/java/org/openecomp/sdc/be/servlets/TypesUploadServlet.java
@@ -228,7 +228,7 @@ public class TypesUploadServlet extends AbstractValidationsServlet {
public Response uploadDataTypes(@Parameter(description = "FileInputStream") @FormDataParam("dataTypesZip") File file,
@Context final HttpServletRequest request, @HeaderParam("USER_ID") String creator,
@Parameter(description = "model") @FormDataParam("model") String modelName,
- @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) {
+ @Parameter(description = "includeToModelImport") @FormDataParam("includeToModelImport") boolean includeToModelDefaultImports) {
return uploadElementTypeServletLogic(this::createDataTypes, file, request, creator, NodeTypeEnum.DataType.getName(), modelName,
includeToModelDefaultImports);
}
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java
index 15fc013173..5a287c9261 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/dao/neo4j/GraphPropertiesDictionary.java
@@ -160,7 +160,8 @@ public enum GraphPropertiesDictionary {
CUSTOMIZATION_UUID ("customizationUUID", String.class, false, false),
IS_ARCHIVED ("isArchived", Boolean.class, false, true),
IS_VSP_ARCHIVED ("isVspArchived", Boolean.class, false, true),
- ARCHIVE_TIME ("archiveTime", Long.class, false, true);
+ NORMATIVE ("normative", Boolean.class, false, false),
+ ARCHIVE_TIME ("archiveTime", Long.class, false, true);
// @formatter:on
private final String property;
diff --git a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java
index e482fb55b6..bf13331dd1 100644
--- a/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java
+++ b/catalog-dao/src/main/java/org/openecomp/sdc/be/resources/data/DataTypeData.java
@@ -50,6 +50,9 @@ public class DataTypeData extends GraphNode {
dataTypeDataDefinition.setCreationTime((Long) properties.get(GraphPropertiesDictionary.CREATION_DATE.getProperty()));
dataTypeDataDefinition.setModificationTime((Long) properties.get(GraphPropertiesDictionary.LAST_UPDATE_DATE.getProperty()));
dataTypeDataDefinition.setModel((String) properties.get(GraphPropertiesDictionary.MODEL.getProperty()));
+ final Object normativeProperty = properties.get(GraphPropertiesDictionary.NORMATIVE.getProperty());
+ final boolean normative = normativeProperty != null && (boolean) normativeProperty;
+ dataTypeDataDefinition.setNormative(normative);
}
@Override
@@ -62,6 +65,7 @@ public class DataTypeData extends GraphNode {
addIfExists(map, GraphPropertiesDictionary.CREATION_DATE, dataTypeDataDefinition.getCreationTime());
addIfExists(map, GraphPropertiesDictionary.LAST_UPDATE_DATE, dataTypeDataDefinition.getModificationTime());
addIfExists(map, GraphPropertiesDictionary.MODEL, dataTypeDataDefinition.getModel());
+ addIfExists(map, GraphPropertiesDictionary.NORMATIVE, dataTypeDataDefinition.isNormative());
return map;
}
diff --git a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
index 9dc28cb2b4..f6bcf1bc8e 100644
--- a/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
+++ b/catalog-model/src/main/java/org/openecomp/sdc/be/model/operations/impl/PropertyOperation.java
@@ -1268,9 +1268,14 @@ public class PropertyOperation extends AbstractOperation implements IPropertyOpe
return Either.right(operationStatus);
}
propertiesData.put(propertyName, addPropertyToNodeType.left().value());
- }
+ }
DataTypeData dataTypeData = new DataTypeData();
+ Either<DataTypeDefinition, StorageOperationStatus> existingNode = getDataTypeByUidWithoutDerived(uniqueId, true);
+ if (existingNode.isLeft()) {
+ dataTypeData.getDataTypeDataDefinition().setNormative(existingNode.left().value().isNormative());
+ }
dataTypeData.getDataTypeDataDefinition().setUniqueId(uniqueId);
+
long modificationTime = System.currentTimeMillis();
dataTypeData.getDataTypeDataDefinition().setModificationTime(modificationTime);
Either<DataTypeData, JanusGraphOperationStatus> updateNode = janusGraphGenericDao.updateNode(dataTypeData, DataTypeData.class);
diff --git a/catalog-ui/src/app/models/data-types.ts b/catalog-ui/src/app/models/data-types.ts
index 3b0833b5b4..dfba68e67e 100644
--- a/catalog-ui/src/app/models/data-types.ts
+++ b/catalog-ui/src/app/models/data-types.ts
@@ -39,6 +39,7 @@ export class DataTypeModel {
properties: Array<PropertyBEModel>;
attributes: Array<AttributeBEModel>;
model: Model;
+ normative: boolean;
constructor(dataType?: DataTypeModel) {
if (!dataType) {
@@ -62,6 +63,7 @@ export class DataTypeModel {
}
this.attributes = dataType.attributes;
this.model = dataType.model;
+ this.normative = dataType.normative;
}
public toJSON = ():any => {
diff --git a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace.component.html b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace.component.html
index 61516278da..105c89d7a4 100644
--- a/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace.component.html
+++ b/catalog-ui/src/app/ng2/pages/type-workspace/type-workspace.component.html
@@ -44,7 +44,7 @@
</div>
<div class="w-sdc-main-container-body-content" *ngIf="dataType">
<app-type-workspace-general *ngIf="currentMenu.state === 'general'" [dataType]="dataType"></app-type-workspace-general>
- <app-type-workspace-properties *ngIf="currentMenu.state === 'properties'" [dataType]="dataType" [isViewOnly]="false"></app-type-workspace-properties>
+ <app-type-workspace-properties *ngIf="currentMenu.state === 'properties'" [dataType]="dataType" [isViewOnly]="dataType.normative"></app-type-workspace-properties>
<app-type-workspace-tosca-artifact *ngIf="currentMenu.state === 'tosca_artifacts'" [dataType]="dataType"></app-type-workspace-tosca-artifact>
</div>
diff --git a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java
index 51f710ba04..bf200376bb 100644
--- a/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java
+++ b/common-be/src/main/java/org/openecomp/sdc/be/datatypes/elements/DataTypeDataDefinition.java
@@ -48,6 +48,7 @@ public class DataTypeDataDefinition extends ToscaDataDefinition {
*/
private Long modificationTime;
private List<PropertyDataDefinition> propertiesData;
+ private boolean normative;
public DataTypeDataDefinition(DataTypeDataDefinition p) {
this.name = p.name;
@@ -57,5 +58,6 @@ public class DataTypeDataDefinition extends ToscaDataDefinition {
this.creationTime = p.creationTime;
this.modificationTime = p.modificationTime;
this.model = p.model;
+ this.normative = p.normative;
}
}