use of org.pentaho.metastore.api.IMetaStoreElementType in project pentaho-kettle by pentaho.
the class StarDomainMetaStoreUtil method loadStarDomain.
public static StarDomain loadStarDomain(DelegatingMetaStore metaStore, String id) throws MetaStoreException {
IMetaStoreElementType elementType = getStarDomainElementType(metaStore);
IMetaStoreElement element = metaStore.getElement(namespace, elementType, id);
if (element == null) {
return null;
}
StarDomain starDomain = new StarDomain();
starDomain.setObjectId(new StringObjectId(id));
starDomain.setName(element.getName());
starDomain.setDescription(getChildString(element, Attribute.ID_STAR_DOMAIN_DESCRIPTION.id));
return starDomain;
}
use of org.pentaho.metastore.api.IMetaStoreElementType in project pentaho-kettle by pentaho.
the class StarDomainMetaStoreUtil method getStarDomainList.
public static List<IdNameDescription> getStarDomainList(IMetaStore metaStore) throws MetaStoreException {
IMetaStoreElementType elementType = getStarDomainElementType(metaStore);
List<IdNameDescription> list = new ArrayList<IdNameDescription>();
for (IMetaStoreElement element : metaStore.getElements(namespace, elementType)) {
IdNameDescription nameDescription = new IdNameDescription(element.getId(), element.getName(), getChildString(element, Attribute.ID_STAR_DOMAIN_DESCRIPTION.id));
list.add(nameDescription);
}
return list;
}
use of org.pentaho.metastore.api.IMetaStoreElementType in project pentaho-kettle by pentaho.
the class StarDomainMetaStoreUtil method createStarDomainElementType.
public static IMetaStoreElementType createStarDomainElementType(IMetaStore metaStore) throws MetaStoreElementTypeExistsException, MetaStoreException {
IMetaStoreElementType elementType = metaStore.newElementType(namespace);
elementType.setName(METASTORE_STAR_DOMAIN_TYPE_NAME);
elementType.setDescription(METASTORE_STAR_DOMAIN_TYPE_DESCRIPTION);
metaStore.createElementType(namespace, elementType);
return elementType;
}
use of org.pentaho.metastore.api.IMetaStoreElementType in project pentaho-kettle by pentaho.
the class PurRepositoryMetaStore method getElementTypes.
@Override
public List<IMetaStoreElementType> getElementTypes(String namespace) throws MetaStoreException {
List<IMetaStoreElementType> elementTypes = new ArrayList<IMetaStoreElementType>();
RepositoryFile namespaceFile = validateNamespace(namespace);
List<RepositoryFile> children = getChildren(namespaceFile.getId());
for (RepositoryFile child : children) {
if (!child.isHidden()) {
elementTypes.add(getElementType(namespace, child.getId().toString()));
}
}
return elementTypes;
}
use of org.pentaho.metastore.api.IMetaStoreElementType in project pentaho-kettle by pentaho.
the class PurRepositoryMetaStore method createElementType.
// The element types
@Override
public void createElementType(String namespace, IMetaStoreElementType elementType) throws MetaStoreException {
RepositoryFile namespaceFile = validateNamespace(namespace);
IMetaStoreElementType existingType = getElementTypeByName(namespace, elementType.getName());
if (existingType != null) {
throw new MetaStoreElementTypeExistsException(Collections.singletonList(existingType), "Can not create element type with id '" + elementType.getId() + "' because it already exists");
}
RepositoryFile elementTypeFile = new RepositoryFile.Builder(elementType.getName()).folder(true).versioned(false).build();
RepositoryFile folder = pur.createFolder(namespaceFile.getId(), elementTypeFile, null);
elementType.setId(folder.getId().toString());
// In this folder there is a hidden file which contains the description
// and the other future properties of the element type
//
RepositoryFile detailsFile = new RepositoryFile.Builder(ELEMENT_TYPE_DETAILS_FILENAME).folder(false).title(ELEMENT_TYPE_DETAILS_FILENAME).description(elementType.getDescription()).hidden(true).build();
DataNode dataNode = getElementTypeDataNode(elementType);
pur.createFile(folder.getId(), detailsFile, new NodeRepositoryFileData(dataNode), null);
elementType.setMetaStoreName(getName());
}
Aggregations