private void processRelationshipList ( final ParserType parserType , final SpecNodeWithRelationships tempNode , final HashMap < ParserType , String [ ] > variableMap , final List < Relationship > relationships , int lineNumber ) throws ParsingException { final String uniqueId = tempNode . getUniqueId ( ) ; String errorMessageFormat = null ; RelationshipType relationshipType ; switch ( parserType ) { case REFER_TO : errorMessageFormat = ProcessorConstants . ERROR_INVALID_REFERS_TO_RELATIONSHIP ; relationshipType = RelationshipType . REFER_TO ; break ; case LINKLIST : errorMessageFormat = ProcessorConstants . ERROR_INVALID_LINK_LIST_RELATIONSHIP ; relationshipType = RelationshipType . LINKLIST ; break ; case PREREQUISITE : errorMessageFormat = ProcessorConstants . ERROR_INVALID_PREREQUISITE_RELATIONSHIP ; relationshipType = RelationshipType . PREREQUISITE ; break ; default : return ; } if ( variableMap . containsKey ( parserType ) ) { final String [ ] relationshipList = variableMap . get ( parserType ) ; for ( final String relationshipId : relationshipList ) { if ( relationshipId . matches ( ProcessorConstants . RELATION_ID_REGEX ) ) { relationships . add ( new Relationship ( uniqueId , relationshipId , relationshipType ) ) ; } else if ( relationshipId . matches ( ProcessorConstants . RELATION_ID_LONG_REGEX ) ) { final Matcher matcher = RELATION_ID_LONG_PATTERN . matcher ( relationshipId ) ; matcher . find ( ) ; final String id = matcher . group ( "TopicID" ) ; final String relationshipTitle = matcher . group ( "TopicTitle" ) ; final String cleanedTitle = ProcessorUtilities . cleanXMLCharacterReferences ( relationshipTitle . trim ( ) ) ; relationships . add ( new Relationship ( uniqueId , id , relationshipType , ProcessorUtilities . replaceEscapeChars ( cleanedTitle ) ) ) ; } else { if ( relationshipId . matches ( "^(" + ProcessorConstants . TARGET_BASE_REGEX + "|[0-9]+).*?(" + ProcessorConstants . TARGET_BASE_REGEX + "|[0-9]+).*" ) ) { throw new ParsingException ( format ( ProcessorConstants . ERROR_MISSING_SEPARATOR_MSG , lineNumber , ' ' ) ) ; } else { throw new ParsingException ( format ( errorMessageFormat , lineNumber ) ) ; } } } } }
Processes a list of relationships for a specific relationship type from some line processed variables .