Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/dev' into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
marcos-lg committed Aug 14, 2024
2 parents a957a24 + f70be5c commit 62c3963
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -844,4 +844,8 @@ private boolean isEmptyAddress(Address address) {
protected abstract ChangeSuggestionDto createConvertToCollectionSuggestionDto(R changeSuggestion);

protected abstract UUID applyConversionToCollection(ChangeSuggestionDto dto);

protected static String decodeIRN(String irn) {
return irn.replace("gbif:ih:irn:", "");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@
import org.gbif.api.model.collections.Collection;
import org.gbif.api.model.collections.CollectionEntityType;
import org.gbif.api.model.collections.Institution;
import org.gbif.api.model.collections.MasterSourceMetadata;
import org.gbif.api.model.collections.suggestions.CollectionChangeSuggestion;
import org.gbif.api.model.collections.suggestions.Type;
import org.gbif.api.model.registry.Identifier;
import org.gbif.api.service.collections.CollectionService;
import org.gbif.api.service.collections.InstitutionService;
import org.gbif.api.vocabulary.IdentifierType;
import org.gbif.api.vocabulary.collections.Source;
import org.gbif.registry.events.EventManager;
import org.gbif.registry.mail.EmailSender;
import org.gbif.registry.mail.collections.CollectionsEmailManager;
Expand Down Expand Up @@ -92,7 +94,7 @@ public int createChangeSuggestion(CollectionChangeSuggestion changeSuggestion) {
}

@Override
public UUID applyChangeSuggestion(int suggestionKey){
public UUID applyChangeSuggestion(int suggestionKey){
ChangeSuggestionDto dto = changeSuggestionMapper.get(suggestionKey);
if (dto.getType() == Type.CREATE) {
if (Boolean.TRUE.equals(dto.getCreateInstitution())) {
Expand All @@ -110,6 +112,8 @@ public UUID applyChangeSuggestion(int suggestionKey){
if (dto.getIhIdentifier() != null){
collectionService.addIdentifier(createdEntity,new Identifier(IdentifierType.IH_IRN,
dto.getIhIdentifier()));
collectionService.addMasterSourceMetadata(createdEntity, new MasterSourceMetadata(
Source.IH_IRN, decodeIRN(dto.getIhIdentifier())));
}

return createdEntity;
Expand Down Expand Up @@ -152,8 +156,10 @@ public UUID createInstitutionForCollectionSuggestion(ChangeSuggestionDto dto){
Institution institution = collectionChangeSuggestionToInstitution(dto);

createdEntity = institutionService.create(institution);
institutionService.addIdentifier(createdEntity,new Identifier(IdentifierType.IH_IRN,
institutionService.addIdentifier(createdEntity, new Identifier(IdentifierType.IH_IRN,
dto.getIhIdentifier()));
institutionService.addMasterSourceMetadata(createdEntity, new MasterSourceMetadata(
Source.IH_IRN, decodeIRN(dto.getIhIdentifier())));
createContacts(changeSuggestion,createdEntity);
}
}
Expand Down

0 comments on commit 62c3963

Please sign in to comment.