60 lines
1.9 KiB
Java
60 lines
1.9 KiB
Java
|
package eu.eudat.service.fielddatahelper;
|
||
|
|
||
|
import eu.eudat.authorization.AuthorizationFlags;
|
||
|
import eu.eudat.commons.enums.FieldType;
|
||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.BaseFieldDataEntity;
|
||
|
import eu.eudat.commons.types.descriptiontemplate.fielddata.TextAreaDataEntity;
|
||
|
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.TextAreaDataBuilder;
|
||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.TextAreaData;
|
||
|
import gr.cite.tools.data.builder.BuilderFactory;
|
||
|
import gr.cite.tools.fieldset.FieldSet;
|
||
|
import org.springframework.beans.factory.config.ConfigurableBeanFactory;
|
||
|
import org.springframework.context.annotation.Scope;
|
||
|
import org.springframework.stereotype.Component;
|
||
|
|
||
|
import java.util.EnumSet;
|
||
|
import java.util.List;
|
||
|
|
||
|
@Component
|
||
|
@Scope(value = ConfigurableBeanFactory.SCOPE_PROTOTYPE)
|
||
|
|
||
|
public class TextAreaFieldDataHelperService extends BaseFieldDataHelperService<TextAreaData, TextAreaDataEntity> {
|
||
|
|
||
|
private final BuilderFactory builderFactory;
|
||
|
|
||
|
public TextAreaFieldDataHelperService(BuilderFactory builderFactory) {
|
||
|
this.builderFactory = builderFactory;
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public FieldType getFormType() {
|
||
|
return FieldType.TEXT_AREA;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public BaseFieldDataEntity<?> newDataInstance() {
|
||
|
return new TextAreaDataEntity();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public BaseFieldData newModelInstance() {
|
||
|
return new TextAreaData();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Class<?> getDataClass() {
|
||
|
return TextAreaDataEntity.class;
|
||
|
}
|
||
|
@Override
|
||
|
public Class<?> getModelClass() {
|
||
|
return TextAreaData.class;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public List<TextAreaData> buildInternal(FieldSet fieldSet, List<TextAreaDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
|
||
|
return this.builderFactory.builder(TextAreaDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
|
||
|
}
|
||
|
}
|