Renames on 'datas'

This commit is contained in:
Thomas Georgios Giannos 2023-11-13 09:39:31 +02:00
parent 1cee5fb49f
commit ff35ad6aab
45 changed files with 156 additions and 156 deletions

View File

@ -35,34 +35,34 @@ public abstract class BaseBuilder<M, D> implements Builder {
return models.stream().findFirst().orElse(null); //TODO
}
public abstract List<M> build(FieldSet directives, List<D> datas) throws MyApplicationException;
public abstract List<M> build(FieldSet directives, List<D> data) throws MyApplicationException;
public <K> Map<K, M> asForeignKey(QueryBase<D> query, FieldSet directives, Function<M, K> keySelector) throws MyApplicationException {
this.logger.trace("Building references from query");
List<D> datas = query.collectAs(directives);
this.logger.debug("collected {} items to build", Optional.ofNullable(datas).map(e -> e.size()).orElse(0));
return this.asForeignKey(datas, directives, keySelector);
List<D> data = query.collectAs(directives);
this.logger.debug("collected {} items to build", Optional.ofNullable(data).map(List::size).orElse(0));
return this.asForeignKey(data, directives, keySelector);
}
public <K> Map<K, M> asForeignKey(List<D> datas, FieldSet directives, Function<M, K> keySelector) throws MyApplicationException {
public <K> Map<K, M> asForeignKey(List<D> data, FieldSet directives, Function<M, K> keySelector) throws MyApplicationException {
this.logger.trace("building references");
List<M> models = this.build(directives, datas);
this.logger.debug("mapping {} build items from {} requested", Optional.ofNullable(models).map(e -> e.size()).orElse(0), Optional.ofNullable(datas).map(e -> e.size()).orElse(0));
Map<K, M> map = models.stream().collect(Collectors.toMap(o -> keySelector.apply(o), o -> o));
List<M> models = this.build(directives, data);
this.logger.debug("mapping {} build items from {} requested", Optional.ofNullable(models).map(List::size).orElse(0), Optional.ofNullable(data).map(List::size).orElse(0));
Map<K, M> map = models.stream().collect(Collectors.toMap(keySelector, o -> o));
return map;
}
public <K> Map<K, List<M>> asMasterKey(QueryBase<D> query, FieldSet directives, Function<M, K> keySelector) throws MyApplicationException {
this.logger.trace("Building details from query");
List<D> datas = query.collectAs(directives);
this.logger.debug("collected {} items to build", Optional.ofNullable(datas).map(e -> e.size()).orElse(0));
return this.asMasterKey(datas, directives, keySelector);
List<D> data = query.collectAs(directives);
this.logger.debug("collected {} items to build", Optional.ofNullable(data).map(List::size).orElse(0));
return this.asMasterKey(data, directives, keySelector);
}
public <K> Map<K, List<M>> asMasterKey(List<D> datas, FieldSet directives, Function<M, K> keySelector) throws MyApplicationException {
public <K> Map<K, List<M>> asMasterKey(List<D> data, FieldSet directives, Function<M, K> keySelector) throws MyApplicationException {
this.logger.trace("building details");
List<M> models = this.build(directives, datas);
this.logger.debug("mapping {} build items from {} requested", Optional.ofNullable(models).map(e -> e.size()).orElse(0), Optional.ofNullable(datas).map(e -> e.size()).orElse(0));
List<M> models = this.build(directives, data);
this.logger.debug("mapping {} build items from {} requested", Optional.ofNullable(models).map(List::size).orElse(0), Optional.ofNullable(data).map(List::size).orElse(0));
Map<K, List<M>> map = new HashMap<>();
for (M model : models) {
K key = keySelector.apply(model);
@ -74,9 +74,9 @@ public abstract class BaseBuilder<M, D> implements Builder {
public <FK, FM> Map<FK, FM> asEmpty(List<FK> keys, Function<FK, FM> mapper, Function<FM, FK> keySelector) {
this.logger.trace("building static references");
List<FM> models = keys.stream().map(x -> mapper.apply(x)).collect(Collectors.toList());
this.logger.debug("mapping {} build items from {} requested", Optional.ofNullable(models).map(x -> x.size()).orElse(0), Optional.ofNullable(keys).map(x -> x.size()));
Map<FK, FM> map = models.stream().collect(Collectors.toMap(o -> keySelector.apply(o), o -> o));
List<FM> models = keys.stream().map(mapper).collect(Collectors.toList());
this.logger.debug("mapping {} build items from {} requested", Optional.ofNullable(models).map(List::size).orElse(0), Optional.ofNullable(keys).map(List::size));
Map<FK, FM> map = models.stream().collect(Collectors.toMap(keySelector, o -> o));
return map;
}

View File

@ -51,21 +51,21 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
}
@Override
public List<DescriptionTemplate> build(FieldSet fields, List<DescriptionTemplateEntity> datas) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(datas).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
public List<DescriptionTemplate> build(FieldSet fields, List<DescriptionTemplateEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested fields", fields));
if (fields == null || datas == null || fields.isEmpty())
if (fields == null || data == null || fields.isEmpty())
return new ArrayList<>();
FieldSet descriptionTemplateTypeFields = fields.extractPrefixed(this.asPrefix(DescriptionTemplate._type));
Map<UUID, DescriptionTemplateType> descriptionTemplateTypeMap = this.collectDescriptionTemplateTypes(descriptionTemplateTypeFields, datas);
Map<UUID, DescriptionTemplateType> descriptionTemplateTypeMap = this.collectDescriptionTemplateTypes(descriptionTemplateTypeFields, data);
FieldSet usersFields = fields.extractPrefixed(this.asPrefix(DescriptionTemplate._users));
Map<UUID, List<UserDescriptionTemplate>> usersMap = this.collectUserDescriptionTemplates(usersFields, datas);
Map<UUID, List<UserDescriptionTemplate>> usersMap = this.collectUserDescriptionTemplates(usersFields, data);
FieldSet definitionFields = fields.extractPrefixed(this.asPrefix(DescriptionTemplate._definition));
List<DescriptionTemplate> models = new ArrayList<>();
for (DescriptionTemplateEntity d : datas) {
for (DescriptionTemplateEntity d : data) {
DescriptionTemplate m = new DescriptionTemplate();
if (fields.hasField(this.asIndexer(DescriptionTemplate._id))) m.setId(d.getId());
if (fields.hasField(this.asIndexer(DescriptionTemplate._label))) m.setLabel(d.getLabel());
@ -90,14 +90,14 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
return models;
}
private Map<UUID, DescriptionTemplateType> collectDescriptionTemplateTypes(FieldSet fields, List<DescriptionTemplateEntity> datas) throws MyApplicationException {
if (fields.isEmpty() || datas.isEmpty()) return null;
private Map<UUID, DescriptionTemplateType> collectDescriptionTemplateTypes(FieldSet fields, List<DescriptionTemplateEntity> data) throws MyApplicationException {
if (fields.isEmpty() || data.isEmpty()) return null;
this.logger.debug("checking related - {}", DescriptionTemplateType.class.getSimpleName());
Map<UUID, DescriptionTemplateType> itemMap = null;
if (!fields.hasOtherField(this.asIndexer(DescriptionTemplateType._id))) {
itemMap = this.asEmpty(
datas.stream().map(DescriptionTemplateEntity::getTypeId).distinct().collect(Collectors.toList()),
data.stream().map(DescriptionTemplateEntity::getTypeId).distinct().collect(Collectors.toList()),
x -> {
DescriptionTemplateType item = new DescriptionTemplateType();
item.setId(x);
@ -106,7 +106,7 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
x -> x.getId());
} else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplateType._id);
DescriptionTemplateTypeQuery q = this.queryFactory.query(DescriptionTemplateTypeQuery.class).ids(datas.stream().map(DescriptionTemplateEntity::getTypeId).distinct().collect(Collectors.toList()));
DescriptionTemplateTypeQuery q = this.queryFactory.query(DescriptionTemplateTypeQuery.class).ids(data.stream().map(DescriptionTemplateEntity::getTypeId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DescriptionTemplateTypeBuilder.class).asForeignKey(q, clone, DescriptionTemplateType::getId);
}
if (!fields.hasField(DescriptionTemplateType._id)) {
@ -119,13 +119,13 @@ public class DescriptionTemplateBuilder extends BaseBuilder<DescriptionTemplate,
return itemMap;
}
private Map<UUID, List<UserDescriptionTemplate>> collectUserDescriptionTemplates(FieldSet fields, List<DescriptionTemplateEntity> datas) throws MyApplicationException {
if (fields.isEmpty() || datas.isEmpty()) return null;
private Map<UUID, List<UserDescriptionTemplate>> collectUserDescriptionTemplates(FieldSet fields, List<DescriptionTemplateEntity> data) throws MyApplicationException {
if (fields.isEmpty() || data.isEmpty()) return null;
this.logger.debug("checking related - {}", UserDescriptionTemplate.class.getSimpleName());
Map<UUID, List<UserDescriptionTemplate>> itemMap = null;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(UserDescriptionTemplate._descriptionTemplate, DescriptionTemplate._id));
UserDescriptionTemplateQuery query = this.queryFactory.query(UserDescriptionTemplateQuery.class).authorize(this.authorize).descriptionTemplateIds(datas.stream().map(DescriptionTemplateEntity::getId).distinct().collect(Collectors.toList()));
UserDescriptionTemplateQuery query = this.queryFactory.query(UserDescriptionTemplateQuery.class).authorize(this.authorize).descriptionTemplateIds(data.stream().map(DescriptionTemplateEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(UserDescriptionTemplateBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDescriptionTemplate().getId());
if (!fields.hasField(this.asIndexer(UserDescriptionTemplate._descriptionTemplate, DescriptionTemplate._id))) {

View File

@ -41,13 +41,13 @@ public class PublicDescriptionTemplateBuilder extends BaseBuilder<PublicDescript
}
@Override
public List<PublicDescriptionTemplate> build(FieldSet fields, List<DescriptionTemplateEntity> datas) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(datas).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
public List<PublicDescriptionTemplate> build(FieldSet fields, List<DescriptionTemplateEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested fields", fields));
if (fields == null || datas == null || fields.isEmpty())
if (fields == null || data == null || fields.isEmpty())
return new ArrayList<>();
List<PublicDescriptionTemplate> models = new ArrayList<>();
for (DescriptionTemplateEntity d : datas) {
for (DescriptionTemplateEntity d : data) {
PublicDescriptionTemplate m = new PublicDescriptionTemplate();
if (fields.hasField(this.asIndexer(PublicDescriptionTemplate._id))) m.setId(d.getId());
if (fields.hasField(this.asIndexer(PublicDescriptionTemplate._label))) m.setLabel(d.getLabel());

View File

@ -75,13 +75,13 @@ public class PublicDmpBuilder extends BaseBuilder<PublicDmp, DmpEntity> {
return models;
}
private Map<UUID, List<PublicDmpReference>> collectDmpReferences(FieldSet fields, List<DmpEntity> datas) throws MyApplicationException {
if (fields.isEmpty() || datas.isEmpty()) return null;
private Map<UUID, List<PublicDmpReference>> collectDmpReferences(FieldSet fields, List<DmpEntity> data) throws MyApplicationException {
if (fields.isEmpty() || data.isEmpty()) return null;
this.logger.debug("checking related - {}", PublicDmpReference.class.getSimpleName());
Map<UUID, List<PublicDmpReference>> itemMap = null;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(PublicDmpReference._dmp, PublicDmp._id));
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).dmpIds(datas.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).dmpIds(data.stream().map(DmpEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(PublicDmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getDmp().getId());
if (!fields.hasField(this.asIndexer(PublicDmpReference._dmp, PublicDmp._id))) {

View File

@ -90,13 +90,13 @@ public class ReferenceBuilder extends BaseBuilder<Reference, ReferenceEntity>{
return models;
}
private Map<UUID, List<DmpReference>> collectDmpReferences(FieldSet fields, List<ReferenceEntity> datas) throws MyApplicationException {
if (fields.isEmpty() || datas.isEmpty()) return null;
private Map<UUID, List<DmpReference>> collectDmpReferences(FieldSet fields, List<ReferenceEntity> data) throws MyApplicationException {
if (fields.isEmpty() || data.isEmpty()) return null;
this.logger.debug("checking related - {}", DmpReference.class.getSimpleName());
Map<UUID, List<DmpReference>> itemMap = null;
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(this.asIndexer(DmpReference._reference, Reference._id));
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).referenceIds(datas.stream().map(x -> x.getId()).distinct().collect(Collectors.toList()));
DmpReferenceQuery query = this.queryFactory.query(DmpReferenceQuery.class).authorize(this.authorize).referenceIds(data.stream().map(ReferenceEntity::getId).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DmpReferenceBuilder.class).authorize(this.authorize).authorize(this.authorize).asMasterKey(query, clone, x -> x.getReference().getId());
if (!fields.hasField(this.asIndexer(DmpReference._reference, Reference._id))) {

View File

@ -47,18 +47,18 @@ public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionT
}
@Override
public List<UserDescriptionTemplate> build(FieldSet fields, List<UserDescriptionTemplateEntity> datas) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(datas).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
public List<UserDescriptionTemplate> build(FieldSet fields, List<UserDescriptionTemplateEntity> data) throws MyApplicationException {
this.logger.debug("building for {} items requesting {} fields", Optional.ofNullable(data).map(List::size).orElse(0), Optional.ofNullable(fields).map(FieldSet::getFields).map(Set::size).orElse(0));
this.logger.trace(new DataLogEntry("requested fields", fields));
if (fields == null || datas == null || fields.isEmpty())
if (fields == null || data == null || fields.isEmpty())
return new ArrayList<>();
FieldSet descriptionTemplateFields = fields.extractPrefixed(this.asPrefix(UserDescriptionTemplate._descriptionTemplate));
Map<UUID, DescriptionTemplate> descriptionTemplateMap = this.collectDescriptionTemplates(descriptionTemplateFields, datas);
Map<UUID, DescriptionTemplate> descriptionTemplateMap = this.collectDescriptionTemplates(descriptionTemplateFields, data);
List<UserDescriptionTemplate> models = new ArrayList<>();
for (UserDescriptionTemplateEntity d : datas) {
for (UserDescriptionTemplateEntity d : data) {
UserDescriptionTemplate m = new UserDescriptionTemplate();
if (fields.hasField(this.asIndexer(UserDescriptionTemplate._id))) m.setId(d.getId());
if (fields.hasField(this.asIndexer(UserDescriptionTemplate._createdAt))) m.setCreatedAt(d.getCreatedAt());
@ -73,14 +73,14 @@ public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionT
return models;
}
private Map<UUID, DescriptionTemplate> collectDescriptionTemplates(FieldSet fields, List<UserDescriptionTemplateEntity> datas) throws MyApplicationException {
if (fields.isEmpty() || datas.isEmpty()) return null;
private Map<UUID, DescriptionTemplate> collectDescriptionTemplates(FieldSet fields, List<UserDescriptionTemplateEntity> data) throws MyApplicationException {
if (fields.isEmpty() || data.isEmpty()) return null;
this.logger.debug("checking related - {}", DescriptionTemplate.class.getSimpleName());
Map<UUID, DescriptionTemplate> itemMap = null;
if (!fields.hasOtherField(this.asIndexer(DescriptionTemplate._id))) {
itemMap = this.asEmpty(
datas.stream().map(UserDescriptionTemplateEntity::getDescriptionTemplate).distinct().collect(Collectors.toList()),
data.stream().map(UserDescriptionTemplateEntity::getDescriptionTemplate).distinct().collect(Collectors.toList()),
x -> {
DescriptionTemplate item = new DescriptionTemplate();
item.setId(x);
@ -89,7 +89,7 @@ public class UserDescriptionTemplateBuilder extends BaseBuilder<UserDescriptionT
x -> x.getId());
} else {
FieldSet clone = new BaseFieldSet(fields.getFields()).ensure(DescriptionTemplate._id);
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).ids(datas.stream().map(UserDescriptionTemplateEntity::getDescriptionTemplate).distinct().collect(Collectors.toList()));
DescriptionTemplateQuery q = this.queryFactory.query(DescriptionTemplateQuery.class).ids(data.stream().map(UserDescriptionTemplateEntity::getDescriptionTemplate).distinct().collect(Collectors.toList()));
itemMap = this.builderFactory.builder(DescriptionTemplateBuilder.class).asForeignKey(q, clone, DescriptionTemplate::getId);
}
if (!fields.hasField(DescriptionTemplate._id)) {

View File

@ -66,14 +66,14 @@ public class DescriptionDeleter implements Deleter {
logger.trace("changes saved");
}
public void delete(List<DescriptionEntity> datas) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(datas).map(List::size).orElse(0));
if (datas == null || datas.isEmpty())
public void delete(List<DescriptionEntity> data) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty())
return;
Instant now = Instant.now();
List<UUID> ids = datas.stream().map(DescriptionEntity::getId).distinct().collect(Collectors.toList());
List<UUID> ids = data.stream().map(DescriptionEntity::getId).distinct().collect(Collectors.toList());
{
logger.debug("checking related - {}", DescriptionReferenceEntity.class.getSimpleName());
List<DescriptionReferenceEntity> items = this.queryFactory.query(DescriptionReferenceQuery.class).descriptionIds(ids).collect();
@ -87,7 +87,7 @@ public class DescriptionDeleter implements Deleter {
deleter.delete(items);
}
for (DescriptionEntity item : datas) {
for (DescriptionEntity item : data) {
logger.trace("deleting item {}", item.getId());
item.setIsActive(IsActive.Inactive);
item.setUpdatedAt(now);

View File

@ -65,12 +65,12 @@ public class DescriptionTemplateTypeDeleter implements Deleter {
logger.trace("changes saved");
}
public void delete(List<DescriptionTemplateTypeEntity> datas) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(datas).map(List::size).orElse(0));
if (datas == null || datas.isEmpty())
public void delete(List<DescriptionTemplateTypeEntity> data) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty())
return;
List<UUID> ids = datas.stream().map(DescriptionTemplateTypeEntity::getId).distinct().collect(Collectors.toList());
List<UUID> ids = data.stream().map(DescriptionTemplateTypeEntity::getId).distinct().collect(Collectors.toList());
{
logger.debug("checking related - {}", DescriptionTemplateEntity.class.getSimpleName());
List<DescriptionTemplateEntity> items = this.queryFactory.query(DescriptionTemplateQuery.class).typeIds(ids).collect();
@ -80,7 +80,7 @@ public class DescriptionTemplateTypeDeleter implements Deleter {
Instant now = Instant.now();
for (DescriptionTemplateTypeEntity item : datas) {
for (DescriptionTemplateTypeEntity item : data) {
logger.trace("deleting item {}", item.getId());
item.setIsActive(IsActive.Inactive);
item.setUpdatedAt(now);

View File

@ -64,12 +64,12 @@ public class ReferenceDeleter implements Deleter {
logger.trace("changes saved");
}
public void delete(List<ReferenceEntity> datas) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(datas).map(List::size).orElse(0));
if (datas == null || datas.isEmpty())
public void delete(List<ReferenceEntity> data) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty())
return;
List<UUID> ids = datas.stream().map(ReferenceEntity::getId).distinct().collect(Collectors.toList());
List<UUID> ids = data.stream().map(ReferenceEntity::getId).distinct().collect(Collectors.toList());
{
logger.debug("checking related - {}", DescriptionReferenceEntity.class.getSimpleName());
List<DescriptionReferenceEntity> items = this.queryFactory.query(DescriptionReferenceQuery.class).referenceIds(ids).collect();
@ -84,7 +84,7 @@ public class ReferenceDeleter implements Deleter {
}
Instant now = Instant.now();
for (ReferenceEntity item : datas) {
for (ReferenceEntity item : data) {
logger.trace("deleting item {}", item.getId());
item.setIsActive(IsActive.Inactive);
item.setUpdatedAt(now);

View File

@ -61,11 +61,11 @@ public class TagDeleter implements Deleter {
logger.trace("changes saved");
}
public void delete(List<TagEntity> datas) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(datas).map(List::size).orElse(0));
if (datas == null || datas.isEmpty())
public void delete(List<TagEntity> data) throws InvalidApplicationException {
logger.debug("will delete {} items", Optional.ofNullable(data).map(List::size).orElse(0));
if (data == null || data.isEmpty())
return;
List<UUID> ids = datas.stream().map(TagEntity::getId).distinct().collect(Collectors.toList());
List<UUID> ids = data.stream().map(TagEntity::getId).distinct().collect(Collectors.toList());
{
logger.debug("checking related - {}", DescriptionTagEntity.class.getSimpleName());
List<DescriptionTagEntity> items = this.queryFactory.query(DescriptionTagQuery.class).tagIds(ids).collect();
@ -74,7 +74,7 @@ public class TagDeleter implements Deleter {
}
Instant now = Instant.now();
for (TagEntity item : datas) {
for (TagEntity item : data) {
logger.trace("deleting item {}", item.getId());
item.setIsActive(IsActive.Inactive);
item.setUpdatedAt(now);

View File

@ -82,8 +82,8 @@ public class AutoCompleteFieldDataHelperService extends BaseFieldDataHelperServi
}
@Override
public List<AutoCompleteData> buildInternal(FieldSet fieldSet, List<AutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(AutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<AutoCompleteData> buildInternal(FieldSet fieldSet, List<AutoCompleteDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(AutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -21,7 +21,7 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
protected abstract PM newPersistModelInstanceInternal();
protected abstract IE newImportExportInstanceInternal();
protected abstract List<M> buildInternal(FieldSet fieldSet, List<D> datas, EnumSet<AuthorizationFlags> authorizationFlags);
protected abstract List<M> buildInternal(FieldSet fieldSet, List<D> data, EnumSet<AuthorizationFlags> authorizationFlags);
protected abstract D applyPersistInternal(PM persist, D data);
protected abstract PM importExportMapDataToPersistInternal(IE data, PM persist);
protected abstract IE dataToImportExportXmlInternal(D data, IE xml);
@ -78,7 +78,7 @@ public abstract class BaseFieldDataHelperService<M extends BaseFieldData, PM ext
}
@Override
public List<BaseFieldData> build(FieldSet fieldSet, List<BaseFieldDataEntity<?>> datas, EnumSet<AuthorizationFlags> authorizationFlags) {
return this.buildInternal(fieldSet, datas.stream().map(x-> (D) x).collect(Collectors.toList()), authorizationFlags).stream().map(x-> (M)x).collect(Collectors.toList());
public List<BaseFieldData> build(FieldSet fieldSet, List<BaseFieldDataEntity<?>> data, EnumSet<AuthorizationFlags> authorizationFlags) {
return this.buildInternal(fieldSet, data.stream().map(x-> (D) x).collect(Collectors.toList()), authorizationFlags).stream().map(x-> (M)x).collect(Collectors.toList());
}
}

View File

@ -74,8 +74,8 @@ public class BooleanDecisionFieldDataHelperService extends BaseFieldDataHelperSe
}
@Override
public List<BooleanDecisionData> buildInternal(FieldSet fieldSet, List<BooleanDecisionDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(BooleanDecisionDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<BooleanDecisionData> buildInternal(FieldSet fieldSet, List<BooleanDecisionDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(BooleanDecisionDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -78,8 +78,8 @@ public class CheckBoxFieldDataHelperService extends BaseFieldDataHelperService<C
}
@Override
public List<CheckBoxData> buildInternal(FieldSet fieldSet, List<CheckBoxDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(CheckBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<CheckBoxData> buildInternal(FieldSet fieldSet, List<CheckBoxDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(CheckBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -76,8 +76,8 @@ public class CurrencyFieldDataHelperService extends BaseFieldDataHelperService<C
}
@Override
public List<CurrencyData> buildInternal(FieldSet fieldSet, List<CurrencyDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(CurrencyDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<CurrencyData> buildInternal(FieldSet fieldSet, List<CurrencyDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(CurrencyDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override
protected CurrencyDataEntity applyPersistInternal(CurrencyDataPersist persist, CurrencyDataEntity data) {

View File

@ -75,8 +75,8 @@ public class DataRepositoryFieldDataHelperService extends BaseFieldDataHelperSer
}
@Override
public List<DataRepositoryData> buildInternal(FieldSet fieldSet, List<DataRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DataRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<DataRepositoryData> buildInternal(FieldSet fieldSet, List<DataRepositoryDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DataRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -78,8 +78,8 @@ public class DatasetAutoCompleteFieldDataHelperService extends BaseFieldDataHelp
}
@Override
public List<DatasetAutoCompleteData> buildInternal(FieldSet fieldSet, List<DatasetAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatasetAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<DatasetAutoCompleteData> buildInternal(FieldSet fieldSet, List<DatasetAutoCompleteDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatasetAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -76,8 +76,8 @@ public class DatasetIdentifierFieldDataHelperService extends BaseFieldDataHelper
}
@Override
public List<DatasetIdentifierData> buildInternal(FieldSet fieldSet, List<DatasetIdentifierDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatasetIdentifierDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<DatasetIdentifierData> buildInternal(FieldSet fieldSet, List<DatasetIdentifierDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatasetIdentifierDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -76,8 +76,8 @@ public class DatePickerFieldDataHelperService extends BaseFieldDataHelperService
}
@Override
public List<DatePickerData> buildInternal(FieldSet fieldSet, List<DatePickerDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatePickerDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<DatePickerData> buildInternal(FieldSet fieldSet, List<DatePickerDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DatePickerDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -78,8 +78,8 @@ public class DmpAutoCompleteFieldDataHelperService extends BaseFieldDataHelperSe
}
@Override
public List<DmpAutoCompleteData> buildInternal(FieldSet fieldSet, List<DmpAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DmpAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<DmpAutoCompleteData> buildInternal(FieldSet fieldSet, List<DmpAutoCompleteDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(DmpAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class ExternalDatasetFieldDataHelperService extends BaseFieldDataHelperSe
}
@Override
public List<ExternalDatasetData> buildInternal(FieldSet fieldSet, List<ExternalDatasetDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ExternalDatasetDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<ExternalDatasetData> buildInternal(FieldSet fieldSet, List<ExternalDatasetDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ExternalDatasetDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -21,7 +21,7 @@ public interface FieldDataHelperService {
Class<?> getModelClass();
Class<?> getPersistModelClass();
Class<?> getImportExportClass();
List<BaseFieldData> build(gr.cite.tools.fieldset.FieldSet fieldSet, List<BaseFieldDataEntity<?>> datas, EnumSet<AuthorizationFlags> authorizationFlags);
List<BaseFieldData> build(gr.cite.tools.fieldset.FieldSet fieldSet, List<BaseFieldDataEntity<?>> data, EnumSet<AuthorizationFlags> authorizationFlags);
BaseFieldData buildOne(FieldSet fieldSet, BaseFieldDataEntity<?> data, EnumSet<AuthorizationFlags> authorizationFlags);
BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist);
BaseFieldDataEntity<?> applyPersist(BaseFieldDataPersist persist, BaseFieldDataEntity<?> data);

View File

@ -78,8 +78,8 @@ public class FreeTextFieldDataHelperService extends BaseFieldDataHelperService<F
}
@Override
public List<FreeTextData> buildInternal(FieldSet fieldSet, List<FreeTextDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(FreeTextDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<FreeTextData> buildInternal(FieldSet fieldSet, List<FreeTextDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(FreeTextDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -79,8 +79,8 @@ public class JournalRepositoryFieldDataHelperService extends BaseFieldDataHelper
}
@Override
public List<JournalRepositoryData> buildInternal(FieldSet fieldSet, List<JournalRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(JournalRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<JournalRepositoryData> buildInternal(FieldSet fieldSet, List<JournalRepositoryDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(JournalRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class LicenseFieldDataHelperService extends BaseFieldDataHelperService<Li
}
@Override
public List<LicenseData> buildInternal(FieldSet fieldSet, List<LicenseDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(LicenseDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<LicenseData> buildInternal(FieldSet fieldSet, List<LicenseDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(LicenseDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class OrganizationFieldDataHelperService extends BaseFieldDataHelperServi
}
@Override
public List<OrganizationData> buildInternal(FieldSet fieldSet, List<OrganizationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(OrganizationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<OrganizationData> buildInternal(FieldSet fieldSet, List<OrganizationDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(OrganizationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class PublicationFieldDataHelperService extends BaseFieldDataHelperServic
}
@Override
public List<PublicationData> buildInternal(FieldSet fieldSet, List<PublicationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(PublicationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<PublicationData> buildInternal(FieldSet fieldSet, List<PublicationDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(PublicationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -79,8 +79,8 @@ public class PublicationRepositoryFieldDataHelperService extends BaseFieldDataHe
}
@Override
public List<PublicationRepositoryData> buildInternal(FieldSet fieldSet, List<PublicationRepositoryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(PublicationRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<PublicationRepositoryData> buildInternal(FieldSet fieldSet, List<PublicationRepositoryDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(PublicationRepositoryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -82,8 +82,8 @@ public class RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<R
}
@Override
public List<RadioBoxData> buildInternal(FieldSet fieldSet, List<RadioBoxDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RadioBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<RadioBoxData> buildInternal(FieldSet fieldSet, List<RadioBoxDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RadioBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class RegistryFieldDataHelperService extends BaseFieldDataHelperService<R
}
@Override
public List<RegistryData> buildInternal(FieldSet fieldSet, List<RegistryDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RegistryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<RegistryData> buildInternal(FieldSet fieldSet, List<RegistryDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RegistryDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class ResearcherAutoCompleteFieldDataHelperService extends BaseFieldDataH
}
@Override
public List<ResearcherAutoCompleteData> buildInternal(FieldSet fieldSet, List<ResearcherAutoCompleteDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ResearcherAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<ResearcherAutoCompleteData> buildInternal(FieldSet fieldSet, List<ResearcherAutoCompleteDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ResearcherAutoCompleteDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class ResearcherFieldDataHelperService extends BaseFieldDataHelperService
}
@Override
public List<ResearcherData> buildInternal(FieldSet fieldSet, List<ResearcherDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ResearcherDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<ResearcherData> buildInternal(FieldSet fieldSet, List<ResearcherDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ResearcherDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -78,8 +78,8 @@ public class RichTextAreaDataFieldDataHelperService extends BaseFieldDataHelperS
}
@Override
public List<RichTextAreaData> buildInternal(FieldSet fieldSet, List<RichTextAreaDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RichTextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<RichTextAreaData> buildInternal(FieldSet fieldSet, List<RichTextAreaDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(RichTextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class ServiceFieldDataHelperService extends BaseFieldDataHelperService<Se
}
@Override
public List<ServiceData> buildInternal(FieldSet fieldSet, List<ServiceDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ServiceDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<ServiceData> buildInternal(FieldSet fieldSet, List<ServiceDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ServiceDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -78,8 +78,8 @@ public class TagFieldDataHelperService extends BaseFieldDataHelperService<TagDat
}
@Override
public List<TagData> buildInternal(FieldSet fieldSet, List<TagDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TagDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<TagData> buildInternal(FieldSet fieldSet, List<TagDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TagDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class TaxonomyFieldDataHelperService extends BaseFieldDataHelperService<T
}
@Override
public List<TaxonomyData> buildInternal(FieldSet fieldSet, List<TaxonomyDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TaxonomyDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<TaxonomyData> buildInternal(FieldSet fieldSet, List<TaxonomyDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TaxonomyDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class TextAreaFieldDataHelperService extends BaseFieldDataHelperService<T
}
@Override
public List<TextAreaData> buildInternal(FieldSet fieldSet, List<TextAreaDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<TextAreaData> buildInternal(FieldSet fieldSet, List<TextAreaDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(TextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -80,8 +80,8 @@ public class UploadFieldDataHelperService extends BaseFieldDataHelperService<Upl
}
@Override
public List<UploadData> buildInternal(FieldSet fieldSet, List<UploadDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(UploadDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<UploadData> buildInternal(FieldSet fieldSet, List<UploadDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(UploadDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -77,8 +77,8 @@ public class ValidationFieldDataHelperService extends BaseFieldDataHelperService
}
@Override
public List<ValidationData> buildInternal(FieldSet fieldSet, List<ValidationDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ValidationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<ValidationData> buildInternal(FieldSet fieldSet, List<ValidationDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(ValidationDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -78,8 +78,8 @@ public class WordListFieldDataHelperService extends BaseFieldDataHelperService<W
}
@Override
public List<WordListData> buildInternal(FieldSet fieldSet, List<WordListDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(WordListDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
public List<WordListData> buildInternal(FieldSet fieldSet, List<WordListDataEntity> data, EnumSet<AuthorizationFlags> authorizationFlags){
return this.builderFactory.builder(WordListDataBuilder.class).authorize(authorizationFlags).build(fieldSet, data);
}
@Override

View File

@ -122,35 +122,35 @@ public class SupportiveMaterialServiceImpl implements SupportiveMaterialService{
Boolean isUpdate = this.conventionService.isValidGuid(model.getId());
SupportiveMaterialEntity data;
SupportiveMaterialEntity d;
if (isUpdate) {
data = this.entityManager.find(SupportiveMaterialEntity.class, model.getId());
if (data == null)
d = this.entityManager.find(SupportiveMaterialEntity.class, model.getId());
if (d == null)
throw new MyNotFoundException(messageSource.getMessage("General_ItemNotFound", new Object[]{model.getId(), SupportiveMaterial.class.getSimpleName()}, LocaleContextHolder.getLocale()));
} else {
List<SupportiveMaterialEntity> datas = this.queryFactory.query(SupportiveMaterialQuery.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).languageCodes(model.getLanguageCode()).types(model.getType()).collect();
List<SupportiveMaterialEntity> data = this.queryFactory.query(SupportiveMaterialQuery.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).languageCodes(model.getLanguageCode()).types(model.getType()).collect();
if(datas != null && !datas.isEmpty()){
if(data != null && !data.isEmpty()){
throw new MyApplicationException("Could not create a new Data with same type and lang code !");
}
data = new SupportiveMaterialEntity();
data.setId(UUID.randomUUID());
data.setIsActive(IsActive.Active);
data.setCreatedAt(Instant.now());
d = new SupportiveMaterialEntity();
d.setId(UUID.randomUUID());
d.setIsActive(IsActive.Active);
d.setCreatedAt(Instant.now());
}
data.setType(model.getType());
data.setLanguageCode(model.getLanguageCode());
data.setPayload(model.getPayload());
data.setUpdatedAt(Instant.now());
d.setType(model.getType());
d.setLanguageCode(model.getLanguageCode());
d.setPayload(model.getPayload());
d.setUpdatedAt(Instant.now());
if (isUpdate) this.entityManager.merge(data);
else this.entityManager.persist(data);
if (isUpdate) this.entityManager.merge(d);
else this.entityManager.persist(d);
this.entityManager.flush();
return this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(BaseFieldSet.build(fields, SupportiveMaterial._id), data);
return this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(BaseFieldSet.build(fields, SupportiveMaterial._id), d);
}
public void deleteAndSave(UUID id) throws MyForbiddenException, InvalidApplicationException {

View File

@ -89,8 +89,8 @@ public class ReferenceController extends BaseController {
this.censorFactory.censor(ReferenceCensor.class).censor(lookup.getProject(), null);
ReferenceQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic);
List<ReferenceEntity> datas = query.collectAs(lookup.getProject());
List<Reference> models = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(lookup.getProject(), datas);
List<ReferenceEntity> data = query.collectAs(lookup.getProject());
List<Reference> models = this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(lookup.getProject(), data);
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
this.auditService.track(AuditableAction.Reference_Query, "lookup", lookup);

View File

@ -79,8 +79,8 @@ public class ReferenceTypeController extends BaseController {
this.censorFactory.censor(ReferenceTypeCensor.class).censor(lookup.getProject(), null);
ReferenceTypeQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic);
List<ReferenceTypeEntity> datas = query.collectAs(lookup.getProject());
List<ReferenceType> models = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(lookup.getProject(), datas);
List<ReferenceTypeEntity> data = query.collectAs(lookup.getProject());
List<ReferenceType> models = this.builderFactory.builder(ReferenceTypeBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(lookup.getProject(), data);
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
this.auditService.track(AuditableAction.ReferenceType_Query, "lookup", lookup);

View File

@ -81,8 +81,8 @@ public class SupportiveMaterialController {
this.censorFactory.censor(SupportiveMaterialCensor.class).censor(lookup.getProject(), null);
SupportiveMaterialQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic);
List<SupportiveMaterialEntity> datas = query.collectAs(lookup.getProject());
List<SupportiveMaterial> models = this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(lookup.getProject(), datas);
List<SupportiveMaterialEntity> data = query.collectAs(lookup.getProject());
List<SupportiveMaterial> models = this.builderFactory.builder(SupportiveMaterialBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(lookup.getProject(), data);
long count = (lookup.getMetadata() != null && lookup.getMetadata().getCountAll()) ? query.count() : models.size();
this.auditService.track(AuditableAction.SupportiveMaterial_Query, "lookup", lookup);
@ -116,9 +116,9 @@ public class SupportiveMaterialController {
this.censorFactory.censor(SupportiveMaterialCensor.class).censor(lookup.getProject(), null);
SupportiveMaterialQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic);
List<SupportiveMaterialEntity> datas = query.collectAs(lookup.getProject());
if (datas.size() == 1){
return new ResponseEntity<>(datas.get(0).getPayload().getBytes(), HttpStatus.OK);
List<SupportiveMaterialEntity> data = query.collectAs(lookup.getProject());
if (data.size() == 1){
return new ResponseEntity<>(data.get(0).getPayload().getBytes(), HttpStatus.OK);
}
try (Stream<Path> paths = Files.walk(Paths.get(Objects.requireNonNull(this.environment.getProperty(lookup.getTypes().stream().toList().get(0).name().toLowerCase() +".path"))))) {

View File

@ -199,8 +199,8 @@ public class ReferenceService {
lookup.setProject(new BaseFieldSet(fields));
ReferenceQuery query = lookup.enrich(this.queryFactory).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic);
List<ReferenceEntity> datas = query.collectAs(lookup.getProject());
return this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(lookup.getProject(), datas);
List<ReferenceEntity> data = query.collectAs(lookup.getProject());
return this.builderFactory.builder(ReferenceBuilder.class).authorize(AuthorizationFlags.OwnerOrPermissionOrMemberOrPublic).build(lookup.getProject(), data);
}
// private List<FetcherReference> fetchFromDb(ReferenceType externalType, String query, String type, List<Map<String, String>> remoteRepos) throws InvalidApplicationException {