use of com.ctrip.framework.apollo.biz.entity.Namespace in project apollo by ctripcorp.
the class NamespaceService method findPublicAppNamespaceAllNamespaces.
public List<Namespace> findPublicAppNamespaceAllNamespaces(String namespaceName, Pageable page) {
AppNamespace publicAppNamespace = appNamespaceService.findPublicNamespaceByName(namespaceName);
if (publicAppNamespace == null) {
throw new BadRequestException(String.format("Public appNamespace not exists. NamespaceName = %s", namespaceName));
}
List<Namespace> namespaces = namespaceRepository.findByNamespaceName(namespaceName, page);
return filterChildNamespace(namespaces);
}
use of com.ctrip.framework.apollo.biz.entity.Namespace in project apollo by ctripcorp.
the class MockBeanFactory method mockNamespace.
public static Namespace mockNamespace(String appId, String clusterName, String namespaceName) {
Namespace instance = new Namespace();
instance.setAppId(appId);
instance.setClusterName(clusterName);
instance.setNamespaceName(namespaceName);
return instance;
}
use of com.ctrip.framework.apollo.biz.entity.Namespace in project apollo by ctripcorp.
the class NamespaceUnlockAspect method generateConfigurationFromItems.
private Map<String, String> generateConfigurationFromItems(Namespace namespace, List<Item> namespaceItems) {
Map<String, String> configurationFromItems = Maps.newHashMap();
Namespace parentNamespace = namespaceService.findParentNamespace(namespace);
// parent namespace
if (parentNamespace == null) {
generateMapFromItems(namespaceItems, configurationFromItems);
} else {
// child namespace
Release parentRelease = releaseService.findLatestActiveRelease(parentNamespace);
if (parentRelease != null) {
configurationFromItems = GSON.fromJson(parentRelease.getConfigurations(), GsonType.CONFIG);
}
generateMapFromItems(namespaceItems, configurationFromItems);
}
return configurationFromItems;
}
use of com.ctrip.framework.apollo.biz.entity.Namespace in project apollo by ctripcorp.
the class ItemController method delete.
@PreAcquireNamespaceLock
@DeleteMapping("/items/{itemId}")
public void delete(@PathVariable("itemId") long itemId, @RequestParam String operator) {
Item entity = itemService.findOne(itemId);
if (entity == null) {
throw new NotFoundException("item not found for itemId " + itemId);
}
itemService.delete(entity.getId(), operator);
Namespace namespace = namespaceService.findOne(entity.getNamespaceId());
Commit commit = new Commit();
commit.setAppId(namespace.getAppId());
commit.setClusterName(namespace.getClusterName());
commit.setNamespaceName(namespace.getNamespaceName());
commit.setChangeSets(new ConfigChangeContentBuilder().deleteItem(entity).build());
commit.setDataChangeCreatedBy(operator);
commit.setDataChangeLastModifiedBy(operator);
commitService.save(commit);
}
use of com.ctrip.framework.apollo.biz.entity.Namespace in project apollo by ctripcorp.
the class NamespaceBranchController method loadNamespaceBranch.
@GetMapping("/apps/{appId}/clusters/{clusterName}/namespaces/{namespaceName}/branches")
public NamespaceDTO loadNamespaceBranch(@PathVariable String appId, @PathVariable String clusterName, @PathVariable String namespaceName) {
checkNamespace(appId, clusterName, namespaceName);
Namespace childNamespace = namespaceBranchService.findBranch(appId, clusterName, namespaceName);
if (childNamespace == null) {
return null;
}
return BeanUtils.transform(NamespaceDTO.class, childNamespace);
}
Aggregations