File tree Expand file tree Collapse file tree 1 file changed +9
-7
lines changed
lightblue-ldap-metadata/src/main/java/com/redhat/lightblue/metadata/ldap/model Expand file tree Collapse file tree 1 file changed +9
-7
lines changed Original file line number Diff line number Diff line change 20
20
21
21
import java .util .HashMap ;
22
22
import java .util .Map ;
23
- import java .util .Map .Entry ;
24
23
24
+ import com .google .common .collect .BiMap ;
25
+ import com .google .common .collect .HashBiMap ;
25
26
import com .redhat .lightblue .common .ldap .LdapFieldNameTranslator ;
26
27
import com .redhat .lightblue .util .Path ;
27
28
34
35
*/
35
36
public class LdapMetadata implements LdapFieldNameTranslator {
36
37
37
- private final Map <Path , String > fieldsToAttributes = new HashMap < Path , String > ();
38
+ private final BiMap <Path , String > fieldsToAttributes = HashBiMap . create ();
38
39
39
40
/**
40
41
* Returns an immutable copy of the internal collection of {@link FieldAttributeMapping}s.
@@ -62,12 +63,13 @@ public String translateFieldName(Path path){
62
63
63
64
@ Override
64
65
public Path translateAttributeName (String attributeName ){
65
- for ( Entry < Path , String > f2a : fieldsToAttributes .entrySet ()){
66
- if ( f2a . getValue (). equalsIgnoreCase ( attributeName )){
67
- return f2a . getKey ();
68
- }
66
+ Path fieldPath = fieldsToAttributes .inverse (). get ( attributeName );
67
+
68
+ if ( fieldPath == null ){
69
+ return new Path ( attributeName );
69
70
}
70
- return new Path (attributeName );
71
+
72
+ return fieldPath ;
71
73
}
72
74
73
75
/**
You can’t perform that action at this time.
0 commit comments