# Licensed Materials - Property of IBM
# 5724-I68
#
# (C) Copyright IBM Corp. 2000, 2006
#
# US Government Users Restricted Rights - Use, duplication, or
# disclosure restricted by GSA ADP Schedule Contract with IBM Corp.


. ${TOP}/bin/get_params.sh


${ECHO} "ENVEXPIMP_INFO_VALIDATION_MENU_OPTION_SH"
${ECHO} 
${ECHO} "ENVEXPIMP_INFO_VALIDATION_MENU_OPTION_1_SH"
${ECHO} "ENVEXPIMP_INFO_VALIDATION_MENU_OPTION_2_SH"

read menu_option_1

if [ $menu_option_1 = 1 ]; then
{
    ${ECHO}
	${ECHO} "ENVEXPIMP_INFO_VALIDATION_SELECT_XML_TYPE_SH"
    ${ECHO}
	${ECHO} "ENVEXPIMP_INFO_VALIDATION_XML_TYPE_LIST_SH"
	read menu_option_xmltype
    if [ $menu_option_xmltype -gt 33 ] || [ $menu_option_xmltype -lt 1 ]; then
    {
        ${ECHO}
		${ECHO} "ENVEXPIMP_INFO_VALIDATION_ENTER_1_AND_33_SH"
        exit
    }
    fi
    ${ECHO}
	${ECHO} "ENVEXPIMP_INFO_VALIDATION_ENTER_XML_PATH_SH"
	read xml_path 
	grep -i '<Action>DELETE</Action>' $TOP/$xml_path | wc -l > tmpfile
	read delete_action_count < "tmpfile"
	set path=""
	if [ $delete_action_count = 0 ]; then
		path="$TOP/src/db/envexpimp_xsd/without_delete"	
	else
		path="$TOP/src/db/envexpimp_xsd/with_delete"
	fi
	case $menu_option_xmltype in
		"1")
		path="$path/ACG.xsd"
		;;
		"2")
		path="$path/ALERT.xsd"
		;;
		"3")
		path="$path/ATTRIBUTE_COLS.xsd"
		;;
		"4")
		path="$path/CATALOG.xsd"
		;;
		"5")
		path="$path/CATALOG_VIEW.xsd"
		;;
		"6")
		path="$path/COLLABORATION_AREA.xsd"
		;;
		"7")
		path="$path/COMPANY_ATTRIBUTES.xsd"
		;;
		"8")
		path="$path/CONTAINER_ACCESSPRV.xsd"
		;;
		"9")
		path="$path/DATASOURCE.xsd"
		;;
		"10")
		path="$path/DISTRIBUTION.xsd"
		;;
		"11")
		path="$path/DISTRIBUTION_GROUP.xsd"
		;;
		"12")
		path="$path/DOCSTORE.xsd"
		;;
		"13")
		path="$path/EXPORTS.xsd"
		;;
		"14")
		path="$path/FEEDS.xsd"
		;;
		"15")
		path="$path/HIERARCHY.xsd"
		;;
		"16")
		path="$path/HIERARCHY_MAPS.xsd"
		;;
		"17")
		path="$path/HIERARCHY_VIEW.xsd"
		;;
		"18")
		path="$path/JOBS.xsd"
		;;
		"19")
		path="$path/LOOKUP_TABLE.xsd"
		;;
		"20")
		path="$path/MAP.xsd"
		;;
		"21")
		path="$path/MY_SETTINGS.xsd"
		;;
		"22")
		path="$path/ORG_HIERARCHY.xsd"
		;;
		"23")
		path="$path/QUEUE.xsd"
		;;
		"24")
		path="$path/REPORTS.xsd"
		;;
		"25")
		path="$path/ROLES.xsd"
		;;
		"26")
		path="$path/ROLE_LOCALE_ACCESS.xsd"
		;;
		"27")
		path="$path/SEARCH_TEMPLATES.xsd"
		;;
		"28")
		path="$path/SELECTION.xsd"
		;;
		"29")
		path="$path/SPECS.xsd"
		;;
		"30")
		path="$path/UDL.xsd"
		;;
		"31")
		path="$path/USERS.xsd"
		;;
		"32")
		path="$path/WEB_SERVICE.xsd"
		;;
		"33")
		path="$path/WORKFLOW.xsd"
		;;
		*)
        exit
	esac
    ${ECHO}
	$JAVA_RT com.ibm.ccd.envexpimp.utils.XMLValidator $TOP/$xml_path $path
}
elif [ $menu_option_1 = 2 ]; then
{
    ${ECHO}
	${ECHO} "ENVEXPIMP_INFO_VALIDATION_ENTER_XML_PATH_SH"
	read xml_path
	${ECHO} "ENVEXPIMP_INFO_VALIDATION_ENTER_XSD_PATH_SH"
	read xsd_path
    ${ECHO}
	$JAVA_RT com.ibm.ccd.envexpimp.utils.XMLValidator $TOP/$xml_path $TOP/$xsd_path 	
}
else
{
	${ECHO} "ENVEXPIMP_INFO_VALIDATION_ENTER_1_OR_2_SH"
}
fi
