Exemple #1
0
  private boolean hasBeenSynchronized(Collection targetSynchronizations) {
    // See if this origin is already synchronized to the target repository
    boolean hasBeenSynchronized = false;
    Repository trgRep = getPenPolicy().getTargetRepository();
    String repDomain, repServer, repName;
    repDomain = trgRep.getDomainName();
    repServer = trgRep.getServerName();
    repName = trgRep.getName();
    Iterator i = targetSynchronizations.iterator();

    Origin trgOrigin = null;
    String trgDomain, trgServer, trgRepository;
    while (i.hasNext() && !hasBeenSynchronized) {
      trgOrigin = (Origin) i.next();
      trgDomain = trgOrigin.getDomainName();
      trgServer = trgOrigin.getServerName();
      trgRepository = trgOrigin.getDatasourceName();
      if (trgDomain.equalsIgnoreCase(repDomain)
          && trgServer.equalsIgnoreCase(repServer)
          && trgRepository.equalsIgnoreCase(repName)) {
        hasBeenSynchronized = true;
      }
    }
    return hasBeenSynchronized;
  }
Exemple #2
0
 private boolean hasBeenModified(Origin sourceOrigin) throws Exception {
   // if an earlier version was previously published
   boolean hasBeenModified = false;
   String name = sourceOrigin.getName();
   String srcDomain = sourceOrigin.getDomainName();
   String srcServer = sourceOrigin.getServerName();
   String srcRepository = sourceOrigin.getRepositoryName();
   Repository trgRep = getPenPolicy().getTargetRepository();
   String repDomain, repServer, repRepository;
   repDomain = trgRep.getDomainName();
   repServer = trgRep.getServerName();
   repRepository = trgRep.getName();
   // Get the synch records for this name
   SynchronizationService r = SynchronizationClient.getClient();
   Collection c = r.findNameSynchronization(srcDomain, srcServer, srcRepository, name);
   if (null == c || c.isEmpty()) return false;
   SynchronizationRecord rec = null;
   Iterator i = c.iterator();
   Origin o1, oa;
   Origin trgOrigin = null;
   String trgDomain, trgServer, trgRepository;
   while (i.hasNext() && !hasBeenModified) {
     rec = (SynchronizationRecord) i.next();
     o1 = rec.getOrigin0();
     oa = rec.getOriginA();
     // identify which origin is the target
     if (sourceOrigin.isFromSameDatasource(o1)) trgOrigin = oa;
     else if (sourceOrigin.isFromSameDatasource(oa)) trgOrigin = o1;
     else continue; // does not come from same source as sourceOrigin
     // see if the target origin for this name matches the target repository
     trgDomain = trgOrigin.getDomainName();
     trgServer = trgOrigin.getServerName();
     trgRepository = trgOrigin.getDatasourceName();
     if (trgDomain.equalsIgnoreCase(repDomain)
         && trgServer.equalsIgnoreCase(repServer)
         && trgRepository.equalsIgnoreCase(repRepository)) {
       hasBeenModified = true;
     }
   }
   return hasBeenModified;
 }