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.RadioBoxDataEntity;
|
||
|
import eu.eudat.model.builder.descriptiontemplatedefinition.fielddata.RadioBoxDataBuilder;
|
||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.BaseFieldData;
|
||
|
import eu.eudat.model.descriptiontemplatedefinition.fielddata.RadioBoxData;
|
||
|
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 RadioBoxFieldDataHelperService extends BaseFieldDataHelperService<RadioBoxData, RadioBoxDataEntity> {
|
||
|
|
||
|
private final BuilderFactory builderFactory;
|
||
|
|
||
|
public RadioBoxFieldDataHelperService(BuilderFactory builderFactory) {
|
||
|
this.builderFactory = builderFactory;
|
||
|
}
|
||
|
|
||
|
|
||
|
@Override
|
||
|
public FieldType getFormType() {
|
||
|
return FieldType.RADIO_BOX;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public BaseFieldDataEntity<?> newDataInstance() {
|
||
|
return new RadioBoxDataEntity();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public BaseFieldData newModelInstance() {
|
||
|
return new RadioBoxData();
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public Class<?> getDataClass() {
|
||
|
return RadioBoxDataEntity.class;
|
||
|
}
|
||
|
@Override
|
||
|
public Class<?> getModelClass() {
|
||
|
return RadioBoxData.class;
|
||
|
}
|
||
|
|
||
|
@Override
|
||
|
public List<RadioBoxData> buildInternal(FieldSet fieldSet, List<RadioBoxDataEntity> datas, EnumSet<AuthorizationFlags> authorizationFlags){
|
||
|
return this.builderFactory.builder(RadioBoxDataBuilder.class).authorize(authorizationFlags).build(fieldSet, datas);
|
||
|
}
|
||
|
}
|