Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Translate the entire conversation x

Add AVL by java code

KT_10111965
4-Participant

Add AVL by java code

here the code I use it : and awues having thsi exception : Loader method com.ptc.windchill.suma.axl.LoadAXL.addAVL reported a failure
No objects were imported due to the error.
found exception:wt.util.WTException: error to create AVL and AML: Message: Resource bundle/Message key = wt.ixb.publicforhandlers.ixbResource/8
wt.util.WTException: error to create AVL and AML: Message: Resource bundle/Message key = wt.ixb.publicforhandlers.ixbResource/8

 

   */
	public static void linkLEONIPart2Partner(WTPart leoniPart,
			VendorPart vendorPart, ManufacturerPart manuPart, String context)
			throws WTException {
		try {
			File fData = File.createTempFile("leoparts", ".xml",
					new File(LeoniPropertiesReader.get().getLeoniTempFolder()));
			FileOutputStream fos = new FileOutputStream(
					fData.getAbsolutePath(), false);
			String content = "<?xml version='1.0' encoding='UTF-8'?>\n"
					+ "<!DOCTYPE NmLoader SYSTEM 'standardX10.dtd'>\n"
					+ "<NmLoader>\n";


			if (vendorPart != null && manuPart == null) {
				content = content
						+ "<csvAddAVL handler='com.ptc.windchill.suma.axl.LoadAXL.addAVL'>\n"
						+ "<csvOEMPartNumber>"
						+ convertSpecialCharactersForXML(leoniPart.getNumber())
						+ "</csvOEMPartNumber>\n"
						+ "<csvOEMVersion/>\n"
						+ "<csvOEMIteration/>\n"
						+ "<csvOEMView/>\n"
						+ "<csvOEMOrganizationID/>\n"
						+ "<csvOEMOrganizationName/>\n"
						+ "<csvsourcingContext>"
						+ (context != null && context.length() > 0 ? context
								: "Default")
						+ "</csvsourcingContext>\n"
						+ "<csvvendorPartNumber>"
						+ convertSpecialCharactersForXML(vendorPart.getNumber())
						+ "</csvvendorPartNumber>\n"
						+ "<csvvendorName>"
						+ convertSpecialCharactersForXML(vendorPart
								.getOrganizationName())
						+ "</csvvendorName>\n"
						+ "<csvvendorID>"
						+ vendorPart.getOrganizationCodingSystem()
						+ "$"
						+ vendorPart.getOrganization().getUniqueIdentifier()
						+ "</csvvendorID>\n"
						+ "<csvvendorPartContainer>/wt.inf.container.OrgContainer=LeoniUBB/wt.inf.library.WTLibrary="
						+ vendorPart.getContainerName()
						+ "</csvvendorPartContainer>\n"
						+ "<csvvendorSourcingStatus>approved</csvvendorSourcingStatus>\n"
						+ "<csvmanufacturerPartNumber></csvmanufacturerPartNumber>\n"
						+ "<csvmanufacturerName></csvmanufacturerName>\n"
						+ "<csvmanufacturerID></csvmanufacturerID>\n"
						+ "<csvmanufacturerPartContainer></csvmanufacturerPartContainer>\n"
						+ "</csvAddAVL>\n";
			}


			content = content + "</NmLoader>\n";

			fos.write(content.getBytes("UTF-8"));
			fos.close();

			java.util.Hashtable hashtable = new java.util.Hashtable();
			hashtable.put("CONT_PATH",
					"/wt.inf.container.OrgContainer=LeoniUBB");
			wt.load.LoadFromFile.doFileImport(fData.getAbsolutePath(), null,
					null, "wcadmin", null, null, hashtable);

			fData.delete();
		} catch (Exception e) {
			log.error(e.getMessage(), e);
			throw new WTException("error to create AVL and AML: "
					+ e.getMessage());
		}
	}

 

ACCEPTED SOLUTION

Accepted Solutions
HelesicPetr
22-Sapphire II
(To:KT_10111965)

Hi @KT_10111965 

You should share full error log. with all information around

This just say that system does not contains some resource bundle definition. It can mean that your source XML file has bad values for import.

 

It is very complicated to say what is wrong because always it can be anything. 

PetrH

View solution in original post

2 REPLIES 2
avillanueva
22-Sapphire II
(To:KT_10111965)

This is not the recommended method of loading this data. the XML import from a CSV is done via commandline, not Java code. you can also do this via a Excel sheet in the interface. Why are you looking to do this via Java code?

HelesicPetr
22-Sapphire II
(To:KT_10111965)

Hi @KT_10111965 

You should share full error log. with all information around

This just say that system does not contains some resource bundle definition. It can mean that your source XML file has bad values for import.

 

It is very complicated to say what is wrong because always it can be anything. 

PetrH

Announcements
Top Tags