implementation of some internal methods
This commit is contained in:
parent
c622c4cd53
commit
9e2638c9e4
|
@ -19,6 +19,7 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
|||
import eu.dnetlib.openaire.community.db.model.DbCommunity;
|
||||
import eu.dnetlib.openaire.community.db.model.DbDatasource;
|
||||
import eu.dnetlib.openaire.community.db.model.DbDatasourcePK;
|
||||
import eu.dnetlib.openaire.community.db.model.DbOrganization;
|
||||
import eu.dnetlib.openaire.community.db.model.DbProject;
|
||||
import eu.dnetlib.openaire.community.db.model.DbProjectPK;
|
||||
import eu.dnetlib.openaire.community.db.repository.DbCommunityRepository;
|
||||
|
@ -48,7 +49,8 @@ public class CommunityService {
|
|||
// 3) Gestire paginazione dei progetti
|
||||
// 4) CommunityContentprovider sono le datasources?
|
||||
// 5) Capire come gestire il campo Id (Integer) di CommunityContentprovider
|
||||
// 5) Capire come gestire il campo Id (Integer) di CommunityOrganization
|
||||
// 6) Capire come gestire il campo Id (Integer) di CommunityOrganization
|
||||
// 7) Modificare le api per gestire le ZenodoCommunities (main + others)
|
||||
|
||||
@Autowired
|
||||
private DbCommunityRepository dbCommunityRepository;
|
||||
|
@ -162,6 +164,13 @@ public class CommunityService {
|
|||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
public CommunityOrganization addCommunityOrganization(final String id, final CommunityOrganization organization)
|
||||
throws CommunityException, ResourceNotFoundException {
|
||||
final DbOrganization o = ConvertionUtils.toDbOrganization(id, organization);
|
||||
dbOrganizationRepository.save(o);
|
||||
return organization;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public CommunityDetails addCommunitySubjects(final String id, final List<String> subjects) throws CommunityException, ResourceNotFoundException {
|
||||
return modifyElementToArrayField(id, subjects, c -> c.getSubjects(), (c, subs) -> c.setSubjects(subs), false);
|
||||
|
@ -233,12 +242,6 @@ public class CommunityService {
|
|||
return null;
|
||||
}
|
||||
|
||||
public CommunityOrganization addCommunityOrganization(final String id, final CommunityOrganization organization)
|
||||
throws CommunityException, ResourceNotFoundException {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
private CommunityDetails modifyElementToArrayField(final String id,
|
||||
final List<String> values,
|
||||
final Function<DbCommunity, String[]> getter,
|
||||
|
|
Loading…
Reference in New Issue