public FeatureView getFeatureViewById()

in src/main/java/com/aliyun/openservices/paifeaturestore/api/FeatureViewApi.java [99:214]


    public FeatureView getFeatureViewById(String featureViewId) throws Exception {
        GetFeatureViewResponse response = this.apiClient.getClient().getFeatureView(this.apiClient.getInstanceId(), featureViewId);
        FeatureView featureView = new FeatureView();
        featureView.setFeatureViewId(Long.valueOf(featureViewId));
        featureView.setProjectId(Long.valueOf(response.getBody().getProjectId()));
        featureView.setProjectName(response.getBody().getProjectName());
        featureView.setName(response.getBody().getName());
        featureView.setType(response.getBody().getType());
        featureView.setConfig(response.getBody().getConfig());
        featureView.setTtl(response.getBody().getTTL());
        featureView.setOnline(response.getBody().getSyncOnlineTable());
        featureView.setFeatureEntityId(Integer.valueOf(response.getBody().getFeatureEntityId()));
        featureView.setFeatureEntityName(response.getBody().getFeatureEntityName());
        featureView.setWriteToFeaturedb(response.getBody().getWriteToFeatureDB());

        // Check whether the registry information of the current response class exists.
        if (!StringUtils.isEmpty(response.getBody().getRegisterTable())) {
            featureView.setIsRegister(true);
            featureView.setRegisterTable(response.getBody().getRegisterTable());
        }
       // Determines whether the registration data source id of the current response class exists.
        if (!StringUtils.isEmpty(response.getBody().getRegisterDatasourceId())) {
            featureView.setRegisterDatasourceId(Integer.valueOf(response.getBody().getRegisterDatasourceId()));
        }
        //  Check whether the configuration class of the current response class exists.
        if (!StringUtils.isEmpty(response.getBody().getLastSyncConfig())) {
            featureView.setLastSyncConfig(response.getBody().getLastSyncConfig());
        }
        // Creates a collection that holds the feature view request fields.
        List<FeatureViewRequestFields> fields = new ArrayList<>();
        int pos = 0;
        for (GetFeatureViewResponseBody.GetFeatureViewResponseBodyFields f : response.getBody().getFields()) {
            FeatureViewRequestFields field = new FeatureViewRequestFields();
            field.setPosition(++pos);
            field.setName( f.getName());

            if (f.getType().equals("STRING")) {
                field.setType(FSType.FS_STRING);
            } else if (f.getType().equals("INT32")) {
                field.setType(FSType.FS_INT32);
            } else if (f.getType().equals("INT64")) {
                field.setType(FSType.FS_INT64);
            } else if (f.getType().equals("FLOAT")) {
                field.setType(FSType.FS_FLOAT);
            } else if (f.getType().equals("DOUBLE")) {
                field.setType(FSType.FS_DOUBLE);
            } else if (f.getType().equals("BOOLEAN")) {
                field.setType(FSType.FS_BOOLEAN);
            } else if (f.getType().equals("TIMESTAMP")) {
                field.setType(FSType.FS_TIMESTAMP);
            } else if (f.getType().equals("ARRAY<INT32>")){
                field.setType(FSType.FS_ARRAY_INT32);
            } else if (f.getType().equals("ARRAY<INT64>")) {
                field.setType(FSType.FS_ARRAY_INT64);
            } else if (f.getType().equals("ARRAY<FLOAT>")){
                field.setType(FSType.FS_ARRAY_FLOAT);
            } else if (f.getType().equals("ARRAY<STRING>")){
                field.setType(FSType.FS_ARRAY_STRING);
            } else if (f.getType().equals("ARRAY<DOUBLE>")){
                field.setType(FSType.FS_ARRAY_DOUBLE);
            } else if (f.getType().equals("ARRAY<ARRAY<FLOAT>>")){
                field.setType(FSType.FS_ARRAY_ARRAY_FLOAT);
            } else if (f.getType().equals("MAP<INT32,INT32>")){
                field.setType(FSType.FS_MAP_INT32_INT32);
            } else if (f.getType().equals("MAP<INT32,INT64>")){
                field.setType(FSType.FS_MAP_INT32_INT64);
            } else if (f.getType().equals("MAP<INT32,FLOAT>")){
                field.setType(FSType.FS_MAP_INT32_FLOAT);
            } else if (f.getType().equals("MAP<INT32,DOUBLE>")){
                field.setType(FSType.FS_MAP_INT32_DOUBLE);
            } else if (f.getType().equals("MAP<INT32,STRING>")){
                field.setType(FSType.FS_MAP_INT32_STRING);
            } else if (f.getType().equals("MAP<INT64,INT32>")){
                field.setType(FSType.FS_MAP_INT64_INT32);
            } else if (f.getType().equals("MAP<INT64,INT64>")){
                field.setType(FSType.FS_MAP_INT64_INT64);
            } else if (f.getType().equals("MAP<INT64,FLOAT>")){
                field.setType(FSType.FS_MAP_INT64_FLOAT);
            } else if (f.getType().equals("MAP<INT64,DOUBLE>")){
                field.setType(FSType.FS_MAP_INT64_DOUBLE);
            } else if (f.getType().equals("MAP<INT64,STRING>")){
                field.setType(FSType.FS_MAP_INT64_STRING);
            } else if (f.getType().equals("MAP<STRING,INT32>")){
                field.setType(FSType.FS_MAP_STRING_INT32);
            } else if (f.getType().equals("MAP<STRING,INT64>")){
                field.setType(FSType.FS_MAP_STRING_INT64);
            } else if (f.getType().equals("MAP<STRING,FLOAT>")){
                field.setType(FSType.FS_MAP_STRING_FLOAT);
            } else if (f.getType().equals("MAP<STRING,DOUBLE>")){
                field.setType(FSType.FS_MAP_STRING_DOUBLE);
            } else if (f.getType().equals("MAP<STRING,STRING>")){
                field.setType(FSType.FS_MAP_STRING_STRING);
            }

            if (null != f.getAttributes()) {
                for (String attr : f.getAttributes()) {
                    if (attr.equals("Partition")) {
                        field.setIsPartition(true);
                    }

                    if (attr.equals("PrimaryKey")) {
                        field.setIsPrimaryKey(true);
                    }

                    if (attr.equals("EventTime")) {
                        field.setIsEventTime(true);
                    }
                }
            }

            fields.add(field);
        }
        featureView.setFields(fields);

        return featureView;
    }