congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
AuditLevel.equals
Code IndexAdd Tabnine to your IDE (free)

How to use
equals
method
in
com.ning.billing.util.api.AuditLevel

Best Java code snippets using com.ning.billing.util.api.AuditLevel.equals (Showing top 10 results out of 315)

origin: com.ning.billing/killbill-jaxrs

public boolean withAudit() {
  return !AuditLevel.NONE.equals(level);
}
origin: com.ning.billing/killbill-util

  private List<AuditLog> filterAuditLogs(final AuditLevel auditLevel, final List<AuditLog> auditLogs) {
    // TODO Do the filtering in the query
    if (AuditLevel.FULL.equals(auditLevel)) {
      return auditLogs;
    } else if (AuditLevel.MINIMAL.equals(auditLevel) && !auditLogs.isEmpty()) {
      if (ChangeType.INSERT.equals(auditLogs.get(0).getChangeType())) {
        return ImmutableList.<AuditLog>of(auditLogs.get(0));
      } else {
        // We may be coming here via the history code path - only a single mapped history record id
        // will be for the initial INSERT
        return ImmutableList.<AuditLog>of();
      }
    } else if (AuditLevel.NONE.equals(auditLevel)) {
      return ImmutableList.<AuditLog>of();
    } else {
      return auditLogs;
    }
  }
}
origin: com.ning.billing/killbill-util

@Override
public List<AuditLog> getAuditLogs(final UUID objectId, final ObjectType objectType, final AuditLevel auditLevel, final TenantContext context) {
  // Optimization - bail early
  if (AuditLevel.NONE.equals(auditLevel)) {
    return ImmutableList.<AuditLog>of();
  }
  final TableName tableName = getTableNameFromObjectType(objectType);
  if (tableName == null) {
    return ImmutableList.<AuditLog>of();
  }
  return auditDao.getAuditLogsForId(tableName, objectId, auditLevel, internalCallContextFactory.createInternalTenantContext(context));
}
origin: com.ning.billing/killbill-util

