@Override protected GenericModel<TenantDto> newInstance(Long id) { return new Tenant(id); }
/** * Update fields <code>tenant</code> and <code>application</code>, * create new instances by using ids in parameters. * @param tenantId is tenant id * @param applicationId is application id */ public void updateScope(String tenantId, String applicationId) { Long tenId = getLongId(tenantId); this.tenant = tenId != null ? new Tenant(tenId) : null; Long appId = getLongId(applicationId); this.application = appId != null ? new Application(appId) : null; }
/** * Create new instance of CTL schema meta info. * @param fqn is full qualified name * @param tenantId is tenant id, it used for creating * <code>Tenant</code> with corresponding id and * set it on field <code>tenant</code> * @param applicationId is application id, it used for creating * <code>Application</code> with corresponding id and * set it on field <code>application</code> */ public CtlSchemaMetaInfo(String fqn, String tenantId, String applicationId) { this.fqn = fqn; Long tenId = getLongId(tenantId); this.tenant = tenId != null ? new Tenant(tenId) : null; Long appId = getLongId(applicationId); this.application = appId != null ? new Application(appId) : null; }
protected Tenant generateTenant() { LOG.debug("Generate tenant..."); Tenant tenant = new Tenant(); tenant.setName("Test tenant" + RANDOM.nextInt()); tenant = tenantDao.save(tenant); LOG.debug("Generate tenant {}", tenant); return tenant; }
@Override public TenantDto saveTenant(TenantDto tenantDto) { LOG.trace("Try to save tenant object: {}", tenantDto); TenantDto tenant = null; if (isValidSqlObject(tenantDto)) { Tenant checkTenant = tenantDao.findByName(tenantDto.getName()); if (checkTenant == null || checkTenant.getId().toString().equals(tenantDto.getId())) { tenant = getDto(tenantDao.save(new Tenant(tenantDto))); } else { throw new IncorrectParameterException("Can't save tenant with same name"); } } return tenant; }
/** * Instantiates new user. */ public User(UserDto dto) { if (dto != null) { this.id = getLongId(dto); this.username = dto.getUsername(); this.externalUid = dto.getExternalUid(); this.authority = dto.getAuthority(); Long tenantId = getLongId(dto.getTenantId()); this.tenant = tenantId != null ? new Tenant(tenantId) : null; } }
/** * Create new instance of <code>Application</code>. * @param dto data transfer object contain data that * assign on fields of new instance */ public Application(ApplicationDto dto) { if (dto != null) { this.id = getLongId(dto); this.applicationToken = dto.getApplicationToken(); this.name = dto.getName(); this.sequenceNumber = dto.getSequenceNumber(); Long tenantId = getLongId(dto.getTenantId()); if (tenantId != null) { this.tenant = new Tenant(tenantId); } this.credentialsServiceName = dto.getCredentialsServiceName(); } }
/** * Create new instance of CTL schema meta info. * * @param dto data transfer object that used for creating new instance, * it hold id, full qualified name, tenant id and application id * of new instance */ public CtlSchemaMetaInfo(CtlSchemaMetaInfoDto dto) { this.id = ModelUtils.getLongId(dto.getId()); this.fqn = dto.getFqn(); Long tenantId = getLongId(dto.getTenantId()); this.tenant = tenantId != null ? new Tenant(tenantId) : null; Long appId = getLongId(dto.getApplicationId()); this.application = appId != null ? new Application(appId) : null; }
@Test(expected = Exception.class) public void saveCTLSchemaWithSameFqnAndVersion() { ctlSchemaDao.save(generateCTLSchema(DEFAULT_FQN, new Tenant(tenant), 11, null)); ctlSchemaDao.save(generateCTLSchema(DEFAULT_FQN, null, 11, null)); }
/** * Create new instance of <code>EventClassFamily</code>. * * @param dto data transfer object contain data that assign on fields of new instance */ public EventClassFamily(EventClassFamilyDto dto) { this.id = getLongId(dto.getId()); Long tenantId = getLongId(dto.getTenantId()); if (tenantId != null) { this.tenant = new Tenant(tenantId); } this.name = dto.getName(); this.namespace = dto.getNamespace(); this.className = dto.getClassName(); this.description = dto.getDescription(); this.createdUsername = dto.getCreatedUsername(); this.createdTime = dto.getCreatedTime(); }
/** * Create new instance of EventClass. * * @param dto data transfer object, contain data for new instance */ public EventClass(EventClassDto dto) { super(dto); this.id = getLongId(dto.getId()); Long tenantId = getLongId(dto.getTenantId()); if (tenantId != null) { this.tenant = new Tenant(tenantId); } this.fqn = dto.getFqn(); this.type = dto.getType(); Long ecfvId = getLongId(dto.getEcfvId()); if (ecfvId != null) { this.ecfv = new EventClassFamilyVersion(ecfvId); } this.version = dto.getVersion(); this.name = dto.getName(); this.description = dto.getDescription(); this.createdUsername = dto.getCreatedUsername(); this.createdTime = dto.getCreatedTime(); Long ctlId = getLongId(dto.getCtlSchemaId()); if (ctlId != null) { this.setCtlSchema(new CtlSchema(ctlId)); } }