use of com.evolveum.midpoint.repo.sql.data.common.any.ROExtPolyString in project midpoint by Evolveum.
the class RObject method copyFromJAXB.
public static void copyFromJAXB(PrismContainerValue containerValue, RObject repo, RepositoryContext repositoryContext, RObjectExtensionType ownerType) throws DtoTranslationException {
RAnyConverter converter = new RAnyConverter(repositoryContext.prismContext);
Set<RAnyValue> values = new HashSet<RAnyValue>();
try {
List<Item<?, ?>> items = containerValue.getItems();
//TODO: is this ehought??should we try items without definitions??
if (items != null) {
for (Item item : items) {
values.addAll(converter.convertToRValue(item, false));
}
}
} catch (Exception ex) {
throw new DtoTranslationException(ex.getMessage(), ex);
}
for (RAnyValue value : values) {
ROExtValue ex = (ROExtValue) value;
ex.setOwner(repo);
ex.setOwnerType(ownerType);
if (value instanceof ROExtDate) {
repo.getDates().add(value);
} else if (value instanceof ROExtLong) {
repo.getLongs().add(value);
} else if (value instanceof ROExtReference) {
repo.getReferences().add(value);
} else if (value instanceof ROExtString) {
repo.getStrings().add(value);
} else if (value instanceof ROExtPolyString) {
repo.getPolys().add(value);
} else if (value instanceof ROExtBoolean) {
repo.getBooleans().add(value);
}
}
repo.setStringsCount((short) repo.getStrings().size());
repo.setDatesCount((short) repo.getDates().size());
repo.setPolysCount((short) repo.getPolys().size());
repo.setReferencesCount((short) repo.getReferences().size());
repo.setLongsCount((short) repo.getLongs().size());
repo.setBooleansCount((short) repo.getBooleans().size());
}
Aggregations