All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.sdmlib.replication.util.ChangeHistoryPO Maven / Gradle / Ivy

Go to download

SDMLib is a light weight modeling library. SDMLib intentionally comes without any tool or editor.

There is a newer version: 2.3.2341
Show newest version
package org.sdmlib.replication.util;

import org.sdmlib.models.pattern.PatternObject;
import org.sdmlib.replication.ChangeHistory;
import org.sdmlib.replication.ReplicationChange;
import org.sdmlib.replication.util.ReplicationChangePO;
import org.sdmlib.replication.util.ChangeHistoryPO;

public class ChangeHistoryPO extends PatternObject
{

    public ChangeHistorySet allMatches()
   {
      this.setDoAllMatches(true);
      
      ChangeHistorySet matches = new ChangeHistorySet();

      while (this.getPattern().getHasMatch())
      {
         matches.add((ChangeHistory) this.getCurrentMatch());
         
         this.getPattern().findMatch();
      }
      
      return matches;
   }


   public ChangeHistoryPO(){
      newInstance(CreatorCreator.createIdMap("PatternObjectType"));
   }

   public ChangeHistoryPO(ChangeHistory... hostGraphObject) {
      if(hostGraphObject==null || hostGraphObject.length<1){
         return ;
      }
      newInstance(CreatorCreator.createIdMap("PatternObjectType"), hostGraphObject);
   }
   public ReplicationChangePO hasChanges()
   {
      ReplicationChangePO result = new ReplicationChangePO(new ReplicationChange[]{});
      
      result.setModifier(this.getPattern().getModifier());
      super.hasLink(ChangeHistory.PROPERTY_CHANGES, result);
      
      return result;
   }

   public ReplicationChangePO createChanges()
   {
      return this.startCreate().hasChanges().endCreate();
   }

   public ChangeHistoryPO hasChanges(ReplicationChangePO tgt)
   {
      return hasLinkConstraint(tgt, ChangeHistory.PROPERTY_CHANGES);
   }

   public ChangeHistoryPO createChanges(ReplicationChangePO tgt)
   {
      return this.startCreate().hasChanges(tgt).endCreate();
   }

   public ReplicationChangeSet getChanges()
   {
      if (this.getPattern().getHasMatch())
      {
         return ((ChangeHistory) this.getCurrentMatch()).getChanges();
      }
      return null;
   }

   public ReplicationChangePO filterChanges()
   {
      ReplicationChangePO result = new ReplicationChangePO(new ReplicationChange[]{});
      
      result.setModifier(this.getPattern().getModifier());
      super.hasLink(ChangeHistory.PROPERTY_CHANGES, result);
      
      return result;
   }

   public ChangeHistoryPO filterChanges(ReplicationChangePO tgt)
   {
      return hasLinkConstraint(tgt, ChangeHistory.PROPERTY_CHANGES);
   }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy