@Test public void testUpdateMetaField() { MetaClass rootMeta = new MetaClass(); rootMeta.setName("newMeta-1"); rootMeta.setRepository(RAPTOR_PAAS); MetaClass newMeta = new MetaClass(); newMeta.setName("newMeta-2"); newMeta.setRepository(RAPTOR_PAAS); MetaRelationship rel = new MetaRelationship(); rel.setName("rel-1"); rel.setRelationType(RelationTypeEnum.Reference); rel.setRefDataType(newMeta.getName()); rootMeta.addField(rel); MetaClass innerMeta = new MetaClass(); innerMeta.setName("innerMeta"); innerMeta.setRepository(RAPTOR_PAAS); innerMeta.setInner(true); List<MetaClass> metaList = new ArrayList<MetaClass>(); metaList.add(rootMeta); metaList.add(newMeta); metaList.add(innerMeta); server.batchUpsert(CMSPriority.NEUTRAL, RAPTOR_PAAS, metaList, metaContext); rel.setRefDataType(innerMeta.getName()); rel.setRelationType(RelationTypeEnum.Inner); rel.setDbName(null); rel.setValueDbName(null); rel.setFlattenValueDbName(null); server.updateMetaField(CMSPriority.NEUTRAL, RAPTOR_PAAS, rootMeta, "rel-1", metaContext); }
public MetaClass updateMetaField(CMSPriority p, String repoName, MetaClass meta, String fieldName, MetadataContext context) { logger.info("cms updateMetaField: {}, {}, {}, {}", new Object[] { repoName, meta.getName(), fieldName, context.getSourceIp() }); checkServerState(p, true); Repository repo = repositoryService.getRepository(repoName); context.setDbConfig(dbConfig); MetaClass metaClass = repo.getMetadataService().updateMetaField(meta, fieldName, context); updateMetadataIndexOnBranch(metaClass.getName(), context, repo); return metaClass; }
CMSServer { public MetaClass updateMetaField(CMSPriority p, String repoName, MetaClass meta, String fieldName, MetadataContext context) { logger.info("cms updateMetaField: {}, {}, {}, {}", new Object[] { repoName, meta.getName(), fieldName, context.getSourceIp() }); checkServerState(p, true); Repository repo = repositoryService.getRepository(repoName); context.setDbConfig(dbConfig); MetaClass metaClass = repo.getMetadataService().updateMetaField(meta, fieldName, context); updateMetadataIndexOnBranch(metaClass.getName(), context, repo); return metaClass; } }
CMSServer { public MetaClass updateMetaField(CMSPriority p, String repoName, MetaClass meta, String fieldName, MetadataContext context) { logger.info("cms updateMetaField: {}, {}, {}, {}", new Object[] { repoName, meta.getName(), fieldName, context.getSourceIp() }); checkServerState(p, true); Repository repo = repositoryService.getRepository(repoName); context.setDbConfig(dbConfig); MetaClass metaClass = repo.getMetadataService().updateMetaField(meta, fieldName, context); updateMetadataIndexOnBranch(metaClass.getName(), context, repo); return metaClass; } private  CMSServer(ICMSConfig config); }
CMSServer { public MetaClass updateMetaField(CMSPriority p, String repoName, MetaClass meta, String fieldName, MetadataContext context) { logger.info("cms updateMetaField: {}, {}, {}, {}", new Object[] { repoName, meta.getName(), fieldName, context.getSourceIp() }); checkServerState(p, true); Repository repo = repositoryService.getRepository(repoName); context.setDbConfig(dbConfig); MetaClass metaClass = repo.getMetadataService().updateMetaField(meta, fieldName, context); updateMetadataIndexOnBranch(metaClass.getName(), context, repo); return metaClass; } private  CMSServer(ICMSConfig config); Registration getDalImplementation(String id); void addWriteRequest(int value, long timestamp, Object detail, boolean isSuccess); MonitorStatisticsManager getMonitorStatisticsManager(); CMSDBConfig getDBConfig(); void start(); void pause(); void resume(); void shutdown(); IBranch createBranch(CMSPriority p, IBranch branch, EntityContext context); IBranch getBranch(CMSPriority p, String repoName, String branchId, EntityContext context); List<IBranch> getMainBranches(CMSPriority p, String repoName, EntityContext context); Map<String, IManagementServices.ServiceStatus> getServiceStatuses(); IManagementServices.ServiceStatus getServiceStatus(String serviceName); void setServiceStatus(String serviceName, IManagementServices.ServiceStatus status); Map<String, Object> getStatistics(); Map<String, Object> getStatistics(String metricName); CMSState.State getState(); List<Repository> getRepositories(CMSPriority p, MetadataContext context); Repository getRepository(CMSPriority p, String repoName); Repository createRepository(CMSPriority p, Repository repo); void updateRepository(CMSPriority p, Repository repo); void deleteRepository(CMSPriority p, String repoName); List<MetaClass> getMetaClasses(CMSPriority p, String repoName, MetadataContext context); MetaClass getMetaClass(CMSPriority p, String repoName, String metaclassName); Map<String, List<String>> getMetaClassHierarchy(CMSPriority p, String repoName, String metaclassName, MetadataContext context); MetaClass getMetaClass(CMSPriority p, String repoName, String metaclassName, int version); void addIndex(CMSPriority p, String repoName, String metaclassName, List<IndexInfo> index,
			MetadataContext context); void deleteIndex(CMSPriority p, String repoName, String metaclassName, String indexName,
			MetadataContext context); List<IEntity> getMetaHistory(CMSPriority p, String repositoryId, String metaType, MetadataContext context); List<MetaClass> batchUpsert(CMSPriority p, String repoName, List<MetaClass> metas, MetadataContext context); MetaClass updateMetaField(CMSPriority p, String repoName, MetaClass meta, String fieldName,
			MetadataContext context); void deleteMetadata(CMSPriority p, String repoName, String metaclassName, MetadataContext context); void validateMetadata(CMSPriority p, String repoName, String metaclassName, MetadataContext context); void deleteMetaField(CMSPriority p, String repoName, String metaclassName, String fieldName,
			MetadataContext context); IEntity get(CMSPriority p, IEntity queryEntity, Map<String, List<String>> params, EntityContext context); void delete(CMSPriority p, IEntity queryEntity, EntityContext context); String create(CMSPriority p, IEntity entity, EntityContext context); List<String> batchCreate(CMSPriority p, List<IEntity> entities, EntityContext context, List<String> parseFails); List<String> batchUpdate(CMSPriority p, List<IEntity> entities, EntityContext context, List<String> parseFails); List<String> batchDelete(CMSPriority p, List<IEntity> entities, EntityContext context, List<String> parseFails); IQueryResult batchGet(CMSPriority p, String metadata, Map<String, List<String>> params, QueryContext context); void replace(CMSPriority p, IEntity queryEntity, IEntity entity, EntityContext context); void modify(CMSPriority p, IEntity queryEntity, IEntity entity, EntityContext context); void modifyField(CMSPriority p, IEntity queryEntity, IEntity entity, String fieldName, EntityContext context); void casModifyField(CMSPriority p, IEntity queryEntity, IEntity entity, String fieldName, Object oldValue,
			EntityContext context); void deleteField(CMSPriority p, IEntity queryEntity, String fieldName, EntityContext context); IQueryResult query(CMSPriority p, String query, QueryContext context); Map<String, MetaClass> getQueryMetaClass(CMSPriority priority, String query, QueryContext context); void registerEvent(IEventListener listener); boolean removeEvent(IEventListener listener); static synchronized CMSServer getCMSServer(); static synchronized CMSServer getCMSServer(Map<String, String> configs); void setEntityOperationCallback(IEntityOperationCallback callback); Map<String, Object> getCurrentConfigurations(); Set<String> getConfigNames(); void config(Map<String, Object> configs); ConsistentPolicy parsePolicy(String policy); PaginationMode parsePaginationMode(String mode); void pullField(CMSPriority p, IEntity queryEntity,
            IEntity entity, String fieldName, EntityContext context); int getThrottlingLevel(); void setThrottlingLevel(int throttlingLevel); MongoDataSource getDataSource(); }
