Search in sources :

Example 1 with RFocus

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);
}
Also used : MapperContext(com.evolveum.midpoint.repo.sql.helpers.modify.MapperContext) SystemException(com.evolveum.midpoint.util.exception.SystemException) RFocus(com.evolveum.midpoint.repo.sql.data.common.RFocus) PrismValue(com.evolveum.midpoint.prism.PrismValue)

Example 2 with RFocus

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;
}
Also used : RFocus(com.evolveum.midpoint.repo.sql.data.common.RFocus)

Example 3 with RFocus

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());
}
Also used : SchemaException(com.evolveum.midpoint.util.exception.SchemaException) MapperContext(com.evolveum.midpoint.repo.sql.helpers.modify.MapperContext) SystemException(com.evolveum.midpoint.util.exception.SystemException) RFocusPhoto(com.evolveum.midpoint.repo.sql.data.common.RFocusPhoto) RFocus(com.evolveum.midpoint.repo.sql.data.common.RFocus) PrismValue(com.evolveum.midpoint.prism.PrismValue)

Aggregations

RFocus (com.evolveum.midpoint.repo.sql.data.common.RFocus)3 PrismValue (com.evolveum.midpoint.prism.PrismValue)2 MapperContext (com.evolveum.midpoint.repo.sql.helpers.modify.MapperContext)2 SystemException (com.evolveum.midpoint.util.exception.SystemException)2 RFocusPhoto (com.evolveum.midpoint.repo.sql.data.common.RFocusPhoto)1 SchemaException (com.evolveum.midpoint.util.exception.SchemaException)1