Vector transferredPGs = assetT.fetchAllProperties();  for (Iterator pgIterator = transferredPGs.iterator(); pgIterator.hasNext();) { Object next = pgIterator.next();   if (!(next instanceof LocalPG)) { if (next instanceof PropertyGroup) { assetL.addOtherPropertyGroup((PropertyGroup) next); } else if (next instanceof PropertyGroupSchedule) { assetL.addOtherPropertyGroupSchedule((PropertyGroupSchedule) next); } else { logger.error("ReceiveAssetLP: unrecognized property type - " + next + " - on transferred asset " + assetL); } } } } else { if (aa.isUpdate() || aa.isRepeat()) { logger.error("Received Update Asset Transfer, but cannot find original "+ aa); }
changePGRequired = updatePG(assetT, assetL);
  private void receiveAssetAssignment(AssetAssignment aa) {    // figure out the assignee    Asset assigneeT = aa.getAssignee();// assignee from message    Asset assigneeL = logplan.findAsset(assigneeT); // local assignee instance        if (assigneeL == null) {      logger.error("ReceiveAssetLP: Unable to find receiving asset " +                    assigneeT + " in "+self);      return;    }    Asset assignee = assigneeL;    // figure out the asset being transferred    Asset assetT = aa.getAsset();   // asset from message    Asset assetL = logplan.findAsset(assetT);// local instance of asset    Asset asset = assetL;    if (asset == null) {      // Clone to ensure that we don't end up with cross agent asset       // references      asset = ldmf.cloneInstance(assetT);      if (related(asset)) {        ((HasRelationships) asset).setLocal(false);      }    }     boolean updateRelationships =      aa.getSchedule() != null && related(assetT) && related(assignee);    //Only munge relationships pertinent to the transfer - requires that     //both receiving and transferring assets have relationship schedules    if (updateRelationships) {      HasRelationships dob = ((HasRelationships)asset);      NewRelationshipSchedule rs_a;      if (assetL == null) {        // Serialized object does not include a relationship schedule        rs_a = ldmf.newRelationshipSchedule(dob);        dob.setRelationshipSchedule(rs_a);              } else {        rs_a = (NewRelationshipSchedule)dob.getRelationshipSchedule();      }      HasRelationships iob = ((HasRelationships)assignee);      NewRelationshipSchedule rs_assignee =         (NewRelationshipSchedule)iob.getRelationshipSchedule();      if (aa.isUpdate() || aa.isRepeat()) {        removeExistingRelationships(aa.getSchedule(), rs_a, rs_assignee);      }      addRelationships(aa, rs_a, rs_assignee);            Collection changeReports = new ArrayList();      changeReports.add(new RelationshipSchedule.RelationshipScheduleChangeReport());      rootplan.change(assignee, changeReports);    }    if (assetL != null) {      // If we already had a matching asset - update with property groups      // from the asset transfer.      Vector transferredPGs = assetT.fetchAllProperties();      for (Iterator pgIterator = transferredPGs.iterator();           pgIterator.hasNext();) {        Object next = pgIterator.next();        //Don't overwrite LocalPGs        if (!(next instanceof LocalPG)) {          if (next instanceof PropertyGroup) {            assetL.addOtherPropertyGroup((PropertyGroup) next);          } else if (next instanceof PropertyGroupSchedule) {            assetL.addOtherPropertyGroupSchedule((PropertyGroupSchedule) next);          } else {            logger.error("ReceiveAssetLP: unrecognized property type - " +                          next + " - on transferred asset " + assetL);          }        }      }    } else {      if (aa.isUpdate() || aa.isRepeat()) {        logger.error("Received Update Asset Transfer, but cannot find original "+ aa);      }     }    // fix up the available schedule for the transferring asset    if (aa.getSchedule() != null) {      fixAvailSchedule(aa, asset, assignee);    }          // publish the add or change    if (assetL == null) {            // add it if it wasn't already there      rootplan.add(asset);    } else {      if (updateRelationships) {        Collection changeReports = new ArrayList();        changeReports.add(new RelationshipSchedule.RelationshipScheduleChangeReport());        rootplan.change(asset, changeReports);      } else {        rootplan.change(asset, null);      }    }  }