本文整理汇总了Java中com.icthh.xm.commons.gen.model.Tenant类的典型用法代码示例。如果您正苦于以下问题:Java Tenant类的具体用法?Java Tenant怎么用?Java Tenant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Tenant类属于com.icthh.xm.commons.gen.model包,在下文中一共展示了Tenant类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: createTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
/**
* Create tenant.
*
* @param tenant the tenant
* @return the tenant
*/
public Tenant createTenant(Tenant tenant) {
StopWatch stopWatch = createStarted();
log.info("START - SETUP:CreateTenant: tenantKey: {}", tenant.getTenantKey());
try {
tenantDatabaseService.create(tenant);
tenantDashboardService.create(tenant);
log.info("STOP - SETUP:CreateTenant: tenantKey: {}, result: OK, time = {} ms",
tenant.getTenantKey(), stopWatch.getTime());
return tenant;
} catch (Exception e) {
log.info("STOP - SETUP:CreateTenant: tenantKey: {}, result: FAIL, error: {}, time = {} ms",
tenant.getTenantKey(), e.getMessage(), stopWatch.getTime());
throw e;
}
}
开发者ID:xm-online,项目名称:xm-ms-dashboard,代码行数:23,代码来源:TenantService.java
示例2: create
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
/**
* Create default dashboard.
* @param tenant - the tenant
*/
public void create(Tenant tenant) {
final StopWatch stopWatch = StopWatch.createStarted();
final String tenantKey = tenant.getTenantKey();
TenantInfo info = TenantContext.getCurrent();
try {
log.info("START - SETUP:CreateTenant:dashboard tenantKey: {}", tenantKey);
TenantContext.setCurrentQuite(tenantKey);
Dashboard dashboard = new Dashboard();
dashboard.setName(tenantKey.toLowerCase());
dashboard.setOwner(tenantKey.toLowerCase());
dashboard.setIsPublic(false);
dashboardService.save(dashboard);
log.info("STOP - SETUP:CreateTenant:dashboard tenantKey: {}, result: OK, time = {} ms", tenantKey,
stopWatch.getTime());
} catch (Exception e) {
log.info("STOP - SETUP:CreateTenant:dashboard tenantKey: {}, result: FAIL, error: {}, time = {} ms",
tenantKey, e.getMessage(), stopWatch.getTime());
throw e;
} finally {
TenantContext.setCurrentQuite(info);
}
}
开发者ID:xm-online,项目名称:xm-ms-dashboard,代码行数:30,代码来源:TenantDashboardService.java
示例3: manageClient
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
private void manageClient(String serviceName, XmEntity xmEntity, String nextStateKey) {
if (StringUtils.isNotBlank(serviceName)) {
TenantClient client = getClient(serviceName);
if (EntityState.ACTIVE.name().equals(nextStateKey)
&& (EntityState.NEW.name().equals(xmEntity.getStateKey())
|| EntityState.ERROR.name().equals(xmEntity.getStateKey()))) {
client.addTenant(new Tenant().tenantKey(xmEntity.getName()).name(xmEntity.getName()));
} else if (EntityState.ACTIVE.name().equals(nextStateKey)
&& EntityState.SUSPENDED.name().equals(xmEntity.getStateKey())) {
client.manageTenant(xmEntity.getName(), EntityState.ACTIVE.name());
} else if (EntityState.SUSPENDED.name().equals(nextStateKey)
&& EntityState.ACTIVE.name().equals(xmEntity.getStateKey())) {
client.manageTenant(xmEntity.getName(), EntityState.SUSPENDED.name());
} else if (EntityState.DELETED.name().equals(nextStateKey)) {
client.deleteTenant(xmEntity.getName());
}
}
}
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:19,代码来源:XmTenantLifecycleService.java
示例4: addTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
public void addTenant(Tenant tenant) {
StopWatch stopWatch = StopWatch.createStarted();
log.info("START - SETUP:CreateTenant: tenantKey: {}", tenant);
try {
String tenantName = tenant.getTenantKey().toUpperCase();
tenantListRepository.addTenant(tenantName);
tenantDatabaseService.create(tenant);
tenantElasticService.create(tenant);
addEntitySpecification(tenantName);
addWebAppSpecification(tenantName);
log.info("STOP - SETUP:CreateTenant: tenantKey: {}, result: OK, time = {} ms",
tenant, stopWatch.getTime());
} catch (Exception e) {
log.info("STOP - SETUP:CreateTenant: tenantKey: {}, result: FAIL, error: {}, time = {} ms",
tenant, e.getMessage(), stopWatch.getTime());
throw e;
}
}
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:20,代码来源:TenantService.java
示例5: create
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
/**
* Create database schema for tenant.
*
* @param tenant - the tenant
*/
public void create(Tenant tenant) {
StopWatch stopWatch = createStarted();
log.info("START - SETUP:CreateTenant:schema tenantKey={}", tenant.getTenantKey());
DatabaseUtil.createSchema(dataSource, tenant.getTenantKey());
log.info("STOP - SETUP:CreateTenant:schema tenantKey={}, time={}ms", tenant.getTenantKey(),
stopWatch.getTime());
try {
stopWatch.reset();
stopWatch.start();
log.info("START - SETUP:CreateTenant:liquibase tenantKey={}", tenant.getTenantKey());
SpringLiquibase liquibase = new SpringLiquibase();
liquibase.setResourceLoader(resourceLoader);
liquibase.setDataSource(dataSource);
liquibase.setChangeLog(CHANGE_LOG_PATH);
liquibase.setContexts(liquibaseProperties.getContexts());
liquibase.setDefaultSchema(tenant.getTenantKey());
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
liquibase.setShouldRun(true);
liquibase.afterPropertiesSet();
log.info("STOP - SETUP:CreateTenant:liquibase tenantKey={}, time={}ms", tenant.getTenantKey(),
stopWatch.getTime());
} catch (LiquibaseException e) {
throw new RuntimeException("Can not migrate database for creation tenant " + tenant.getTenantKey(), e);
}
}
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:31,代码来源:TenantDatabaseService.java
示例6: create
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
/**
* Create database schema for tenant.
*
* @param tenant - the tenant
*/
public void create(Tenant tenant) {
final StopWatch stopWatch = createStarted();
final String tenantKey = tenant.getTenantKey();
log.info("START - SETUP:CreateTenant:schema tenantKey: {}", tenantKey);
DatabaseUtil.createSchema(dataSource, tenantKey);
log.info("STOP - SETUP:CreateTenant:schema tenantKey: {}, time = {} ms", tenantKey,
stopWatch.getTime());
try {
stopWatch.reset();
stopWatch.start();
log.info("START - SETUP:CreateTenant:liquibase tenantKey: {}", tenantKey);
SpringLiquibase liquibase = new SpringLiquibase();
liquibase.setResourceLoader(resourceLoader);
liquibase.setDataSource(dataSource);
liquibase.setChangeLog(CHANGE_LOG_PATH);
liquibase.setContexts(liquibaseProperties.getContexts());
liquibase.setDefaultSchema(tenantKey);
liquibase.setDropFirst(liquibaseProperties.isDropFirst());
liquibase.setShouldRun(true);
liquibase.afterPropertiesSet();
log.info("STOP - SETUP:CreateTenant:liquibase tenantKey: {}, result: OK, time = {} ms", tenantKey,
stopWatch.getTime());
} catch (LiquibaseException e) {
log.info("STOP - SETUP:CreateTenant:liquibase tenantKey: {}, result: FAIL, error: {}, time = {} ms",
tenantKey, e.getMessage(), stopWatch.getTime());
throw new RuntimeException("Can not migrate database for creation tenant " + tenantKey, e);
}
}
开发者ID:xm-online,项目名称:xm-ms-dashboard,代码行数:35,代码来源:TenantDatabaseService.java
示例7: testAddTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Test
@Transactional
public void testAddTenant() throws Exception {
ObjectMapper om = new ObjectMapper();
mvc.perform(post("/tenants").content(om.writeValueAsBytes(new Tenant().tenantKey("testadd"))).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
assertExistSchema("testadd");
}
开发者ID:xm-online,项目名称:xm-ms-dashboard,代码行数:9,代码来源:TenantsApiIntTest.java
示例8: addTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
public ResponseEntity<Void> addTenant(Tenant tenant) {
StopWatch stopWatch = createStarted();
log.info("START - SETUP:CreateTenant: tenantKey: {}", tenant.getTenantKey());
try {
tenantMappingService.addTenant(tenant);
} catch (Exception e) {
log.error("STOP - ERROR:CreateTenant: tenantKey: {}, result: {}", tenant.getTenantKey(), e);
throw e;
}
log.info("STOP - SETUP:CreateTenant: tenantKey: {}, result: OK, time = {} ms",
tenant.getTenantKey(), stopWatch.getTime());
return new ResponseEntity<>(HttpStatus.OK);
}
开发者ID:xm-online,项目名称:xm-gate,代码行数:15,代码来源:TenantResource.java
示例9: testAddTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Test
public void testAddTenant() throws Exception {
ObjectMapper om = new ObjectMapper();
mvc.perform(post("/tenants").content(om.writeValueAsBytes(new Tenant().tenantKey("testAdd"))).contentType(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
assertTrue(service.getTenants().containsKey("testadd.local"));
assertEquals(service.getTenants().get("testadd.local"), "TESTADD");
}
开发者ID:xm-online,项目名称:xm-gate,代码行数:10,代码来源:TenantsApiIntTest.java
示例10: setup
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Before
public void setup() {
TenantContext.setCurrent(TENANT_NEW);
MockitoAnnotations.initMocks(this);
tenant = new Tenant();
TenantsApi controller = new TenantsApiController(new TenantResource(tenantService));
this.mockMvc = MockMvcBuilders.standaloneSetup(controller)
.setControllerAdvice(exceptionTranslator).setMessageConverters(jacksonMessageConverter).build();
}
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:11,代码来源:TenantResourceIntTest.java
示例11: addTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
@Transactional
public ResponseEntity<Void> addTenant(Tenant tenant) {
tenantService.createTenant(tenant.getTenantKey().toUpperCase());
return ResponseEntity.ok().build();
}
开发者ID:xm-online,项目名称:xm-uaa,代码行数:7,代码来源:TenantResource.java
示例12: getAllTenantInfo
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
public ResponseEntity<List<Tenant>> getAllTenantInfo() {
return ResponseEntity.ok().build();
}
开发者ID:xm-online,项目名称:xm-uaa,代码行数:5,代码来源:TenantResource.java
示例13: getTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
public ResponseEntity<Tenant> getTenant(String s) {
return ResponseEntity.ok().build();
}
开发者ID:xm-online,项目名称:xm-uaa,代码行数:5,代码来源:TenantResource.java
示例14: addTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
public ResponseEntity<Void> addTenant(Tenant tenant) {
tenantListRepository.addTenant(tenant.getTenantKey().toLowerCase());
return ResponseEntity.ok().build();
}
开发者ID:xm-online,项目名称:xm-ms-balance,代码行数:6,代码来源:TenantResource.java
示例15: getAllTenantInfo
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
public ResponseEntity<List<Tenant>> getAllTenantInfo() {
throw new UnsupportedOperationException();
}
开发者ID:xm-online,项目名称:xm-ms-balance,代码行数:5,代码来源:TenantResource.java
示例16: getTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
public ResponseEntity<Tenant> getTenant(String s) {
throw new UnsupportedOperationException();
}
开发者ID:xm-online,项目名称:xm-ms-balance,代码行数:5,代码来源:TenantResource.java
示例17: addTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
public ResponseEntity<Void> addTenant(Tenant tenant) {
tenantListRepository.addTenant(tenant.getTenantKey().toLowerCase());
service.createTenant(tenant);
return ResponseEntity.ok().build();
}
开发者ID:xm-online,项目名称:xm-ms-dashboard,代码行数:7,代码来源:TenantResource.java
示例18: addTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
@SneakyThrows
public void addTenant(Tenant tenant) {
tenantListRepository.addTenant(tenant.getTenantKey().toLowerCase());
}
开发者ID:xm-online,项目名称:xm-gate,代码行数:6,代码来源:TenantMappingServiceImpl.java
示例19: addTenant
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
@PostMapping({"tenants"})
void addTenant(@Valid @RequestBody Tenant body);
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:4,代码来源:TenantUaaClient.java
示例20: getAllTenantInfo
import com.icthh.xm.commons.gen.model.Tenant; //导入依赖的package包/类
@Override
@GetMapping({"tenants"})
List<Tenant> getAllTenantInfo();
开发者ID:xm-online,项目名称:xm-ms-entity,代码行数:4,代码来源:TenantUaaClient.java
注:本文中的com.icthh.xm.commons.gen.model.Tenant类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论