add description template type code and fallback description template import

This commit is contained in:
amentis 2024-07-24 17:59:33 +03:00
parent 3987620244
commit 3d3ae7e040
28 changed files with 285 additions and 45 deletions

View File

@ -2,6 +2,7 @@ package org.opencdmp.commons.types.descriptiontemplate.importexport;
import jakarta.xml.bind.annotation.*;
import org.opencdmp.commons.types.descriptiontemplatetype.DescriptionTemplateTypeImportExport;
import java.util.ArrayList;
import java.util.List;
@ -18,7 +19,7 @@ public class DescriptionTemplateImportExport {
@XmlElement(name = "language")
private String language;
@XmlElement(name = "type")
private UUID type;
private DescriptionTemplateTypeImportExport descriptionTemplateType;
@XmlElement(name = "version")
private Short version;
@XmlElement(name = "groupId")
@ -62,12 +63,12 @@ public class DescriptionTemplateImportExport {
}
public UUID getType() {
return this.type;
public DescriptionTemplateTypeImportExport getDescriptionTemplateType() {
return descriptionTemplateType;
}
public void setType(UUID type) {
this.type = type;
public void setDescriptionTemplateType(DescriptionTemplateTypeImportExport descriptionTemplateType) {
this.descriptionTemplateType = descriptionTemplateType;
}
public Short getVersion() {

View File

@ -0,0 +1,42 @@
package org.opencdmp.commons.types.descriptiontemplatetype;
import jakarta.xml.bind.annotation.*;
import java.util.UUID;
@XmlRootElement(name = "descriptionTemplateType")
@XmlAccessorType(XmlAccessType.FIELD)
public class DescriptionTemplateTypeImportExport {
@XmlElement(name = "id")
private UUID id;
@XmlElement(name = "code")
private String code;
@XmlElement(name = "name")
private String name;
public UUID getId() {
return id;
}
public void setId(UUID id) {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

View File

@ -20,9 +20,14 @@ public class DescriptionTemplateTypeEntity extends TenantScopedBaseEntity {
public static final String _id = "id";
@Column(name = "code", length = _codeLength, nullable = false)
private String code;
public final static String _code = "code";
public final static int _codeLength = 200;
@Column(name = "name", length = DescriptionTemplateTypeEntity._nameLength, nullable = false)
private String name;
public static final int _nameLength = 500;
public static final int _nameLength = 250;
public static final String _name = "name";
@ -56,6 +61,14 @@ public class DescriptionTemplateTypeEntity extends TenantScopedBaseEntity {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}

View File

@ -408,4 +408,14 @@ public class ErrorThesaurusProperties {
public void setUsageLimitMetricAlreadyExists(ErrorDescription usageLimitMetricAlreadyExists) {
this.usageLimitMetricAlreadyExists = usageLimitMetricAlreadyExists;
}
private ErrorDescription descriptionTemplateTypeCodeExists;
public ErrorDescription getDescriptionTemplateTypeCodeExists() {
return descriptionTemplateTypeCodeExists;
}
public void setDescriptionTemplateTypeCodeExists(ErrorDescription descriptionTemplateTypeCodeExists) {
this.descriptionTemplateTypeCodeExists = descriptionTemplateTypeCodeExists;
}
}

View File

@ -12,6 +12,9 @@ public class DescriptionTemplateType {
public final static String _id = "id";
private UUID id;
public final static String _code = "code";
private String code;
public final static String _name = "name";
private String name;
@ -44,6 +47,14 @@ public class DescriptionTemplateType {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}

View File

@ -48,6 +48,8 @@ public class DescriptionTemplateTypeBuilder extends BaseBuilder<DescriptionTempl
DescriptionTemplateType m = new DescriptionTemplateType();
if (fields.hasField(this.asIndexer(DescriptionTemplateType._id)))
m.setId(d.getId());
if (fields.hasField(this.asIndexer(DescriptionTemplateType._code)))
m.setCode(d.getCode());
if (fields.hasField(this.asIndexer(DescriptionTemplateType._name)))
m.setName(d.getName());
if (fields.hasField(this.asIndexer(DescriptionTemplateType._createdAt)))

View File

@ -24,6 +24,10 @@ public class DescriptionTemplateTypePersist {
public final static String _id = "id";
private String code;
public static final String _code = "code";
private String name = null;
public final static String _name = "name";
@ -44,6 +48,14 @@ public class DescriptionTemplateTypePersist {
this.id = id;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
@ -102,8 +114,15 @@ public class DescriptionTemplateTypePersist {
this.spec()
.iff(() -> !this.isEmpty(item.getName()))
.must(() -> this.lessEqualLength(item.getName(), DescriptionTemplateTypeEntity._nameLength))
.failOn(DescriptionTemplateTypePersist._name).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplateTypePersist._name}, LocaleContextHolder.getLocale()))
);
.failOn(DescriptionTemplateTypePersist._name).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplateTypePersist._name}, LocaleContextHolder.getLocale())),
this.spec()
.must(() -> !this.isEmpty(item.getCode()))
.failOn(DescriptionTemplateTypePersist._code).failWith(messageSource.getMessage("Validation_Required", new Object[]{DescriptionTemplateTypePersist._code}, LocaleContextHolder.getLocale())),
this.spec()
.iff(() -> !this.isEmpty(item.getCode()))
.must(() -> this.lessEqualLength(item.getCode(), DescriptionTemplateTypeEntity._codeLength))
.failOn(DescriptionTemplateTypePersist._code).failWith(messageSource.getMessage("Validation_MaxLength", new Object[]{DescriptionTemplateTypePersist._code}, LocaleContextHolder.getLocale()))
);
}
}

View File

@ -33,6 +33,8 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
private Collection<DescriptionTemplateTypeStatus> statuses;
private Collection<String> codes;
private Collection<UUID> excludedIds;
private EnumSet<AuthorizationFlags> authorize = EnumSet.of(AuthorizationFlags.None);
@ -87,6 +89,21 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
return this;
}
public DescriptionTemplateTypeQuery codes(String value) {
this.codes = List.of(value);
return this;
}
public DescriptionTemplateTypeQuery codes(String... value) {
this.codes = Arrays.asList(value);
return this;
}
public DescriptionTemplateTypeQuery codes(Collection<String> values) {
this.codes = values;
return this;
}
public DescriptionTemplateTypeQuery excludedIds(Collection<UUID> values) {
this.excludedIds = values;
return this;
@ -150,7 +167,9 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
predicates.add(inClause);
}
if (this.like != null && !this.like.isBlank()) {
predicates.add(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateTypeEntity._name), this.like));
predicates.add(queryContext.CriteriaBuilder.or(this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateTypeEntity._code), this.like),
this.queryUtilsService.ilike(queryContext.CriteriaBuilder, queryContext.Root.get(DescriptionTemplateTypeEntity._name), this.like)
));
}
if (this.isActives != null) {
CriteriaBuilder.In<IsActive> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._isActive));
@ -165,6 +184,12 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
inClause.value(item);
predicates.add(inClause);
}
if (this.codes != null) {
CriteriaBuilder.In<String> inClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._code));
for (String item : this.codes)
inClause.value(item);
predicates.add(inClause);
}
if (this.excludedIds != null) {
CriteriaBuilder.In<UUID> notInClause = queryContext.CriteriaBuilder.in(queryContext.Root.get(DescriptionTemplateTypeEntity._id));
for (UUID item : this.excludedIds)
@ -184,6 +209,7 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
DescriptionTemplateTypeEntity item = new DescriptionTemplateTypeEntity();
item.setId(QueryBase.convertSafe(tuple, columns, DescriptionTemplateTypeEntity._id, UUID.class));
item.setTenantId(QueryBase.convertSafe(tuple, columns, DescriptionTemplateTypeEntity._tenantId, UUID.class));
item.setCode(QueryBase.convertSafe(tuple, columns, DescriptionTemplateTypeEntity._code, String.class));
item.setName(QueryBase.convertSafe(tuple, columns, DescriptionTemplateTypeEntity._name, String.class));
item.setCreatedAt(QueryBase.convertSafe(tuple, columns, DescriptionTemplateTypeEntity._createdAt, Instant.class));
item.setUpdatedAt(QueryBase.convertSafe(tuple, columns, DescriptionTemplateTypeEntity._updatedAt, Instant.class));
@ -195,6 +221,7 @@ public class DescriptionTemplateTypeQuery extends QueryBase<DescriptionTemplateT
@Override
protected String fieldNameOf(FieldResolver item) {
if (item.match(DescriptionTemplateType._id)) return DescriptionTemplateTypeEntity._id;
else if (item.match(DescriptionTemplateType._code)) return DescriptionTemplateTypeEntity._code;
else if (item.match(DescriptionTemplateType._name)) return DescriptionTemplateTypeEntity._name;
else if (item.match(DescriptionTemplateType._createdAt)) return DescriptionTemplateTypeEntity._createdAt;
else if (item.match(DescriptionTemplateType._updatedAt)) return DescriptionTemplateTypeEntity._updatedAt;

View File

@ -32,14 +32,12 @@ import org.opencdmp.commons.scope.user.UserScope;
import org.opencdmp.commons.types.descriptiontemplate.*;
import org.opencdmp.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
import org.opencdmp.commons.types.descriptiontemplate.importexport.*;
import org.opencdmp.commons.types.descriptiontemplatetype.DescriptionTemplateTypeImportExport;
import org.opencdmp.commons.types.notification.DataType;
import org.opencdmp.commons.types.notification.FieldInfo;
import org.opencdmp.commons.types.notification.NotificationFieldData;
import org.opencdmp.convention.ConventionService;
import org.opencdmp.data.DescriptionTemplateEntity;
import org.opencdmp.data.TenantEntityManager;
import org.opencdmp.data.UserDescriptionTemplateEntity;
import org.opencdmp.data.UserEntity;
import org.opencdmp.data.*;
import org.opencdmp.errorcode.ErrorThesaurusProperties;
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEvent;
import org.opencdmp.integrationevent.outbox.notification.NotifyIntegrationEventHandler;
@ -57,6 +55,7 @@ import org.opencdmp.model.persist.descriptiontemplatedefinition.fielddata.BaseFi
import org.opencdmp.model.user.User;
import org.opencdmp.query.DescriptionTemplateQuery;
import org.opencdmp.query.DescriptionTemplateTypeQuery;
import org.opencdmp.query.ReferenceTypeQuery;
import org.opencdmp.query.UserDescriptionTemplateQuery;
import org.opencdmp.service.accounting.AccountingService;
import org.opencdmp.service.descriptiontemplatetype.DescriptionTemplateTypeService;
@ -731,7 +730,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
persist.setStatus(DescriptionTemplateStatus.Draft);
persist.setDescription(importXml.getDescription());
persist.setLanguage(importXml.getLanguage());
persist.setType(importXml.getType());
persist.setType(this.xmlDescriptionTemplateTypeToPersist(importXml.getDescriptionTemplateType()));
persist.setDefinition(this.xmlDefinitionToPersist(importXml));
this.validatorFactory.validator(DescriptionTemplatePersist.DescriptionTemplatePersistValidator.class).validateForce(persist);
return this.persist(persist, groupId, fields);
@ -751,7 +750,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
persist.setDescription(importXml.getDescription());
persist.setLanguage(importXml.getLanguage());
persist.setDefinition(this.xmlDefinitionToPersist(importXml));
persist.setType(importXml.getType());
persist.setType(this.xmlDescriptionTemplateTypeToPersist(importXml.getDescriptionTemplateType()));
persist.setHash(this.conventionService.hashValue(latestVersionDescriptionTemplate.getUpdatedAt()));
this.validatorFactory.validator(NewVersionDescriptionTemplatePersist.NewVersionDescriptionTemplatePersistValidator.class).validateForce(persist);
@ -760,6 +759,30 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
}
}
private UUID xmlDescriptionTemplateTypeToPersist(DescriptionTemplateTypeImportExport importXml) {
if (importXml == null) return null;
DescriptionTemplateTypeQuery query = null;
if (importXml.getId() != null) {
// search by id
query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).ids(importXml.getId());
if (query != null && query.count() > 0 ) {
return query.firstAs(new BaseFieldSet().ensure(DescriptionTemplate._id)).getId();
} else {
if (!this.conventionService.isNullOrEmpty(importXml.getCode())){
// search by code
query = this.queryFactory.query(DescriptionTemplateTypeQuery.class).codes(importXml.getCode());
if (query != null && query.count() > 0) {
return query.firstAs(new BaseFieldSet().ensure(DescriptionTemplate._id)).getId();
}
}
}
}
return null;
}
@Override
public DescriptionTemplate importXml(byte[] bytes, UUID groupId, String label, FieldSet fields) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, TransformerException, InvalidApplicationException, IOException, InstantiationException, IllegalAccessException, SAXException {
logger.debug(new MapLogEntry("import data").And("bytes", bytes).And("fields", fields));
@ -907,7 +930,7 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
//region Export
@Override
public DescriptionTemplateImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException {
public DescriptionTemplateImportExport exportXmlEntity(UUID id, boolean ignoreAuthorize) throws MyForbiddenException, MyNotFoundException, JAXBException, ParserConfigurationException, IOException, InstantiationException, IllegalAccessException, SAXException, InvalidApplicationException {
logger.debug(new MapLogEntry("exportXml").And("id", id));
if (!ignoreAuthorize) this.authorizationService.authorizeAtLeastOneForce(List.of(this.authorizationContentResolver.descriptionTemplateAffiliation(id)), Permission.ExportDescriptionTemplate);
@ -933,11 +956,10 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return this.responseUtilsService.buildResponseFileFromText(xml, data.getLabel() + ".xml");
}
private DescriptionTemplateImportExport definitionXmlToExport(DescriptionTemplateEntity data, DefinitionEntity entity) {
private DescriptionTemplateImportExport definitionXmlToExport(DescriptionTemplateEntity data, DefinitionEntity entity) throws InvalidApplicationException {
DescriptionTemplateImportExport xml = new DescriptionTemplateImportExport();
xml.setId(data.getId());
xml.setType(data.getTypeId());
xml.setType(data.getTypeId());
xml.setDescriptionTemplateType(this.descriptionTemplateTypeXmlToExport(data.getTypeId()));
xml.setLanguage(data.getLanguage());
xml.setDescription(data.getDescription());
xml.setGroupId(data.getGroupId());
@ -952,6 +974,22 @@ public class DescriptionTemplateServiceImpl implements DescriptionTemplateServic
return xml;
}
private DescriptionTemplateTypeImportExport descriptionTemplateTypeXmlToExport(UUID typeId) throws InvalidApplicationException {
DescriptionTemplateTypeImportExport xml = new DescriptionTemplateTypeImportExport();
if (typeId == null) return xml;
DescriptionTemplateTypeEntity data = this.entityManager.find(DescriptionTemplateTypeEntity.class, typeId);
if (data == null)
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{typeId, DescriptionTemplateType.class.getSimpleName()}, LocaleContextHolder.getLocale()));
xml.setId(typeId);
xml.setName(data.getName());
xml.setCode(data.getCode());
return xml;
}
private DescriptionTemplatePageImportExport pageXmlToExport(PageEntity entity) {
DescriptionTemplatePageImportExport xml = new DescriptionTemplatePageImportExport();
xml.setId(entity.getId());

View File

@ -3,6 +3,7 @@ package org.opencdmp.service.descriptiontemplatetype;
import gr.cite.commons.web.authz.service.AuthorizationService;
import gr.cite.tools.data.builder.BuilderFactory;
import gr.cite.tools.data.deleter.DeleterFactory;
import gr.cite.tools.data.query.QueryFactory;
import gr.cite.tools.exception.MyApplicationException;
import gr.cite.tools.exception.MyForbiddenException;
import gr.cite.tools.exception.MyNotFoundException;
@ -25,6 +26,7 @@ import org.opencdmp.model.DescriptionTemplateType;
import org.opencdmp.model.builder.DescriptionTemplateTypeBuilder;
import org.opencdmp.model.deleter.DescriptionTemplateTypeDeleter;
import org.opencdmp.model.persist.DescriptionTemplateTypePersist;
import org.opencdmp.query.DescriptionTemplateTypeQuery;
import org.opencdmp.service.accounting.AccountingService;
import org.opencdmp.service.usagelimit.UsageLimitServiceImpl;
import org.slf4j.LoggerFactory;
@ -51,6 +53,8 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy
private final BuilderFactory builderFactory;
private final QueryFactory queryFactory;
private final ConventionService conventionService;
private final ErrorThesaurusProperties errors;
@ -69,6 +73,7 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy
AuthorizationService authorizationService,
DeleterFactory deleterFactory,
BuilderFactory builderFactory,
QueryFactory queryFactory,
ConventionService conventionService,
ErrorThesaurusProperties errors,
MessageSource messageSource,
@ -77,6 +82,7 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy
this.authorizationService = authorizationService;
this.deleterFactory = deleterFactory;
this.builderFactory = builderFactory;
this.queryFactory = queryFactory;
this.conventionService = conventionService;
this.errors = errors;
this.messageSource = messageSource;
@ -105,12 +111,18 @@ public class DescriptionTemplateTypeServiceImpl implements DescriptionTemplateTy
data.setCreatedAt(Instant.now());
}
data.setCode(model.getCode());
data.setName(model.getName());
data.setStatus(model.getStatus());
data.setUpdatedAt(Instant.now());
if (isUpdate)
Long descriptionTemplateTypeCodes = this.queryFactory.query(DescriptionTemplateTypeQuery.class).disableTracking().codes(model.getCode()).isActive(IsActive.Active).count();
if (isUpdate) {
if (descriptionTemplateTypeCodes > 1) throw new MyValidationException(this.errors.getDescriptionTemplateTypeCodeExists().getCode(), this.errors.getDescriptionTemplateTypeCodeExists().getMessage());
this.entityManager.merge(data);
else{
} else {
if (descriptionTemplateTypeCodes > 0) throw new MyValidationException(this.errors.getDescriptionTemplateTypeCodeExists().getCode(), this.errors.getDescriptionTemplateTypeCodeExists().getMessage());
this.entityManager.persist(data);
this.accountingService.increase(UsageLimitTargetMetric.DESCRIPTION_TEMPLATE_TYPE_COUNT.getValue());
}

View File

@ -127,4 +127,7 @@ error-thesaurus:
message: Usage limit exception for this target metric
usageLimitMetricAlreadyExists:
code: 146
message: Usage limit metric is already selected as target
message: Usage limit metric is already selected as target
descriptionTemplateTypeCodeExists:
code: 147
message: Description template type code exists

View File

@ -42,6 +42,7 @@ export enum ResponseErrorCode {
MaxDescriptionsExceeded = 144,
UsageLimitException = 145,
UsageLimitMetricAlreadyExists = 146,
DescriptionTemplateTypeCodeExists = 147,
// Notification & Annotation Errors
InvalidApiKey = 200,
@ -160,6 +161,8 @@ export class ResponseErrorCodeHelper {
return language.instant("GENERAL.BACKEND-ERRORS.USAGE-LIMIT-EXCEPTION");
case ResponseErrorCode.UsageLimitMetricAlreadyExists:
return language.instant("GENERAL.BACKEND-ERRORS.USAGE-LIMIT-METRIC-ALLREADY-EXISTS");
case ResponseErrorCode.DescriptionTemplateTypeCodeExists:
return language.instant("GENERAL.BACKEND-ERRORS.DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS");
default:
return language.instant("GENERAL.SNACK-BAR.NOT-FOUND");
}

View File

@ -3,10 +3,12 @@ import { BaseEntity, BaseEntityPersist } from "@common/base/base-entity.model";
export interface DescriptionTemplateType extends BaseEntity {
name: string;
code: string;
status: DescriptionTemplateTypeStatus;
}
export interface DescriptionTemplateTypePersist extends BaseEntityPersist {
name: string;
code: string;
status: DescriptionTemplateTypeStatus;
}

View File

@ -55,6 +55,18 @@
<mat-error *ngIf="formGroup.get('name').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
<div class="col-12 pt-1 pb-1">
<span>
{{'DESCRIPTION-TEMPLATE-TYPE-EDITOR.FIELDS.CODE' | translate}}
</span>
</div>
<div class="col-12">
<mat-form-field class="w-100">
<input matInput placeholder="{{'DESCRIPTION-TEMPLATE-TYPE-EDITOR.FIELDS.CODE' | translate}}" type="text" name="code" [formControl]="formGroup.get('code')" required>
<mat-error *ngIf="formGroup.get('code').hasError('backendError')">{{formGroup.get('code').getError('backendError').message}}</mat-error>
<mat-error *ngIf="formGroup.get('code').hasError('required')">{{'GENERAL.VALIDATION.REQUIRED' | translate}}</mat-error>
</mat-form-field>
</div>
</div>
</div>
</div>

View File

@ -8,6 +8,7 @@ import { Validation, ValidationContext } from '@common/forms/validation/validati
export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implements DescriptionTemplateTypePersist {
name: string;
code: string;
status: DescriptionTemplateTypeStatus = DescriptionTemplateTypeStatus.Draft;
permissions: string[];
@ -21,6 +22,7 @@ export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implemen
super.fromModel(item);
this.id = item.id;
this.name = item.name;
this.code = item.code;
this.status = item.status;
this.isActive = item.isActive;
this.hash = item.hash;
@ -36,6 +38,7 @@ export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implemen
return this.formBuilder.group({
id: [{ value: this.id, disabled: disabled }, context.getValidation('id').validators],
name: [{ value: this.name, disabled: disabled }, context.getValidation('name').validators],
code: [{ value: this.code, disabled: disabled }, context.getValidation('code').validators],
status: [{ value: this.status, disabled: disabled }, context.getValidation('status').validators],
hash: [{ value: this.hash, disabled: disabled }, context.getValidation('hash').validators]
});
@ -46,6 +49,7 @@ export class DescriptionTemplateTypeEditorModel extends BaseEditorModel implemen
const baseValidationArray: Validation[] = new Array<Validation>();
baseValidationArray.push({ key: 'id', validators: [BackendErrorValidator(this.validationErrorModel, 'id')] });
baseValidationArray.push({ key: 'name', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'name')] });
baseValidationArray.push({ key: 'code', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'code')] });
baseValidationArray.push({ key: 'status', validators: [Validators.required, BackendErrorValidator(this.validationErrorModel, 'status')] });
baseValidationArray.push({ key: 'hash', validators: [] });

