private void processReferencedTypes ( RegistryEntry pidEntry ) { //parent first, AD has a reference pid for ( ExtendedAttributeDefinition ad : pidEntry . getAttributeMap ( ) . values ( ) ) { if ( ad . getType ( ) == MetaTypeFactory . PID_TYPE ) { if ( ad . getReferencePid ( ) != null ) { RegistryEntry other = getRegistryEntry ( ad . getReferencePid ( ) ) ; if ( other != null ) { PidReference ref = new PidReference ( other , pidEntry , ad . getID ( ) , true ) ; other . addReferencingEntry ( ref ) ; pidEntry . addReferencedEntry ( ref ) ; } } else if ( ad . getService ( ) != null ) { addServiceUse ( ad . getService ( ) , pidEntry ) ; } else { // Error.. should always be caught by metatype validation.. warn anyway? } } } //child first, child has a parentPid if ( pidEntry . getObjectClassDefinition ( ) . getParentPID ( ) != null ) { RegistryEntry other = getRegistryEntry ( pidEntry . getObjectClassDefinition ( ) . getParentPID ( ) ) ; if ( other != null ) { pidEntry . addReferencingEntry ( new PidReference ( pidEntry , other , pidEntry . getChildAlias ( ) , false ) ) ; } //else.... this should go into invalidParentEntryMap } //see if anyone is referencing us. for ( RegistryEntry other : entryMap . values ( ) ) { if ( pidEntry . getPid ( ) . equals ( other . getObjectClassDefinition ( ) . getParentPID ( ) ) ) { other . addReferencingEntry ( new PidReference ( other , pidEntry , other . getChildAlias ( ) , false ) ) ; } for ( ExtendedAttributeDefinition ad : other . getAttributeMap ( ) . values ( ) ) { if ( ad . getType ( ) == MetaTypeFactory . PID_TYPE ) { if ( pidEntry . getPid ( ) . equals ( ad . getReferencePid ( ) ) ) { pidEntry . addReferencingEntry ( new PidReference ( pidEntry , other , ad . getID ( ) , true ) ) ; //TODO deal with service/objectclass here? } } } } }
Keeps track of which OCDs are referenced by a PID type attribute in another OCD