Class: ActiveLdap::Adapter::JndiConnection::ModifyRecord — activeldap - ActiveLdap

Class: ActiveLdap::Adapter::JndiConnection::ModifyRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/active_ldap/adapter/jndi_connection.rb

Constant Summary

DirContext =
directory.DirContext
BasicAttribute =
directory.BasicAttribute
ADD_ATTRIBUTE =
DirContext::ADD_ATTRIBUTE
REPLACE_ATTRIBUTE =
DirContext::REPLACE_ATTRIBUTE
REMOVE_ATTRIBUTE =
DirContext::REMOVE_ATTRIBUTE

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ModifyRecord) initialize(type, name, values, binary)

Returns a new instance of ModifyRecord



50
51
52
53
54
55
# File 'lib/active_ldap/adapter/jndi_connection.rb', line 50

def initialize(type, name, values, binary)
  @type = self.class.const_get("#{type.to_s.upcase}_ATTRIBUTE")
  @name = name
  @values = values
  @binary = binary
end

Instance Attribute Details

- (Object) name (readonly)

Returns the value of attribute name



49
50
51
# File 'lib/active_ldap/adapter/jndi_connection.rb', line 49

def name
  @name
end

- (Object) type (readonly)

Returns the value of attribute type



49
50
51
# File 'lib/active_ldap/adapter/jndi_connection.rb', line 49

def type
  @type
end

- (Object) values (readonly)

Returns the value of attribute values



49
50
51
# File 'lib/active_ldap/adapter/jndi_connection.rb', line 49

def values
  @values
end

Instance Method Details

- (Boolean) binary?

Returns:

  • (Boolean)


57
58
59
# File 'lib/active_ldap/adapter/jndi_connection.rb', line 57

def binary?
  @binary
end

- (Object) to_java_attribute



65
66
67
68
69
70
71
72
73
# File 'lib/active_ldap/adapter/jndi_connection.rb', line 65

def to_java_attribute
  attribute = BasicAttribute.new(@name)
  values = @values
  values = values.collect(&:to_java_bytes) if binary?
  values.each do |value|
    attribute.add(value)
  end
  attribute
end

- (Object) to_java_modification_item



61
62
63
# File 'lib/active_ldap/adapter/jndi_connection.rb', line 61

def to_java_modification_item
  ModificationItem.new(@type, to_java_attribute)
end