use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.
the class ApacheVFSOutputHandlerIT method testAudit.
public void testAudit() {
startTest();
ApacheVFSOutputHandler handler = new ApacheVFSOutputHandler();
IContentItem contentItem = handler.getFileOutputContentItem();
// $NON-NLS-1$
System.out.println("Content Item for VFS" + contentItem);
assertTrue(true);
finishTest();
}
use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.
the class ActionRunner method markContentAsGenerated.
private void markContentAsGenerated(IPostProcessingAction actionBean) {
IUnifiedRepository repo = PentahoSystem.get(IUnifiedRepository.class);
String lineageId = (String) params.get(ActionUtil.QUARTZ_LINEAGE_ID);
for (IContentItem contentItem : actionBean.getActionOutputContents()) {
RepositoryFile sourceFile = getRepositoryFileSafe(repo, contentItem.getPath());
// add metadata if we have access and we have file
if (sourceFile != null) {
Map<String, Serializable> metadata = repo.getFileMetadata(sourceFile.getId());
metadata.put(ActionUtil.QUARTZ_LINEAGE_ID, lineageId);
repo.setFileMetadata(sourceFile.getId(), metadata);
} else {
String fileName = getFSFileNameSafe(contentItem);
logger.warn(Messages.getInstance().getSkipRemovingOutputFile(fileName));
}
}
}
use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.
the class MemoryOutputHandler method getFileOutputContentItem.
public IContentItem getFileOutputContentItem() {
path = getContentRef();
IContentItem item = new BufferedContentItem(this);
item.setName(path);
item.setMimeType(getMimeType());
return item;
}
use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.
the class RuntimeContext method getOutputContentItem.
public IContentItem getOutputContentItem(final String outputName, final String mimeType) {
IContentItem contentItem = null;
IActionParameter parameter = (IActionParameter) actionSequence.getOutputDefinitions().get(outputName);
if (parameter == null) {
warn(Messages.getInstance().getErrorString("RuntimeContext.ERROR_0021_INVALID_OUTPUT_REQUEST", outputName, // $NON-NLS-1$
actionSequence.getSequenceName()));
} else {
List destinationsList = parameter.getVariables();
Iterator destinationsIterator = destinationsList.iterator();
if (destinationsList.size() > 1) {
contentItem = new MultiContentItem();
}
while (destinationsIterator.hasNext()) {
ActionParameterSource destination = (ActionParameterSource) destinationsIterator.next();
String objectName = destination.getSourceName();
String contentName = destination.getValue();
contentName = TemplateUtil.applyTemplate(contentName, this);
outputHandler.setSession(session);
IContentItem tmpContentItem = outputHandler.getOutputContentItem(objectName, contentName, instanceId, mimeType);
addOutputContentItem(tmpContentItem);
if (contentItem instanceof MultiContentItem) {
((MultiContentItem) contentItem).addContentItem(tmpContentItem);
} else {
contentItem = tmpContentItem;
break;
}
}
}
return contentItem;
}
use of org.pentaho.platform.api.repository.IContentItem in project pentaho-platform by pentaho.
the class RuntimeContext method getInputStream.
public InputStream getInputStream(final String parameterName) {
InputStream inputStream = null;
IActionParameter inputParameter = getInputParameter(parameterName);
if (inputParameter == null) {
throw new InvalidParameterException(Messages.getInstance().getErrorString("RuntimeContext.ERROR_0019_INVALID_INPUT_REQUEST", parameterName, // $NON-NLS-1$
actionSequence.getSequenceName()));
}
Object value = inputParameter.getValue();
if (value instanceof IContentItem) {
IContentItem contentItem = (IContentItem) value;
inputStream = contentItem.getInputStream();
}
return inputStream;
}
Aggregations