Java Code Examples for org.apache.kylin.metadata.project.ProjectInstance#updateRandomUuid()

The following examples show how to use org.apache.kylin.metadata.project.ProjectInstance#updateRandomUuid() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
public static ProjectInstance generateKylinProjectInstance(String owner, List<TableDesc> kylinTables,
        List<DataModelDesc> kylinModels, List<CubeDesc> kylinCubeDescs) {
    ProjectInstance projectInstance = new ProjectInstance();

    projectInstance.setName(MetricsManager.SYSTEM_PROJECT);
    projectInstance.setOwner(owner);
    projectInstance.setDescription(SYSTEM_PROJECT_DESC);
    projectInstance.setStatus(ProjectStatusEnum.ENABLED);
    projectInstance.setCreateTimeUTC(0L);
    projectInstance.updateRandomUuid();

    if (kylinTables != null)
        projectInstance.setTables(Sets.newHashSet(Lists.transform(kylinTables, new Function<TableDesc, String>() {
            @Nullable
            @Override
            public String apply(@Nullable TableDesc tableDesc) {
                if (tableDesc != null) {
                    return tableDesc.getIdentity();
                }
                return null;
            }
        })));
    else
        projectInstance.setTables(Sets.<String> newHashSet());

    if (kylinModels != null)
        projectInstance.setModels(Lists.transform(kylinModels, new Function<DataModelDesc, String>() {
            @Nullable
            @Override
            public String apply(@Nullable DataModelDesc modelDesc) {
                if (modelDesc != null) {
                    return modelDesc.getName();
                }
                return null;
            }
        }));
    else
        projectInstance.setModels(Lists.<String> newArrayList());

    if (kylinCubeDescs != null)
        projectInstance
                .setRealizationEntries(Lists.transform(kylinCubeDescs, new Function<CubeDesc, RealizationEntry>() {
                    @Nullable
                    @Override
                    public RealizationEntry apply(@Nullable CubeDesc cubeDesc) {
                        if (cubeDesc != null) {
                            RealizationEntry entry = new RealizationEntry();
                            entry.setRealization(cubeDesc.getName());
                            entry.setType(RealizationType.CUBE);
                            return entry;
                        }
                        return null;
                    }
                }));
    else
        projectInstance.setRealizationEntries(Lists.<RealizationEntry> newArrayList());

    return projectInstance;
}
 
Example 2
Source Project: kylin   File: ProjectCreator.java    License: Apache License 2.0 4 votes vote down vote up
public static ProjectInstance generateKylinProjectInstance(String owner, List<TableDesc> kylinTables,
        List<DataModelDesc> kylinModels, List<CubeDesc> kylinCubeDescs) {
    ProjectInstance projectInstance = new ProjectInstance();

    projectInstance.setName(MetricsManager.SYSTEM_PROJECT);
    projectInstance.setOwner(owner);
    projectInstance.setDescription(SYSTEM_PROJECT_DESC);
    projectInstance.setStatus(ProjectStatusEnum.ENABLED);
    projectInstance.setCreateTimeUTC(0L);
    projectInstance.updateRandomUuid();

    if (kylinTables != null)
        projectInstance.setTables(Sets.newHashSet(Lists.transform(kylinTables, new Function<TableDesc, String>() {
            @Nullable
            @Override
            public String apply(@Nullable TableDesc tableDesc) {
                if (tableDesc != null) {
                    return tableDesc.getIdentity();
                }
                return null;
            }
        })));
    else
        projectInstance.setTables(Sets.<String> newHashSet());

    if (kylinModels != null)
        projectInstance.setModels(Lists.transform(kylinModels, new Function<DataModelDesc, String>() {
            @Nullable
            @Override
            public String apply(@Nullable DataModelDesc modelDesc) {
                if (modelDesc != null) {
                    return modelDesc.getName();
                }
                return null;
            }
        }));
    else
        projectInstance.setModels(Lists.<String> newArrayList());

    if (kylinCubeDescs != null)
        projectInstance
                .setRealizationEntries(Lists.transform(kylinCubeDescs, new Function<CubeDesc, RealizationEntry>() {
                    @Nullable
                    @Override
                    public RealizationEntry apply(@Nullable CubeDesc cubeDesc) {
                        if (cubeDesc != null) {
                            RealizationEntry entry = new RealizationEntry();
                            entry.setRealization(cubeDesc.getName());
                            entry.setType(RealizationType.CUBE);
                            return entry;
                        }
                        return null;
                    }
                }));
    else
        projectInstance.setRealizationEntries(Lists.<RealizationEntry> newArrayList());

    return projectInstance;
}