String typeId = typeIdPG.getTypeIdentification();
String typeId = inv.getItemIdentificationPG().getItemIdentification(); int idx = typeId.indexOf(':'); typeId = typeId.substring(idx+1);
    public void execute( 			HttpServletRequest req, 			HttpServletResponse res) throws IOException    {	LogisticsInventoryPG logInvPG=null;      	this.out = res.getOutputStream();                   int len = req.getContentLength();      if (len > 0) {	  //logger.debug("READ from content-length["+len+"]");	InputStream in = req.getInputStream();        BufferedReader bin = new BufferedReader(new InputStreamReader(in));        desiredAssetName = bin.readLine();        bin.close();	desiredAssetName = desiredAssetName.trim();	logger.info("POST DATA: " + desiredAssetName);      } else {	logger.warn(" No asset to plot");	return;      }            // return list of asset names      if (desiredAssetName.equals(ASSET)||	  desiredAssetName.startsWith(ASSET_AND_CLASSTYPE)) {		  //DemandObjectPredicate assetNamePredicate;	AssetPredicate assetNamePredicate;		if(desiredAssetName.startsWith(ASSET_AND_CLASSTYPE)) {	  String desiredClassType = desiredAssetName.substring(ASSET_AND_CLASSTYPE.length());	  //assetNamePredicate = new DemandObjectPredicate(desiredClassType);	  assetNamePredicate = new AssetPredicate(desiredClassType,logger);	}	else {	    //assetNamePredicate = new DemandObjectPredicate();	  assetNamePredicate = new AssetPredicate(logger);	}		// Asset no demand type handling	/***	 **	 */	 	 Vector assetNames = new Vector();	 Collection container = support.queryBlackboard(assetNamePredicate);	 for (Iterator i = container.iterator(); i.hasNext(); ) {	 Inventory inv = (Inventory)(i.next());	 logInvPG=null;	 logInvPG = (LogisticsInventoryPG)inv.searchForPropertyGroup(LogisticsInventoryPG.class);	 TypeIdentificationPG typeIdPG = logInvPG.getResource().getTypeIdentificationPG();	 String nomenclature = typeIdPG.getNomenclature();	 String typeId = typeIdPG.getTypeIdentification();	 if (nomenclature != null) {	     nomenclature = nomenclature + ":" + typeId;	 }	 else if(logInvPG.getIsLevel2()) {	     SupplyClassPG supplyPG = (SupplyClassPG)logInvPG.getResource().searchForPropertyGroup(SupplyClassPG.class);	     if (supplyPG != null) {		 nomenclature = typeId + ":" + supplyPG.getSupplyType();	     }	     else {		 nomenclature = typeId;	     }	 }	 else {	     nomenclature = typeId;	 }	 assetNames.addElement(nomenclature);	 }	 	 /***	  * Below is for Demand Object Predicate	  * MWD fix and try this out -below	  * MWD get rid of old commented out above replaced by below	  * to get demand even where no inventories.	  ***		HashSet assetNamesSet = new HashSet();	Collection container = support.queryBlackboard(assetNamePredicate);		for (Iterator i = container.iterator(); i.hasNext(); ) {	  Asset asset = ((Task)(i.next())).getDirectObject();	  TypeIdentificationPG typeIdPG = asset.getTypeIdentificationPG();	  String nomenclature = typeIdPG.getNomenclature();	  String typeId = typeIdPG.getTypeIdentification();	  if (nomenclature != null)	    nomenclature = nomenclature + ":" + typeId;	  else	    nomenclature = typeId;	  assetNamesSet.add(nomenclature);	}		Vector assetNames = new Vector(assetNamesSet);	 ****/		// send the results	ObjectOutputStream p = new ObjectOutputStream(out);	p.writeObject(assetNames);        logger.info("Sent asset names");	return;      } // end returning list of asset names            if (desiredAssetName.startsWith("UID:")) {	String desiredAssetUID = desiredAssetName.substring(4);	Collection collection = support.queryBlackboard(new AssetUIDPredicate(desiredAssetUID,logger));      	for (Iterator i = collection.iterator(); i.hasNext(); ) {	 Inventory inv = (Inventory)(i.next());	 logInvPG=null;	 logInvPG = (LogisticsInventoryPG)inv.searchForPropertyGroup(LogisticsInventoryPG.class);	 TypeIdentificationPG typeIdPG = logInvPG.getResource().getTypeIdentificationPG();	 String nomenclature = typeIdPG.getNomenclature();	 String typeId = typeIdPG.getTypeIdentification();	 if (nomenclature == null)	     return;	 desiredAssetName = nomenclature + ":" + typeId;	}      } // end getting asset name from UID            Date startDay=getStartDate();      // get roles and determine if this cluster is a provider (or consumer)      //logger.debug("\n****** look for roles for agent \""+support.getEncodedAgentName()+"\"");      /**** MWD do we still need to know if we are a provider or not?       ** all the role predicate code below      RolePredicate rolePred = new RolePredicate(support.getEncodedAgentName());      Collection roleCollection = support.queryBlackboard(rolePred);          boolean provider = false;      if (!roleCollection.isEmpty()) {	Organization asset = (Organization) roleCollection.iterator().next();      	Collection roles = asset.getOrganizationPG().getRoles();        if (roles != null) {	  Iterator i = roles.iterator();	  while (i.hasNext()) {	    Role role = (Role)i.next();	    if (role.getName().endsWith("Provider")) {	      provider = true;	      break;	    }	  }	}	      }      *****/      // get asset and tasks we need to create the inventory      logger.debug("Getting Inventory w/InventoryPredicate for " + desiredAssetName);          InventoryPredicate inventoryPredicate = new InventoryPredicate(desiredAssetName, support.getEncodedAgentName(),logger);      Collection collection = support.queryBlackboard(inventoryPredicate);          if (collection.isEmpty()) {        logger.warn("\n\n ************* collection is empty; return no response!");	return;      }          // create UIInventory data object from the log plan objects      String xmlStr = getXMLFromLogPlan(collection,startDay);          // set values in UISimpleInventory, a serializable object      //UISimpleInventory simpleInventory =       //getInventoryForClient(inventory, provider, startDay);      // send the String object      if ((xmlStr != null) && 	  (!(xmlStr.trim().equals("")))){	  //ObjectOutputStream p = new ObjectOutputStream(out);	//logger.debug("\n\n\n\n sending back a non-null inventory:\n"+simpleInventory);	  //p.writeObject(xmlStr);	  BufferedWriter p = new BufferedWriter(new OutputStreamWriter(out,Charset.forName("ASCII")));	  p.write(xmlStr);	  p.flush();    p.close();	logger.info("Sent XML document");      } else {        logger.error("XML string is null or empty.  returning null response.");      }    }