use of com.evolveum.midpoint.repo.sql.data.common.RFocus in project midpoint by Evolveum.
the class PasswordMetadataUpdate method handlePropertyDelta.
public void handlePropertyDelta() throws SchemaException {
if (!(object instanceof RFocus)) {
throw new SystemException("Bean is not instance of " + RFocus.class + ", shouldn't happen");
}
RFocus focus = (RFocus) object;
if (isDelete()) {
focus.setPasswordCreateTimestamp(null);
focus.setModifyTimestamp(null);
return;
}
PrismValue value = delta.getAnyValue();
MapperContext context = new MapperContext();
context.setRepositoryContext(beans.createRepositoryContext());
context.setDelta(delta);
context.setOwner(object);
beans.prismEntityMapper.mapPrismValue(value, RFocus.class, context);
}
use of com.evolveum.midpoint.repo.sql.data.common.RFocus in project midpoint by Evolveum.
the class PasswordMetadataMapper method map.
@Override
public RFocus map(MetadataType input, MapperContext context) {
RFocus focus = (RFocus) context.getOwner();
if (input == null) {
focus.setPasswordCreateTimestamp(null);
focus.setModifyTimestamp(null);
} else {
focus.setPasswordCreateTimestamp(input.getCreateTimestamp());
focus.setModifyTimestamp(input.getModifyTimestamp());
}
return focus;
}
use of com.evolveum.midpoint.repo.sql.data.common.RFocus in project midpoint by Evolveum.
the class PhotoUpdate method handlePropertyDelta.
public void handlePropertyDelta() throws SchemaException {
if (!(object instanceof RFocus)) {
throw new SystemException("Bean is not instance of " + RFocus.class + ", shouldn't happen");
}
RFocus focus = (RFocus) object;
Set<RFocusPhoto> photos = focus.getJpegPhoto();
if (isDelete()) {
photos.clear();
return;
}
MapperContext context = new MapperContext();
context.setRepositoryContext(beans.createRepositoryContext());
context.setDelta(delta);
context.setOwner(object);
PrismValue value = delta.getAnyValue();
RFocusPhoto photo = beans.prismEntityMapper.map(value.getRealValue(), RFocusPhoto.class, context);
if (delta.isAdd()) {
if (!photos.isEmpty()) {
throw new SchemaException("Object '" + focus.getOid() + "' already contains photo");
}
photo.setTransient(true);
photos.add(photo);
return;
}
if (photos.isEmpty()) {
photo.setTransient(true);
photos.add(photo);
return;
}
RFocusPhoto oldPhoto = photos.iterator().next();
oldPhoto.setPhoto(photo.getPhoto());
}
Aggregations