Search in sources :

Example 1 with ContractData

use of io.apiman.manager.api.beans.audit.data.ContractData in project apiman by apiman.

the class AuditUtils method contractCreatedFromClient.

/**
 * Creates an audit entry for the 'contract created' event.
 * @param bean the bean
 * @param securityContext the security context
 * @return the audit entry
 */
public static AuditEntryBean contractCreatedFromClient(ContractBean bean, ISecurityContext securityContext) {
    AuditEntryBean entry = newEntry(bean.getClient().getClient().getOrganization().getId(), AuditEntityType.Client, securityContext);
    entry.setWhat(AuditEntryType.CreateContract);
    entry.setEntityId(bean.getClient().getClient().getId());
    entry.setEntityVersion(bean.getClient().getVersion());
    ContractData data = new ContractData(bean);
    entry.setData(toJSON(data));
    return entry;
}
Also used : ContractData(io.apiman.manager.api.beans.audit.data.ContractData) AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean)

Example 2 with ContractData

use of io.apiman.manager.api.beans.audit.data.ContractData in project apiman by apiman.

the class AuditUtils method contractBrokenFromClient.

/**
 * Creates an audit entry for the 'contract broken' event.
 * @param bean the bean
 * @param securityContext the security context
 * @return the audit entry
 */
public static AuditEntryBean contractBrokenFromClient(ContractBean bean, ISecurityContext securityContext) {
    AuditEntryBean entry = newEntry(bean.getClient().getClient().getOrganization().getId(), AuditEntityType.Client, securityContext);
    entry.setWhat(AuditEntryType.BreakContract);
    entry.setEntityId(bean.getClient().getClient().getId());
    entry.setEntityVersion(bean.getClient().getVersion());
    ContractData data = new ContractData(bean);
    entry.setData(toJSON(data));
    return entry;
}
Also used : ContractData(io.apiman.manager.api.beans.audit.data.ContractData) AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean)

Example 3 with ContractData

use of io.apiman.manager.api.beans.audit.data.ContractData in project apiman by apiman.

the class AuditUtils method contractBrokenToApi.

/**
 * Creates an audit entry for the 'contract broken' event.
 * @param bean the bean
 * @param securityContext the security context
 * @return the audit entry
 */
public static AuditEntryBean contractBrokenToApi(ContractBean bean, ISecurityContext securityContext) {
    AuditEntryBean entry = newEntry(bean.getApi().getApi().getOrganization().getId(), AuditEntityType.Api, securityContext);
    entry.setWhat(AuditEntryType.BreakContract);
    entry.setEntityId(bean.getApi().getApi().getId());
    entry.setEntityVersion(bean.getApi().getVersion());
    ContractData data = new ContractData(bean);
    entry.setData(toJSON(data));
    return entry;
}
Also used : ContractData(io.apiman.manager.api.beans.audit.data.ContractData) AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean)

Example 4 with ContractData

use of io.apiman.manager.api.beans.audit.data.ContractData in project apiman by apiman.

the class AuditUtils method contractCreatedToApi.

/**
 * Creates an audit entry for the 'contract created' event.
 * @param bean the bean
 * @param securityContext the security context
 * @return the audit entry
 */
public static AuditEntryBean contractCreatedToApi(ContractBean bean, ISecurityContext securityContext) {
    AuditEntryBean entry = newEntry(bean.getApi().getApi().getOrganization().getId(), AuditEntityType.Api, securityContext);
    // Ensure the order of contract-created events are deterministic by adding 1 ms to this one
    entry.setCreatedOn(new Date(entry.getCreatedOn().getTime() + 1));
    entry.setWhat(AuditEntryType.CreateContract);
    entry.setEntityId(bean.getApi().getApi().getId());
    entry.setEntityVersion(bean.getApi().getVersion());
    ContractData data = new ContractData(bean);
    entry.setData(toJSON(data));
    return entry;
}
Also used : ContractData(io.apiman.manager.api.beans.audit.data.ContractData) AuditEntryBean(io.apiman.manager.api.beans.audit.AuditEntryBean) Date(java.util.Date)

Aggregations

AuditEntryBean (io.apiman.manager.api.beans.audit.AuditEntryBean)4 ContractData (io.apiman.manager.api.beans.audit.data.ContractData)4 Date (java.util.Date)1