use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class JobEntryTrans method loadRep.
// Load the jobentry from repository
//
@Override
public void loadRep(Repository rep, IMetaStore metaStore, ObjectId id_jobentry, List<DatabaseMeta> databases, List<SlaveServer> slaveServers) throws KettleException {
try {
String method = rep.getJobEntryAttributeString(id_jobentry, "specification_method");
specificationMethod = ObjectLocationSpecificationMethod.getSpecificationMethodByCode(method);
String transId = rep.getJobEntryAttributeString(id_jobentry, "trans_object_id");
transObjectId = Utils.isEmpty(transId) ? null : new StringObjectId(transId);
transname = rep.getJobEntryAttributeString(id_jobentry, "name");
directory = rep.getJobEntryAttributeString(id_jobentry, "dir_path");
filename = rep.getJobEntryAttributeString(id_jobentry, "file_name");
// Backward compatibility check for object specification
//
checkObjectLocationSpecificationMethod();
argFromPrevious = rep.getJobEntryAttributeBoolean(id_jobentry, "arg_from_previous");
paramsFromPrevious = rep.getJobEntryAttributeBoolean(id_jobentry, "params_from_previous");
execPerRow = rep.getJobEntryAttributeBoolean(id_jobentry, "exec_per_row");
clearResultRows = rep.getJobEntryAttributeBoolean(id_jobentry, "clear_rows", true);
clearResultFiles = rep.getJobEntryAttributeBoolean(id_jobentry, "clear_files", true);
setLogfile = rep.getJobEntryAttributeBoolean(id_jobentry, "set_logfile");
addDate = rep.getJobEntryAttributeBoolean(id_jobentry, "add_date");
addTime = rep.getJobEntryAttributeBoolean(id_jobentry, "add_time");
logfile = rep.getJobEntryAttributeString(id_jobentry, "logfile");
logext = rep.getJobEntryAttributeString(id_jobentry, "logext");
logFileLevel = LogLevel.getLogLevelForCode(rep.getJobEntryAttributeString(id_jobentry, "loglevel"));
clustering = rep.getJobEntryAttributeBoolean(id_jobentry, "cluster");
createParentFolder = rep.getJobEntryAttributeBoolean(id_jobentry, "create_parent_folder");
remoteSlaveServerName = rep.getJobEntryAttributeString(id_jobentry, "slave_server_name");
setAppendLogfile = rep.getJobEntryAttributeBoolean(id_jobentry, "set_append_logfile");
waitingToFinish = rep.getJobEntryAttributeBoolean(id_jobentry, "wait_until_finished", true);
followingAbortRemotely = rep.getJobEntryAttributeBoolean(id_jobentry, "follow_abort_remote");
loggingRemoteWork = rep.getJobEntryAttributeBoolean(id_jobentry, "logging_remote_work");
runConfiguration = rep.getJobEntryAttributeString(id_jobentry, "run_configuration");
// How many arguments?
int argnr = rep.countNrJobEntryAttributes(id_jobentry, "argument");
allocateArgs(argnr);
// Read all arguments...
for (int a = 0; a < argnr; a++) {
arguments[a] = rep.getJobEntryAttributeString(id_jobentry, a, "argument");
}
// How many arguments?
int parameternr = rep.countNrJobEntryAttributes(id_jobentry, "parameter_name");
allocateParams(parameternr);
// Read all parameters ...
for (int a = 0; a < parameternr; a++) {
parameters[a] = rep.getJobEntryAttributeString(id_jobentry, a, "parameter_name");
parameterFieldNames[a] = rep.getJobEntryAttributeString(id_jobentry, a, "parameter_stream_name");
parameterValues[a] = rep.getJobEntryAttributeString(id_jobentry, a, "parameter_value");
}
passingAllParameters = rep.getJobEntryAttributeBoolean(id_jobentry, "pass_all_parameters", true);
} catch (KettleDatabaseException dbe) {
throw new KettleException("Unable to load job entry of type 'trans' from the repository for id_jobentry=" + id_jobentry, dbe);
}
}
use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method getElements.
@Override
public List<IMetaStoreElement> getElements(String namespace, IMetaStoreElementType elementType) throws MetaStoreException {
try {
IMetaStoreElementType type = getElementTypeByName(namespace, elementType.getName());
if (type == null) {
return new ArrayList<IMetaStoreElement>();
}
Collection<RowMetaAndData> elementRows = delegate.getElements(new LongObjectId(new StringObjectId(type.getId())));
List<IMetaStoreElement> elements = new ArrayList<IMetaStoreElement>();
for (RowMetaAndData elementRow : elementRows) {
IMetaStoreElement element = delegate.parseElement(elementType, elementRow);
elements.add(element);
}
return elements;
} catch (Exception e) {
throw new MetaStoreException("Unable to get list of elements from namespace '" + namespace + "' and for element type '" + elementType.getName() + "'", e);
}
}
use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method updateElementType.
@Override
public void updateElementType(String namespace, IMetaStoreElementType elementType) throws MetaStoreException {
try {
ObjectId namespaceId = delegate.verifyNamespace(namespace);
String elementTypeId = elementType.getId();
if (elementTypeId == null) {
IMetaStoreElementType type = getElementTypeByName(namespace, elementType.getName());
if (type != null) {
elementTypeId = type.getId();
}
}
if (elementTypeId != null) {
delegate.updateElementType(namespaceId, new LongObjectId(new StringObjectId(elementType.getId())), elementType);
repository.commit();
} else {
throw new MetaStoreException("Unable to update element type: no id was provided and the name '" + elementType.getName() + "' didn't match");
}
} catch (MetaStoreException e) {
throw e;
} catch (Exception e) {
repository.rollback();
throw new MetaStoreException("Unable to update element type", e);
}
}
use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class KettleDatabaseRepositoryMetaStore method getElementType.
@Override
public IMetaStoreElementType getElementType(String namespace, String elementTypeId) throws MetaStoreException {
try {
ObjectId namespaceId = delegate.getNamespaceId(namespace);
if (namespaceId == null) {
return null;
}
RowMetaAndData elementTypeRow = delegate.getElementType(new LongObjectId(new StringObjectId(elementTypeId)));
return delegate.parseElementType(namespace, namespaceId, elementTypeRow);
} catch (Exception e) {
throw new MetaStoreException("Unable to get element type with id '" + elementTypeId + "' in namespace '" + namespace + "'", e);
}
}
use of org.pentaho.di.repository.StringObjectId in project pentaho-kettle by pentaho.
the class KettleFileRepository method getTransformationObjects.
@Override
public List<RepositoryElementMetaInterface> getTransformationObjects(ObjectId idDirectory, boolean includeDeleted) throws KettleException {
try {
List<RepositoryElementMetaInterface> list = new ArrayList<RepositoryElementMetaInterface>();
RepositoryDirectoryInterface tree = loadRepositoryDirectoryTree();
RepositoryDirectoryInterface directory = tree.findDirectory(idDirectory);
String folderName = calcDirectoryName(directory);
FileObject folder = KettleVFS.getFileObject(folderName);
for (FileObject child : folder.getChildren()) {
if (child.getType().equals(FileType.FILE)) {
if (!child.isHidden() || !repositoryMeta.isHidingHiddenFiles()) {
String name = child.getName().getBaseName();
if (name.endsWith(EXT_TRANSFORMATION)) {
String transName = name.substring(0, name.length() - 4);
ObjectId id = new StringObjectId(calcObjectId(directory, transName, EXT_TRANSFORMATION));
Date date = new Date(child.getContent().getLastModifiedTime());
list.add(new RepositoryObject(id, transName, directory, "-", date, RepositoryObjectType.TRANSFORMATION, "", false));
}
}
}
}
return list;
} catch (Exception e) {
throw new KettleException("Unable to get list of transformations in folder with id : " + idDirectory, e);
}
}
Aggregations