View File

@ -21,6 +21,7 @@ export class DescriptionTemplateTypeEditorResolver extends BaseEditorResolver {
...BaseEditorResolver.lookupFields(),
nameof<DescriptionTemplateType>(x => x.id),
nameof<DescriptionTemplateType>(x => x.name),
nameof<DescriptionTemplateType>(x => x.code),
nameof<DescriptionTemplateType>(x => x.status),
nameof<DescriptionTemplateType>(x => x.createdAt),
nameof<DescriptionTemplateType>(x => x.hash),

View File

@ -42,6 +42,7 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen
private readonly lookupFields: string[] = [
nameof<DescriptionTemplateType>(x => x.id),
nameof<DescriptionTemplateType>(x => x.name),
nameof<DescriptionTemplateType>(x => x.code),
nameof<DescriptionTemplateType>(x => x.status),
nameof<DescriptionTemplateType>(x => x.updatedAt),
nameof<DescriptionTemplateType>(x => x.createdAt),
@ -96,7 +97,13 @@ export class DescriptionTemplateTypeListingComponent extends BaseListingComponen
prop: nameof<DescriptionTemplateType>(x => x.name),
sortable: true,
languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.NAME'
}, {
},
{
prop: nameof<DescriptionTemplateType>(x => x.code),
sortable: true,
languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.CODE',
},
{
prop: nameof<DescriptionTemplateType>(x => x.status),
sortable: true,
languageName: 'DESCRIPTION-TEMPLATE-TYPE-LISTING.FIELDS.STATUS',

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Kontuz!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Warnung!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Warning!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Atención!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Προσοχή!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Oprez!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Ostrzeżenie!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Atenção!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Upozornenie!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Oprez!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",

View File

@ -81,7 +81,8 @@
"REQUEST-HAS-EXPIRED": "Request has expired",
"MAX-DESCRIPTION-EXCEEDED": "This plan has reached the maximun descriptions for this description template",
"USAGE-LIMIT-EXCEPTION": "Υou have exceeded the {{usageLimitLabel}} usage limit. Please contact your administrator.",
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant."
"USAGE-LIMIT-METRIC-ALLREADY-EXISTS": "This usage limit metric is already defined in this tenant. Change metric or select other tenant.",
"DESCRIPTION-TEMPLATE-TYPE-CODE-EXISTS": "The description template type code you provided already exists. Please choose a different code."
},
"FORM-VALIDATION-DISPLAY-DIALOG": {
"WARNING": "Uyarı!",
@ -1086,6 +1087,7 @@
"CREATE-TYPE": "Create Description Type",
"FIELDS": {
"NAME": "Name",
"CODE": "Code",
"STATUS": "Status",
"UPDATED-AT": "Updated",
"CREATED-AT": "Created",
@ -1466,7 +1468,8 @@
"DESCRIPTION-TEMPLATE-TYPE-EDITOR": {
"TITLE-EDIT-DESCRIPTION-TEMPLATE-TYPE": "Editing Description Template Type",
"FIELDS": {
"NAME": "Name"
"NAME": "Name",
"CODE": "Code"
},
"ACTIONS": {
"SAVE": "Save",