GLMDebug.DEBUG("*****ConstructionInventoryPlugin","<"+supplytype+"> createInventory - fail to create inventory for "+id);
if (logger.isDebugEnabled()) { logger.debug("*****ConstructionInventoryPlugin" + "<" + supplytype + "> createInventory - fail to create inventory for " + id); }
    public Inventory createInventory(String supplytype, Asset resource) {      String id = resource.getTypeIdentificationPG().getTypeIdentification();      GLMDebug.DEBUG("*****ConstructionInventoryPlugin:  createInventory()", "<"+supplytype+"> createInventory for "+id);      GregorianCalendar reportBaseDate = null;      int reportStepKind = 0;      boolean success = false;      InventoryBG bg = null;      NewInventoryPG invpg = (NewInventoryPG)org.cougaar.glm.ldm.asset.PropertyGroupFactory.newInventoryPG();      InventoryPlugin.InventoryItemInfo info = null;      double [] levels = null;      info = (InventoryPlugin.InventoryItemInfo) inventoryInitHash_.get(id);      invpg.setResource(resource);      Agency agency = myOrganization_.getOrganizationPG().getAgency();      if (inventoryInitHash_.isEmpty()) {        double [] temp_levels = {capacity, init_level, erq, min_reorder};        levels = (double [])temp_levels;      }      if ((info != null) && (levels == null)) {        //GLMDebug.DEBUG(className_, clusterId_,"*****ConstructionInventoryPlugin: info not null and levels null");        levels = (double[])info.levels;      }      // Try to initialize the inventory behavior group, if it fails this cluster      // does not handle the item.      if (levels != null) {        bg  = new ConstructionInventoryBG(invpg);        success = ((ConstructionInventoryBG)bg).initialize(levels);        if (info != null) {          if (info.reportBase != null) {            reportBaseDate = info.reportBase;            reportStepKind = info.reportStepKind;          }        }      }      if (!success) {        GLMDebug.DEBUG("*****ConstructionInventoryPlugin", getMessageAddress(), "createInventory(), cannot create inventory for "+id);        return null;      }      Inventory inventory = null;      inventory=(Inventory) theLDMF.createAsset("Inventory");      if (inventory == null) {        GLMDebug.DEBUG("*****ConstructionInventoryPlugin","<"+supplytype+"> createInventory - fail to create inventory for "+id);        return null;      }      invpg.setInvBG(bg);      bg.setProjectionWeight(getProjectionWeight(supplytype));      inventory.addOtherPropertyGroup(invpg);      long time = getMyDelegate().currentTimeMillis();      invpg.resetInventory(inventory, time);      invpg.clearContentSchedule(inventory);      NewTypeIdentificationPG ti = (NewTypeIdentificationPG)inventory.getTypeIdentificationPG();      ti.setTypeIdentification("InventoryAsset");      ti.setNomenclature("Inventory Asset");      ((NewItemIdentificationPG) inventory.getItemIdentificationPG()).setItemIdentification("Inventory:" + id);      NewScheduledContentPG scp;      scp = (NewScheduledContentPG)inventory.getScheduledContentPG();      scp.setAsset(resource);      if (reportBaseDate != null) {        NewReportSchedulePG nrsp = org.cougaar.glm.ldm.asset.PropertyGroupFactory.newReportSchedulePG();        nrsp.setBase(info.reportBase);        nrsp.setStep(info.reportStepKind);        inventory.setReportSchedulePG(nrsp);        //System.out.println("setReportSchedulePG " + info.reportBase);      }      return inventory;    }