Class CurrentPermissionsWriter

  • All Implemented Interfaces:
    com.fasterxml.jackson.databind.BeanProperty, com.fasterxml.jackson.databind.util.Named, Serializable

    public class CurrentPermissionsWriter
    extends com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter
    The CurrentPermissionsWriter is applied to AclAwareModel and it instructs Jackson to include Permissions for current SID for every ACL aware entity. The serialization of Permissions as "_permissions" property is enabled with the @JsonAppend annotation on AclAwareModel:
      @JsonAppend(props = { @JsonAppend.Prop(name="_permissions", value = CurrentPermissionsWriter.class, type=CurrentPermissions.class) })
      public interface AclAwareModel...
     
    To be able to access the current permissions of the current SID, this code requires that an instance of org.genesys.blocks.util.CurrentApplicationContext is registered in the Spring application context.

    Writer can be disabled with @JsonView(CurrentPermissionsWriter.NoPermissions.class) (or a JsonView extending it):

      static interface RootNoPermissions extends JsonViews.Root, CurrentPermissionsWriter.NoPermissions { }
     
    or by mix-in that ignores Permissions type:
      @JsonIgnoreType
      public class MyMixInForIgnoreType {}
      ...
      mapper.addMixIn(Permissions.class, MyMixInForIgnoreType.class);
     
    See Also:
    Serialized Form
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static interface  CurrentPermissionsWriter.NoPermissions
      Use this JsonView to exclude permission checks!
      • Nested classes/interfaces inherited from interface com.fasterxml.jackson.databind.BeanProperty

        com.fasterxml.jackson.databind.BeanProperty.Bogus, com.fasterxml.jackson.databind.BeanProperty.Std
    • Field Summary

      • Fields inherited from class com.fasterxml.jackson.databind.ser.BeanPropertyWriter

        _accessorMethod, _cfgSerializationType, _contextAnnotations, _declaredType, _dynamicSerializers, _field, _includeInViews, _internalSettings, _member, _name, _nonTrivialBaseType, _nullSerializer, _serializer, _suppressableValue, _suppressNulls, _typeSerializer, _wrapperName, MARKER_FOR_EMPTY
      • Fields inherited from class com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase

        _aliases, _metadata
      • Fields inherited from interface com.fasterxml.jackson.databind.BeanProperty

        EMPTY_FORMAT, EMPTY_INCLUDE
    • Constructor Summary

      Constructors 
      Constructor Description
      CurrentPermissionsWriter()
      Instantiates a new current permissions writer.
      CurrentPermissionsWriter​(com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition propDef, com.fasterxml.jackson.databind.util.Annotations annotations, com.fasterxml.jackson.databind.JavaType type)
      Instantiates a new current permissions writer.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected Object value​(Object bean, com.fasterxml.jackson.core.JsonGenerator gen, com.fasterxml.jackson.databind.SerializerProvider prov)  
      com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter withConfig​(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config, com.fasterxml.jackson.databind.introspect.AnnotatedClass declaringClass, com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition propDef, com.fasterxml.jackson.databind.JavaType type)  
      • Methods inherited from class com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter

        _suppressableValue, _suppressNulls, isVirtual, serializeAsElement, serializeAsField
      • Methods inherited from class com.fasterxml.jackson.databind.ser.BeanPropertyWriter

        _depositSchemaProperty, _findAndAddDynamic, _handleSelfReference, _new, assignNullSerializer, assignSerializer, assignTypeSerializer, depositSchemaProperty, depositSchemaProperty, fixAccess, get, getAnnotation, getContextAnnotation, getFullName, getGenericPropertyType, getInternalSetting, getMember, getName, getPropertyType, getRawSerializationType, getSerializationType, getSerializedName, getSerializer, getType, getTypeSerializer, getViews, getWrapperName, hasNullSerializer, hasSerializer, isUnwrapping, removeInternalSetting, rename, serializeAsOmittedField, serializeAsPlaceholder, setInternalSetting, setNonTrivialBaseType, toString, unwrappingWriter, willSuppressNulls, wouldConflictWithName
      • Methods inherited from class com.fasterxml.jackson.databind.ser.PropertyWriter

        findAnnotation
      • Methods inherited from class com.fasterxml.jackson.databind.introspect.ConcreteBeanPropertyBase

        findAliases, findFormatOverrides, findPropertyFormat, findPropertyInclusion, getMetadata, isRequired
    • Constructor Detail

      • CurrentPermissionsWriter

        public CurrentPermissionsWriter()
        Instantiates a new current permissions writer.
      • CurrentPermissionsWriter

        public CurrentPermissionsWriter​(com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition propDef,
                                        com.fasterxml.jackson.databind.util.Annotations annotations,
                                        com.fasterxml.jackson.databind.JavaType type)
        Instantiates a new current permissions writer.
        Parameters:
        propDef - the prop def
        annotations - the annotations
        type - the type
    • Method Detail

      • value

        protected Object value​(Object bean,
                               com.fasterxml.jackson.core.JsonGenerator gen,
                               com.fasterxml.jackson.databind.SerializerProvider prov)
                        throws Exception
        Specified by:
        value in class com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter
        Throws:
        Exception
      • withConfig

        public com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter withConfig​(com.fasterxml.jackson.databind.cfg.MapperConfig<?> config,
                                                                                       com.fasterxml.jackson.databind.introspect.AnnotatedClass declaringClass,
                                                                                       com.fasterxml.jackson.databind.introspect.BeanPropertyDefinition propDef,
                                                                                       com.fasterxml.jackson.databind.JavaType type)
        Specified by:
        withConfig in class com.fasterxml.jackson.databind.ser.VirtualBeanPropertyWriter