28 lines
630 B
Java
28 lines
630 B
Java
package org.opencdmp.filetransformer.rda.model.rda.mapper;
|
|
|
|
import org.opencdmp.filetransformer.rda.model.rda.FunderId;
|
|
import org.springframework.stereotype.Component;
|
|
|
|
import java.util.Map;
|
|
import java.util.UUID;
|
|
|
|
@Component
|
|
public class FunderIdRDAMapper {
|
|
|
|
public FunderId toRDA(Object id) {
|
|
if (id == null) return null;
|
|
FunderId rda = new FunderId();
|
|
rda.setIdentifier(id.toString());
|
|
if (id instanceof UUID) {
|
|
rda.setType(FunderId.Type.OTHER);
|
|
} else {
|
|
rda.setType(FunderId.Type.FUNDREF);
|
|
}
|
|
return rda;
|
|
}
|
|
|
|
public String toEntity(FunderId rda) {
|
|
return rda == null ? null : rda.getIdentifier();
|
|
}
|
|
}
|