Class ShadowAgreement

java.lang.Object
com.isode.dsapi.config.ManagedObject
com.isode.dsapi.config.ShadowAgreement
Direct Known Subclasses:
ConsumerAgreement, SupplierAgreement

public abstract class ShadowAgreement extends ManagedObject
Shadow agreement object.
Since:
15.0
Author:
dsm
  • Field Details

    • lastSuccessTime

      protected Date lastSuccessTime
    • lastUpdateTime

      protected Date lastUpdateTime
    • lastErrorTime

      protected Date lastErrorTime
    • lastError

      protected Integer lastError
    • peerDsaDN

      protected DN peerDsaDN
    • agreementId

      protected Integer agreementId
    • agreementVersion

      protected Integer agreementVersion
    • isEnabled

      protected Boolean isEnabled
    • prefixDN

      protected DN prefixDN
    • onChange

      protected Boolean onChange
    • supplierInitiated

      protected Boolean supplierInitiated
    • beginTimeStr

      protected String beginTimeStr
    • updateInterval

      protected Integer updateInterval
    • isOtherTimes

      protected Boolean isOtherTimes
    • windowSize

      protected Integer windowSize
  • Constructor Details

    • ShadowAgreement

      public ShadowAgreement(Entry agreement, Entry state, IsodeDirectorySession ds)
      Construct from the entry object.
      Parameters:
      agreement - Entry representing the agreement, must not be null
      state - Entry representing the state, can be null if state entry is not read
      ds - Isode directory session, must not be null
  • Method Details

    • loadAgreement

      protected void loadAgreement(Entry entry) throws ConfigOpFailedException
      Reload cached values.
      Parameters:
      entry - Entry representing the agreement, could be null if the existing entry has to be reloaded.
      Throws:
      ConfigOpFailedException - if mandatory attributes are not loaded
    • loadState

      public void loadState(Entry state)
      Reload cached state values.
      Parameters:
      state - Entry representing the state, can be null if state entry is not read
    • buildDN

      protected static List<DN> buildDN(DN dsaDN, int id)
      Build agreement and state DN.
      Parameters:
      dsaDN - DSA DN.
      id - Agreement ID.
      Returns:
      List containing agreement (index 0) and state DN (index 1)
    • create

      protected static MapEntry create(DN entryDN, DN dsaDN, Integer id, Integer version, DN prefixDN, Boolean enabled)
      Create a basic agreement entry and update DB.
      Parameters:
      entryDN - DN of the agreement.
      dsaDN - DSA DN.
      id - Agreement ID.
      version - Agreement version.
      prefixDN - Prefix DN.
      enabled - Enabled flag.
      Returns:
      map entry object containing added attributes.
    • lastSuccessTime

      public Date lastSuccessTime()
      Last success time, if there is one.
      Returns:
      Last success time, which may be null if none is recorded.
    • lastUpdateTime

      public Date lastUpdateTime()
      Last update time, if there is one.
      Returns:
      Last update time, which may be null if none is recorded.
    • lastErrorTime

      public Date lastErrorTime()
      Last error time, if there is one,
      Returns:
      Last error time, which may be null if none is recorded.
    • lastError

      public Integer lastError()
      Last error, 0 indicates no error.
      Returns:
      Last error
    • getShadowError

      public ShadowAgreement.ShadowError getShadowError()
      Return a ShadowError enum corresponding to the last reported error for this agreement.
      Returns:
      a ShadowError enum which will never be null.
      Since:
      15.1
    • lastErrorString

      public String lastErrorString()
      Last error as a string. For error code values see apps/d3/shadow/ShadowError.h.
      Returns:
      a String representation of the last error, which will never be null (but may be "no error").
    • getForceNowTime

      public static String getForceNowTime()
      Get a GeneralizedTime string used to represent 'now' when forcing shadow updates.
      Returns:
      generalised time string for now
    • forceUpdate

      Force an update.
      Parameters:
      timeStr - Time of update, if null, current time would be used
      Throws:
      BadValueException - if timeStr has invalid format
      SignedOpFailedException
      BadAttributeTypeException
      NotImplementedException
      NotBoundException
      IndicationException
      DirectoryOperationFailedException
      BadSyntaxException
      ReferralException
      NoSuchEntryException
      ConfigOpFailedException - if anything goes wrong and the update is not done
      See Also:
    • getPeer

      public DN getPeer()
      Get the peer DSA DN.
      Returns:
      Peer DSA DN, will never be null
    • getAgreementID

      public Integer getAgreementID()
      Get the agreement ID.
      Returns:
      Agreement ID
    • getAgreementVersion

      public Integer getAgreementVersion()
      Get the agreement version.
      Returns:
      Agreement version
    • setAgreementVersion

      public void setAgreementVersion(Integer version)
      Set the agreement version.
      Parameters:
      version - Agreement version, null to clear the value altogether
    • getEnabled

      public Boolean getEnabled()
      Get the enabled flag.
      Returns:
      Enabled flag
    • setEnabled

      public void setEnabled(Boolean enabled)
      Set the enabled flag.
      Parameters:
      enabled - Enabled flag, null to clean the attribute
    • getShadowPrefix

      public DN getShadowPrefix()
      Get the shadow prefix.
      Returns:
      Shadow prefix DN, will not be null
    • getOnChange

      public Boolean getOnChange()
      If on change agreement.
      Returns:
      On Change agreement flag
    • setOnChange

      public void setOnChange(Boolean onChangeFlag)
      Set agreement as 'on change'.
      Parameters:
      onChangeFlag - On Change agreement flag, null to clear the attribute
    • getSupplierInitiated

      public Boolean getSupplierInitiated()
      If supplier initiated.
      Returns:
      Supplier initiated flag
    • setSupplierInitiated

      public void setSupplierInitiated(Boolean suppInited)
      Set supplier initiated flag.
      Parameters:
      suppInited - Supplier initiated flag, null to clear
    • getBeginTime

      public String getBeginTime()
      Get begin time.
      Returns:
      Begin time string
    • setBeginTime

      public void setBeginTime(String beginTime)
      Set periodic begin time.
      Parameters:
      beginTime - Begin time string
    • getUpdateInterval

      public Integer getUpdateInterval()
      Get periodic update interval.
      Returns:
      Update interval
    • setUpdateInterval

      public void setUpdateInterval(Integer interval)
      Set periodic update interval. If the value set is null, the attribute is deleted.
      Parameters:
      interval - Update interval, null to clear the value
    • getOtherTimes

      public Boolean getOtherTimes()
      Get the other times flag.
      Returns:
      Other times flag
    • setOtherTimes

      public void setOtherTimes(Boolean otherTimes)
      Set the other times flag.
      Parameters:
      otherTimes - Other times flag, null to clear
    • getWindowSize

      public Integer getWindowSize()
      Get periodic update window size.
      Returns:
      Update window size.
    • setWindowSize

      public void setWindowSize(Integer size)
      Set periodic update window size.
      Parameters:
      size - Update window size, null to delete the attribute
    • toString

      public String toString()
      Overrides:
      toString in class Object