/*
 * This code is subject to the HIEOS License, Version 1.0
 *
 * Copyright(c) 2008-2009 Vangent, Inc.  All rights reserved.
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 *
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.vangent.hieos.xclient.xds.registry;

import java.util.ArrayList;
import org.apache.axiom.om.OMElement;

import com.vangent.hieos.xutil.metadata.structure.MetadataSupport;

public class GetRelatedDocuments extends Sq {
	ArrayList<String> ids = null;

	String query_details() {
		return "GetRelatedDocuments " + ids;
	}

	OMElement build(ArrayList<String> ids) {
		this.ids = ids;
		ArrayList<OMElement> query = build_query_wrapper(MetadataSupport.SQ_GetRelatedDocuments);

		if (ids.get(0).startsWith("urn:uuid:")) 
			add_slot(query, "$XDSDocumentEntryEntryUUID", this.query_singleton(ids));
		else
			add_slot(query, "$XDSDocumentEntryUniqueId", this.query_singleton(ids));

		ArrayList<String> atypes = new ArrayList<String>();


		atypes.add("('" + MetadataSupport.xdsB_ihe_assoc_type_rplc + "')");
        atypes.add("('" + MetadataSupport.xdsB_ihe_assoc_type_xfrm + "')");
		atypes.add("('" + MetadataSupport.xdsB_ihe_assoc_type_apnd + "')");
		atypes.add("('" + MetadataSupport.xdsB_ihe_assoc_type_xfrm_rplc + "')");
		atypes.add("('" + MetadataSupport.xdsB_ihe_assoc_type_signs + "')");
		atypes.add("('" + MetadataSupport.xdsB_eb_assoc_type_has_member + "')");

		add_slot(query, "$AssociationTypes", atypes);
		return query.get(0);
	}


}

@@ -1305,16 +1305,24 @@
 %22')%22);%0D%0A
+        
         
@@ -1684,16 +1684,109 @@
  %22')%22);%0D
+%0A                atypes.add(%22('%22 + MetadataSupport.xdsB_ihe_assoc_type_issnapshotof + %22')%22);%0D
 %0A%0D%0A%09%09add

test code rework