minor fixes

This commit is contained in:
Diamantis Tziotzios 2024-04-16 18:20:43 +03:00
parent b7774759f6
commit 04da845f49
6 changed files with 34 additions and 22 deletions

View File

@ -216,7 +216,6 @@ public class ReferenceQuery extends QueryBase<ReferenceEntity> {
List<Predicate> predicates = new ArrayList<>(); List<Predicate> predicates = new ArrayList<>();
if (userId != null || usePublic) { if (userId != null || usePublic) {
predicates.add(queryContext.CriteriaBuilder.or( predicates.add(queryContext.CriteriaBuilder.or(
queryContext.CriteriaBuilder.isNull(queryContext.Root.get(ReferenceEntity._createdById)),
userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query userId != null ? queryContext.CriteriaBuilder.equal(queryContext.Root.get(ReferenceEntity._createdById), userId) : queryContext.CriteriaBuilder.or(), //Creates a false query
queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpReferenceEntity.class, UUID.class) queryContext.CriteriaBuilder.in(queryContext.Root.get(ReferenceEntity._id)).value(queryUtilsService.buildSubQuery(new BuildSubQueryInput<>(new BuildSubQueryInput.Builder<>(DmpReferenceEntity.class, UUID.class)
.query(queryContext.Query) .query(queryContext.Query)

View File

@ -216,7 +216,7 @@ public class ExternalFetcherServiceImpl implements ExternalFetcherService {
else if (!this.conventionService.isNullOrEmpty(apiSource.getFirstPage())) completedPath = completedPath.replace("{page}", apiSource.getFirstPage()); else if (!this.conventionService.isNullOrEmpty(apiSource.getFirstPage())) completedPath = completedPath.replace("{page}", apiSource.getFirstPage());
else completedPath = completedPath.replace("{page}", "1"); else completedPath = completedPath.replace("{page}", "1");
completedPath = completedPath.replace("{pageSize}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPageSize()) ? externalReferenceCriteria.getPageSize() : "60"); completedPath = completedPath.replace("{pageSize}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPageSize()) ? externalReferenceCriteria.getPageSize() : "50");
completedPath = completedPath.replace("{host}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getHost()) ? externalReferenceCriteria.getHost() : ""); completedPath = completedPath.replace("{host}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getHost()) ? externalReferenceCriteria.getHost() : "");
completedPath = completedPath.replace("{path}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPath()) ? externalReferenceCriteria.getPath() : ""); completedPath = completedPath.replace("{path}", !this.conventionService.isNullOrEmpty(externalReferenceCriteria.getPath()) ? externalReferenceCriteria.getPath() : "");

View File

@ -3,7 +3,7 @@ import { ReferenceType } from "../reference-type/reference-type";
import { ExternalFetcherSourceType } from "@app/core/common/enum/external-fetcher-source-type"; import { ExternalFetcherSourceType } from "@app/core/common/enum/external-fetcher-source-type";
import { Guid } from "@common/types/guid"; import { Guid } from "@common/types/guid";
export interface ExternalFetcherBaseSourceConfiguration extends ExternalFetcherApiSourceConfiguration, ExternalFetcherStaticOptionSourceConfiguration{ export interface ExternalFetcherBaseSourceConfiguration extends ExternalFetcherApiSourceConfiguration, ExternalFetcherStaticOptionSourceConfiguration {
type: ExternalFetcherSourceType; type: ExternalFetcherSourceType;
key: string; key: string;
label: string; label: string;
@ -11,7 +11,7 @@ export interface ExternalFetcherBaseSourceConfiguration extends ExternalFetcherA
referenceTypeDependencies?: ReferenceType[]; referenceTypeDependencies?: ReferenceType[];
} }
export interface ExternalFetcherApiSourceConfiguration{ export interface ExternalFetcherApiSourceConfiguration {
url: string; url: string;
results: ResultsConfiguration; results: ResultsConfiguration;
paginationPath: string; paginationPath: string;
@ -24,18 +24,18 @@ export interface ExternalFetcherApiSourceConfiguration{
queries?: QueryConfig[]; queries?: QueryConfig[];
} }
export interface ResultsConfiguration{ export interface ResultsConfiguration {
resultsArrayPath: string; resultsArrayPath: string;
fieldsMapping: ResultFieldsMappingConfiguration[]; fieldsMapping: ResultFieldsMappingConfiguration[];
} }
export interface ResultFieldsMappingConfiguration{ export interface ResultFieldsMappingConfiguration {
code: string; code: string;
responsePath: string; responsePath: string;
} }
export interface AuthenticationConfiguration{ export interface AuthenticationConfiguration {
enabled: boolean; enabled: boolean;
authUrl: string; authUrl: string;
authMethod: ExternalFetcherApiHTTPMethodType; authMethod: ExternalFetcherApiHTTPMethodType;
@ -44,13 +44,13 @@ export interface AuthenticationConfiguration{
type: string; type: string;
} }
export interface QueryConfig{ export interface QueryConfig {
name: string; name: string;
defaultValue: string; defaultValue: string;
cases: QueryCaseConfig[]; cases: QueryCaseConfig[];
} }
export interface QueryCaseConfig{ export interface QueryCaseConfig {
likePattern: string, likePattern: string,
separator: string; separator: string;
value: string; value: string;
@ -58,15 +58,15 @@ export interface QueryCaseConfig{
referenceTypeSourceKey: string referenceTypeSourceKey: string
} }
export interface ExternalFetcherStaticOptionSourceConfiguration{ export interface ExternalFetcherStaticOptionSourceConfiguration {
items: Static[]; items: Static[];
} }
export interface Static{ export interface Static {
options: StaticOption[]; options: StaticOption[];
} }
export interface StaticOption{ export interface StaticOption {
code: string; code: string;
value: string; value: string;
} }
@ -75,7 +75,7 @@ export interface StaticOption{
// Persist // Persist
// //
export interface ExternalFetcherBaseSourceConfigurationPersist extends ExternalFetcherApiSourceConfigurationPersist, ExternalFetcherStaticOptionSourceConfigurationPersist{ export interface ExternalFetcherBaseSourceConfigurationPersist extends ExternalFetcherApiSourceConfigurationPersist, ExternalFetcherStaticOptionSourceConfigurationPersist {
type: ExternalFetcherSourceType; type: ExternalFetcherSourceType;
key: string; key: string;
label: string; label: string;
@ -83,7 +83,7 @@ export interface ExternalFetcherBaseSourceConfigurationPersist extends ExternalF
referenceTypeDependencyIds?: Guid[]; referenceTypeDependencyIds?: Guid[];
} }
export interface ExternalFetcherApiSourceConfigurationPersist{ export interface ExternalFetcherApiSourceConfigurationPersist {
url: string; url: string;
results: ResultsConfigurationPersist; results: ResultsConfigurationPersist;
paginationPath: string; paginationPath: string;
@ -96,18 +96,18 @@ export interface ExternalFetcherApiSourceConfigurationPersist{
queries?: QueryConfigPersist[]; queries?: QueryConfigPersist[];
} }
export interface ResultsConfigurationPersist{ export interface ResultsConfigurationPersist {
resultsArrayPath: string; resultsArrayPath: string;
fieldsMapping: ResultFieldsMappingConfigurationPersist[]; fieldsMapping: ResultFieldsMappingConfigurationPersist[];
} }
export interface ResultFieldsMappingConfigurationPersist{ export interface ResultFieldsMappingConfigurationPersist {
code: string; code: string;
responsePath: string; responsePath: string;
} }
export interface AuthenticationConfigurationPersist{ export interface AuthenticationConfigurationPersist {
enabled: boolean; enabled: boolean;
authUrl: string; authUrl: string;
authMethod: ExternalFetcherApiHTTPMethodType; authMethod: ExternalFetcherApiHTTPMethodType;
@ -116,13 +116,13 @@ export interface AuthenticationConfigurationPersist{
type: string; type: string;
} }
export interface QueryConfigPersist{ export interface QueryConfigPersist {
name: string; name: string;
defaultValue: string; defaultValue: string;
cases: QueryCaseConfigPersist[]; cases: QueryCaseConfigPersist[];
} }
export interface QueryCaseConfigPersist{ export interface QueryCaseConfigPersist {
likePattern: string, likePattern: string,
separator: string; separator: string;
value: string; value: string;
@ -134,11 +134,11 @@ export interface ExternalFetcherStaticOptionSourceConfigurationPersist {
items: StaticPersist[]; items: StaticPersist[];
} }
export interface StaticPersist{ export interface StaticPersist {
options: StaticOptionPersist[]; options: StaticOptionPersist[];
} }
export interface StaticOptionPersist{ export interface StaticOptionPersist {
code: string; code: string;
value: string; value: string;
} }

View File

@ -1,10 +1,12 @@
import { Lookup } from "@common/model/lookup"; import { Lookup } from "@common/model/lookup";
import { Guid } from "@common/types/guid"; import { Guid } from "@common/types/guid";
import { Reference } from "../model/reference/reference";
export class ReferenceSearchLookup extends Lookup { export class ReferenceSearchLookup extends Lookup {
like: string; like: string;
typeId: Guid; typeId: Guid;
key: string; key: string;
dependencyReferences: Reference[];
constructor() { constructor() {
super(); super();
@ -16,6 +18,7 @@ export class ReferenceSearchDefinitionLookup extends Lookup {
like: string; like: string;
typeId: Guid; typeId: Guid;
key: string; key: string;
dependencyReferences: Reference[];
constructor() { constructor() {
super(); super();

View File

@ -584,7 +584,6 @@ export class DescriptionEditorComponent extends BaseEditor<DescriptionEditorMode
}, },
error => this.onCallbackError(error) error => this.onCallbackError(error)
); );
} }
calculateMultiplicityRejectedDmpDescriptionTemplates(section: DmpBlueprintDefinitionSection, descriptions: Description[]) : DmpDescriptionTemplate[]{ calculateMultiplicityRejectedDmpDescriptionTemplates(section: DmpBlueprintDefinitionSection, descriptions: Description[]) : DmpDescriptionTemplate[]{

View File

@ -28,6 +28,8 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
@Input() multiple: boolean = true; @Input() multiple: boolean = true;
@Input() hint: string; @Input() hint: string;
@Input() placeholder: string; @Input() placeholder: string;
@Input() dependencies: UntypedFormGroup = null;
multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration; multipleAutoCompleteSearchConfiguration: MultipleAutoCompleteConfiguration;
singleAutoCompleteSearchConfiguration: SingleAutoCompleteConfiguration; singleAutoCompleteSearchConfiguration: SingleAutoCompleteConfiguration;
@ -84,6 +86,15 @@ export class ReferenceFieldComponent extends BaseComponent implements OnInit {
}; };
lookup.typeId = typeId; lookup.typeId = typeId;
lookup.order = { items: [nameof<Reference>(x => x.label)] }; lookup.order = { items: [nameof<Reference>(x => x.label)] };
// const sourcesWithDependencies = this.referenceType.definition.sources.filter(x => x.referenceTypeDependencies);
// if (sourcesWithDependencies.length > 0) {
// Object.keys(this.dependencies.controls).forEach(controlName => {
// (this.dependencies.get(controlName).get('references').value as Reference[]).filter(x=> sourcesWithDependencies.some(y => y.referenceTypeDependencies) x.type.id == this.referenceType.id &&)
// });
// lookup.dependencyReferences = [];
// }
return lookup; return lookup;
} }
} }