public DefaultCallContext(final CallContext callContext) { super(callContext.getAccountId(), callContext.getTenantId(), callContext.getUserName(), callContext.getCallOrigin(), callContext.getUserType(), callContext.getReasonCode(), callContext.getComments(), callContext.getUserToken()); this.createdDate = callContext.getCreatedDate(); this.updateDate = callContext.getUpdatedDate(); }
public InternalCallContext(final Long tenantRecordId, final CallContext callContext, final DateTime utcNow) { this(tenantRecordId, null, null, null, callContext.getUserToken(), callContext.getUserName(), callContext.getCallOrigin(), callContext.getUserType(), callContext.getReasonCode(), callContext.getComments(), utcNow, utcNow); }
public TestCallContext(final CallContext context, final DateTime utcNow) { this.userName = context.getUserName(); this.createdDate = utcNow; this.updatedDate = utcNow; this.userToken = context.getUserToken(); this.accountId = context.getAccountId(); this.tenantId = context.getTenantId(); }
private DateTime getSafeFirstCatalogEffectiveDate(@Nullable final DateTime input, final CallContext callContext) { // The effectiveDate for the initial version does not matter too much // Because of #760, we want to make that client passing a approximate date (e.g today.toDateTimeAtStartOfDay()) will find the version final DateTime catalogEffectiveDate = callContext.getCreatedDate().minusDays(1); return (input == null || input.isAfter(catalogEffectiveDate)) ? catalogEffectiveDate : input; }
@Override public UUID getTenantId() { return delegate.getTenantId(); } }
private <T extends EntitySqlDao<M, E>, M extends EntityModelDao<E>, E extends Entity> void checkAuditLog(final ChangeType changeType, @Nullable final CallContext context, final AuditLog auditLog, final UUID entityId, Class<T> sqlDao, boolean useHistory, boolean checkContext) { Assert.assertEquals(auditLog.getChangeType(), changeType); if (checkContext) { Assert.assertEquals(auditLog.getUserName(), context.getUserName()); Assert.assertEquals(auditLog.getComment(), context.getComments()); //Assert.assertEquals(auditLog.getCreatedDate().comparesTo(callcontext.getCreatedDate())); // We can't take userToken oustide of the 'if' because for instance NextBillingDate invoice will not have it. Assert.assertEquals(auditLog.getUserToken(), context.getUserToken().toString()); } final M entityModel = extractEntityModelFromEntityWithTargetRecordId(entityId, auditLog.getId(), sqlDao, context, useHistory); Assert.assertEquals(entityModel.getId(), entityId); }
@Override public String getUserName() { return auditLogModelDao.getCallContext().getUserName(); }
/** * Create an internal call callcontext without populating the account record id * <p/> * This is used for update/delete operations - we don't need the account id in that case - and * also when we don't have an account_record_id column (e.g. tenants, tag_definitions) * * @param context original call callcontext * @return internal call callcontext */ public InternalCallContext createInternalCallContextWithoutAccountRecordId(final CallContext context) { // If tenant id is null, this will default to the default tenant record id (multi-tenancy disabled) final Long tenantRecordId = getTenantRecordIdSafe(context); populateMDCContext(context.getUserToken(), null, tenantRecordId); return new InternalCallContext(tenantRecordId, context, context.getCreatedDate()); }
@Override public String getUserToken() { if (auditLogModelDao.getCallContext().getUserToken() == null) { return null; } else { return auditLogModelDao.getCallContext().getUserToken().toString(); } }
@Override public String getComment() { return auditLogModelDao.getCallContext().getComments(); }
@Override public UUID getAccountId() { return delegate.getAccountId(); }
@Override public String getReasonCode() { return auditLogModelDao.getCallContext().getReasonCode(); }
@Override public UserType getUserType() { return delegate.getUserType(); }
@Override public DateTime getUpdatedDate() { return delegate.getUpdatedDate(); }
@Override public CallOrigin getCallOrigin() { return delegate.getCallOrigin(); }
@Override public DateTime getCreatedDate() { return auditLogModelDao.getCallContext().getCreatedDate(); }
public InternalCallContext(final Long tenantRecordId, final CallContext callContext, final DateTime utcNow) { this(tenantRecordId, null, null, null, callContext.getUserToken(), callContext.getUserName(), callContext.getCallOrigin(), callContext.getUserType(), callContext.getReasonCode(), callContext.getComments(), utcNow, utcNow); }
public TestCallContext(final CallContext context, final DateTime utcNow) { this.userName = context.getUserName(); this.createdDate = utcNow; this.updatedDate = utcNow; this.userToken = context.getUserToken(); this.accountId = context.getAccountId(); this.tenantId = context.getTenantId(); }
@Override public void uploadOverdueConfig(final OverdueConfig overdueConfig, final CallContext callContext) throws OverdueApiException { try { final String overdueXML = XMLWriter.writeXML((DefaultOverdueConfig) overdueConfig, DefaultOverdueConfig.class); uploadOverdueConfig(overdueXML, callContext); } catch (final Exception e) { throw new OverdueApiException(ErrorCode.OVERDUE_INVALID_FOR_TENANT, callContext.getTenantId()); } }
@Override public void addUserRoles(final String username, final String password, final List<String> roles, final CallContext callContext) throws SecurityApiException { userDao.insertUser(username, password, roles, callContext.getUserName()); }