CMSServer { public MetaClass updateMetaField(CMSPriority p, String repoName, MetaClass meta, String fieldName, MetadataContext context) { logger.info("cms updateMetaField: {}, {}, {}, {}", new Object[] { repoName, meta.getName(), fieldName, context.getSourceIp() }); checkServerState(p, true); Repository repo = repositoryService.getRepository(repoName); context.setDbConfig(dbConfig); MetaClass metaClass = repo.getMetadataService().updateMetaField(meta, fieldName, context); updateMetadataIndexOnBranch(metaClass.getName(), context, repo); return metaClass; } private  CMSServer(ICMSConfig config); Registration getDalImplementation(String id); void addWriteRequest(int value, long timestamp, Object detail, boolean isSuccess); MonitorStatisticsManager getMonitorStatisticsManager(); CMSDBConfig getDBConfig(); void start(); void pause(); void resume(); void shutdown(); IBranch createBranch(CMSPriority p, IBranch branch, EntityContext context); IBranch getBranch(CMSPriority p, String repoName, String branchId, EntityContext context); List<IBranch> getMainBranches(CMSPriority p, String repoName, EntityContext context); Map<String, IManagementServices.ServiceStatus> getServiceStatuses(); IManagementServices.ServiceStatus getServiceStatus(String serviceName); void setServiceStatus(String serviceName, IManagementServices.ServiceStatus status); Map<String, Object> getStatistics(); Map<String, Object> getStatistics(String metricName); CMSState.State getState(); List<Repository> getRepositories(CMSPriority p, MetadataContext context); Repository getRepository(CMSPriority p, String repoName); Repository createRepository(CMSPriority p, Repository repo); void updateRepository(CMSPriority p, Repository repo); void deleteRepository(CMSPriority p, String repoName); List<MetaClass> getMetaClasses(CMSPriority p, String repoName, MetadataContext context); MetaClass getMetaClass(CMSPriority p, String repoName, String metaclassName); Map<String, List<String>> getMetaClassHierarchy(CMSPriority p, String repoName, String metaclassName, MetadataContext context); MetaClass getMetaClass(CMSPriority p, String repoName, String metaclassName, int version); void addIndex(CMSPriority p, String repoName, String metaclassName, List<IndexInfo> index,
			MetadataContext context); void deleteIndex(CMSPriority p, String repoName, String metaclassName, String indexName,
			MetadataContext context); List<IEntity> getMetaHistory(CMSPriority p, String repositoryId, String metaType, MetadataContext context); List<MetaClass> batchUpsert(CMSPriority p, String repoName, List<MetaClass> metas, MetadataContext context); MetaClass updateMetaField(CMSPriority p, String repoName, MetaClass meta, String fieldName,
			MetadataContext context); void deleteMetadata(CMSPriority p, String repoName, String metaclassName, MetadataContext context); void validateMetadata(CMSPriority p, String repoName, String metaclassName, MetadataContext context); void deleteMetaField(CMSPriority p, String repoName, String metaclassName, String fieldName,
			MetadataContext context); IEntity get(CMSPriority p, IEntity queryEntity, Map<String, List<String>> params, EntityContext context); void delete(CMSPriority p, IEntity queryEntity, EntityContext context); String create(CMSPriority p, IEntity entity, EntityContext context); List<String> batchCreate(CMSPriority p, List<IEntity> entities, EntityContext context, List<String> parseFails); List<String> batchUpdate(CMSPriority p, List<IEntity> entities, EntityContext context, List<String> parseFails); List<String> batchDelete(CMSPriority p, List<IEntity> entities, EntityContext context, List<String> parseFails); IQueryResult batchGet(CMSPriority p, String metadata, Map<String, List<String>> params, QueryContext context); void replace(CMSPriority p, IEntity queryEntity, IEntity entity, EntityContext context); void modify(CMSPriority p, IEntity queryEntity, IEntity entity, EntityContext context); void modifyField(CMSPriority p, IEntity queryEntity, IEntity entity, String fieldName, EntityContext context); void casModifyField(CMSPriority p, IEntity queryEntity, IEntity entity, String fieldName, Object oldValue,
			EntityContext context); void deleteField(CMSPriority p, IEntity queryEntity, String fieldName, EntityContext context); IQueryResult query(CMSPriority p, String query, QueryContext context); Map<String, MetaClass> getQueryMetaClass(CMSPriority priority, String query, QueryContext context); void registerEvent(IEventListener listener); boolean removeEvent(IEventListener listener); static synchronized CMSServer getCMSServer(); static synchronized CMSServer getCMSServer(Map<String, String> configs); void setEntityOperationCallback(IEntityOperationCallback callback); Map<String, Object> getCurrentConfigurations(); Set<String> getConfigNames(); void config(Map<String, Object> configs); ConsistentPolicy parsePolicy(String policy); PaginationMode parsePaginationMode(String mode); void pullField(CMSPriority p, IEntity queryEntity,
            IEntity entity, String fieldName, EntityContext context); int getThrottlingLevel(); void setThrottlingLevel(int throttlingLevel); MongoDataSource getDataSource(); static final String MONITOR_SERVICE; static final String HEALTHY_SERVICE; static final String THROTTLING_SERVICE; static final List<DalErrCodeEnum> CMS_FAILURE_ERROR_CODES; }