@Override
public AccountAuditLogs getAccountAuditLogs(final UUID accountId, final AuditLevel auditLevel, final TenantContext tenantContext) {
  // Optimization - bail early
  if (AuditLevel.NONE.equals(auditLevel)) {
    return new DefaultAccountAuditLogs(accountId);
  }
  return auditDao.getAuditLogsForAccountRecordId(auditLevel, internalCallContextFactory.createInternalTenantContext(accountId, tenantContext));
}
origin: com.ning.billing/killbill-util

  @Override
  public List<AuditLog> getAuditLogsForId(final TableName tableName, final UUID objectId, final AuditLevel auditLevel, final InternalTenantContext context) {
    final Map<UUID, List<AuditLog>> auditLogsForTableName = auditLogsForTables.get(tableName);
    if (auditLogsForTableName == null) {
      return ImmutableList.<AuditLog>of();
    }

    final List<AuditLog> auditLogsForObjectId = auditLogsForTableName.get(objectId);
    final List<AuditLog> allAuditLogs = Objects.firstNonNull(auditLogsForObjectId, ImmutableList.<AuditLog>of());
    if (AuditLevel.FULL.equals(auditLevel)) {
      return allAuditLogs;
    } else if (AuditLevel.MINIMAL.equals(auditLevel) && allAuditLogs.size() > 0) {
      return ImmutableList.<AuditLog>of(allAuditLogs.get(0));
    } else if (AuditLevel.NONE.equals(auditLevel)) {
      return ImmutableList.<AuditLog>of();
    } else {
      return allAuditLogs;
    }
  }
}
origin: com.ning.billing/killbill-jaxrs

  @Override
  public RefundJson apply(final Refund refund) {
    UUID kbAccountId = null;
    if (!AuditLevel.NONE.equals(auditMode.getLevel()) && paymentIdAccountIdMappings.get(refund.getPaymentId()) == null) {
      try {
        kbAccountId = paymentApi.getPayment(refund.getPaymentId(), false, tenantContext).getAccountId();
        paymentIdAccountIdMappings.put(refund.getPaymentId(), kbAccountId);
      } catch (final PaymentApiException e) {
        log.warn("Unable to retrieve payment for id " + refund.getPaymentId());
      }
    }
    // Cache audit logs per account
    if (accountsAuditLogs.get().get(kbAccountId) == null) {
      accountsAuditLogs.get().put(kbAccountId, auditUserApi.getAccountAuditLogs(kbAccountId, auditMode.getLevel(), tenantContext));
    }
    final List<AuditLog> auditLogs = accountsAuditLogs.get().get(kbAccountId) == null ? null : accountsAuditLogs.get().get(kbAccountId).getAuditLogsForRefund(refund.getId());
    return new RefundJson(refund, null, auditLogs);
  }
},
origin: com.ning.billing/killbill-jaxrs

  @Override
  public RefundJson apply(final Refund refund) {
    UUID kbAccountId = null;
    if (!AuditLevel.NONE.equals(auditMode.getLevel()) && paymentIdAccountIdMappings.get(refund.getPaymentId()) == null) {
      try {
        kbAccountId = paymentApi.getPayment(refund.getPaymentId(), false, tenantContext).getAccountId();
        paymentIdAccountIdMappings.put(refund.getPaymentId(), kbAccountId);
      } catch (final PaymentApiException e) {
        log.warn("Unable to retrieve payment for id " + refund.getPaymentId());
      }
    }
    // Cache audit logs per account
    if (accountsAuditLogs.get().get(kbAccountId) == null) {
      accountsAuditLogs.get().put(kbAccountId, auditUserApi.getAccountAuditLogs(kbAccountId, auditMode.getLevel(), tenantContext));
    }
    final List<AuditLog> auditLogs = accountsAuditLogs.get().get(kbAccountId) == null ? null : accountsAuditLogs.get().get(kbAccountId).getAuditLogsForRefund(refund.getId());
    return new RefundJson(refund, null, auditLogs);
  }
},
origin: com.ning.billing/killbill-util

  private void verifyAuditLogsForTag(final List<AuditLog> auditLogs, final AuditLevel level) {
    if (AuditLevel.NONE.equals(level)) {
      Assert.assertEquals(auditLogs.size(), 0);
      return;
    }

    Assert.assertEquals(auditLogs.size(), 1);
    Assert.assertEquals(auditLogs.get(0).getUserToken(), internalCallContext.getUserToken().toString());
    Assert.assertEquals(auditLogs.get(0).getChangeType(), ChangeType.INSERT);
    Assert.assertEquals(auditLogs.get(0).getComment(), internalCallContext.getComments());
    Assert.assertEquals(auditLogs.get(0).getReasonCode(), internalCallContext.getReasonCode());
    Assert.assertEquals(auditLogs.get(0).getUserName(), internalCallContext.getCreatedBy());
    Assert.assertNotNull(auditLogs.get(0).getCreatedDate());
  }
}
origin: com.ning.billing/killbill-util

  @Test(groups = "fast")
  public void testForObject() throws Exception {
    for (final ObjectType objectType : ObjectType.values()) {
      for (final UUID objectId : objectIds) {
        for (final AuditLevel level : AuditLevel.values()) {
          if (AuditLevel.NONE.equals(level)) {
            Assert.assertEquals(auditUserApi.getAuditLogs(objectId, objectType, level, callContext).size(), 0);
          } else if (AuditLevel.MINIMAL.equals(level)) {
            Assert.assertEquals(auditUserApi.getAuditLogs(objectId, objectType, level, callContext), ImmutableList.<AuditLog>of(auditLogs.get(0)));
          } else {
            Assert.assertEquals(auditUserApi.getAuditLogs(objectId, objectType, level, callContext), auditLogs);
          }
        }
      }
    }
  }
}
origin: com.ning.billing/killbill-util

@Override
public AccountAuditLogsForObjectType getAccountAuditLogs(final UUID accountId, final ObjectType objectType, final AuditLevel auditLevel, final TenantContext tenantContext) {
  // Optimization - bail early
  if (AuditLevel.NONE.equals(auditLevel)) {
    return new DefaultAccountAuditLogsForObjectType(auditLevel);
  }
  final TableName tableName = getTableNameFromObjectType(objectType);
  if (tableName == null) {
    return new DefaultAccountAuditLogsForObjectType(auditLevel);
  }
  return auditDao.getAuditLogsForAccountRecordId(tableName, auditLevel, internalCallContextFactory.createInternalTenantContext(accountId, tenantContext));
}
com.ning.billing.util.apiAuditLevelequals

Popular methods of AuditLevel

  • hashCode
  • toString
  • valueOf
  • values

Popular in Java

  • Updating database using SQL prepared statement
  • orElseThrow (Optional)
    Return the contained value, if present, otherwise throw an exception to be created by the provided s
  • startActivity (Activity)
  • notifyDataSetChanged (ArrayAdapter)
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • SocketTimeoutException (java.net)
    This exception is thrown when a timeout expired on a socket read or accept operation.
  • URL (java.net)
    A Uniform Resource Locator that identifies the location of an Internet resource as specified by RFC
  • Arrays (java.util)
    This class contains various methods for manipulating arrays (such as sorting and searching). This cl
  • FileUtils (org.apache.commons.io)
    General file manipulation utilities. Facilities are provided in the following areas: * writing to a
  • LogFactory (org.apache.commons.logging)
    Factory for creating Log instances, with discovery and configuration features similar to that employ
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now