Esempio n. 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;
  }
Esempio n. 2
0
 public boolean hasBeenRenumbered(Origin sourceOrigin) {
   try {
     SynchronizationService s = SynchronizationClient.getClient();
     Origin lastSynchronization =
         s.lastSynchronization(
             sourceOrigin.getDomainName(),
             sourceOrigin.getServerName(),
             sourceOrigin.getRepositoryName(),
             sourceOrigin.getName());
     if (null == lastSynchronization) return false;
     Collection c = s.findAllSynchronizationOrigins(lastSynchronization);
     Iterator i = c.iterator();
     Origin t;
     Repository targetRepository = getPenPolicy().getTargetRepository();
     while (i.hasNext()) {
       t = (Origin) i.next();
       if (!t.getDomainName().equals(targetRepository.getDomainName())) continue;
       else if (!t.getServerName().equals(targetRepository.getServerName())) continue;
       else if (!t.getRepositoryName().equals(targetRepository.getRepositoryName())) continue;
       else {
         Metadata txData = lookupTxMetadata(getCurrentItem());
         if (t.getName().equalsIgnoreCase(txData.getName())) return false;
         else return true;
       }
     }
   } catch (Exception e) {
     e.printStackTrace();
     return false;
   }
   return false;
 }
Esempio n. 3
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;
 }