use of org.pentaho.di.repository.pur.model.EEJobMeta in project pentaho-kettle by pentaho.
the class SpoonMenuLockController method updateMenu.
public void updateMenu(Document doc) {
try {
Spoon spoon = Spoon.getInstance();
// If we are working with an Enterprise Repository
if ((spoon != null) && (spoon.getRepository() != null) && (spoon.getRepository() instanceof PurRepository)) {
ILockService service = getService(spoon.getRepository());
EngineMetaInterface meta = spoon.getActiveMeta();
// If (meta is not null) and (meta is either a Transformation or Job)
if ((meta != null) && (meta instanceof ILockable)) {
RepositoryLock repoLock = null;
if (service != null && meta.getObjectId() != null) {
if (meta instanceof EEJobMeta) {
repoLock = service.getJobLock(meta.getObjectId());
} else {
repoLock = service.getTransformationLock(meta.getObjectId());
}
}
// If (there is a lock on this item) and (the UserInfo does not have permission to unlock this file)
if (repoLock != null) {
if (!service.canUnlockFileById(meta.getObjectId())) {
// User does not have modify permissions on this file
// $NON-NLS-1$
((XulToolbarbutton) doc.getElementById("toolbar-file-save")).setDisabled(true);
// $NON-NLS-1$
((XulMenuitem) doc.getElementById("file-save")).setDisabled(true);
}
}
}
}
} catch (Exception e) {
throw new RuntimeException(e);
}
}
use of org.pentaho.di.repository.pur.model.EEJobMeta in project pentaho-kettle by pentaho.
the class PurRepository method loadJob.
@Override
public JobMeta loadJob(ObjectId idJob, String versionLabel) throws KettleException {
try {
RepositoryFile file = null;
if (versionLabel != null) {
file = pur.getFileAtVersion(idJob.getId(), versionLabel);
} else {
file = pur.getFileById(idJob.getId());
}
EEJobMeta jobMeta = new EEJobMeta();
jobMeta.setName(file.getTitle());
jobMeta.setDescription(file.getDescription());
jobMeta.setObjectId(new StringObjectId(file.getId().toString()));
jobMeta.setObjectRevision(getObjectRevision(new StringObjectId(file.getId().toString()), versionLabel));
jobMeta.setRepository(this);
jobMeta.setRepositoryDirectory(findDirectory(getParentPath(file.getPath())));
// inject metastore
jobMeta.setMetaStore(getMetaStore());
readJobMetaSharedObjects(jobMeta);
// Additional obfuscation through obscurity
jobMeta.setRepositoryLock(unifiedRepositoryLockService.getLock(file));
jobDelegate.dataNodeToElement(pur.getDataAtVersionForRead(idJob.getId(), versionLabel, NodeRepositoryFileData.class).getNode(), jobMeta);
ExtensionPointHandler.callExtensionPoint(log, KettleExtensionPoint.JobMetaLoaded.id, jobMeta);
jobMeta.clearChanged();
return jobMeta;
} catch (Exception e) {
throw new KettleException("Unable to load job with id [" + idJob + "]", e);
}
}
Aggregations