本文整理汇总了Java中org.mule.api.annotations.Processor类的典型用法代码示例。如果您正苦于以下问题:Java Processor类的具体用法?Java Processor怎么用?Java Processor使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Processor类属于org.mule.api.annotations包,在下文中一共展示了Processor类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveApplicationLogs
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Get application log
*
* @param domain
* @param endDate
* @param startDate
* @param limit
* @param offset
* @param priority
* @param search
* @param tail
* @param worker
* @return LogResults, POJO that contains the requested logs
*/
@Processor
public LogResults retrieveApplicationLogs(String domain, @Optional String endDate, @Optional String startDate, @Default("100") Integer limit, @Optional Integer offset,
@Optional LogPriority priority, @Optional String search, @Optional Boolean tail, @Optional String worker) {
Map<String, String> queryParams = new HashMap<String, String>();
addToMapIfNotNull("endDate", endDate, queryParams);
addToMapIfNotNull("startDate", startDate, queryParams);
addToMapIfNotNull("limit", limit, queryParams);
addToMapIfNotNull("offset", offset, queryParams);
addToMapIfNotNull("priority", priority, queryParams);
addToMapIfNotNull("search", search, queryParams);
addToMapIfNotNull("tail", tail, queryParams);
addToMapIfNotNull("worker", worker, queryParams);
return client().connectWithDomain(domain).retrieveApplicationLog(queryParams);
}
示例2: importToModel
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Reads in CSV data that represents an Anaplan model, delimited by the
* provided delimiter, parses it, then loads it into an Anaplan model.
*
* {@sample.xml ../../../doc/anaplan-connector.xml.sample anaplan:import-to-model}
*
* @param data Stringified CSV data that is to be imported into Anaplan.
* @param workspaceId Anaplan workspace ID.
* @param modelId Anaplan model ID.
* @param importId Action ID of the Import operation.
* @param columnSeparator Column separator, defaults to comma.
* @param delimiter Cell escape values, defaults to double-quotes.
* @return Status message from running the Import operation.
* @throws AnaplanConnectionException When an error occurs during
* authentication
* @throws AnaplanOperationException When the Import operation encounters an
* error.
*/
@Processor(friendlyName = "Import")
public String importToModel(
@Payload String data,
@FriendlyName("Workspace name or ID") String workspaceId,
@FriendlyName("Model name or ID") String modelId,
@FriendlyName("Import name or ID") String importId,
@FriendlyName("Column separator")
@Default(Delimiters.COMMA) String columnSeparator,
@FriendlyName("Delimiter")
@Default(Delimiters.ESCAPE_CHARACTER) String delimiter)
throws AnaplanConnectionException,
AnaplanOperationException {
// validate API connectionStrategy
connectionStrategy.validateConnection();
// start the import
importer = new AnaplanImportOperation(
connectionStrategy.getApiConnection());
return importer.runImport(data, workspaceId, modelId, importId,
columnSeparator, delimiter);
}
示例3: deleteFromModel
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Deletes data from a model by executing the respective delete action.
*
* {@sample.xml ../../../doc/anaplan-connector.xml.sample anaplan:delete-from-model}
*
* @param workspaceId Anaplan workspace ID.
* @param modelId Anaplan model ID.
* @param deleteActionId Anaplan delete action ID.
* @return Status Any response message from running the Delete Action.
* @throws AnaplanConnectionException When an error occurs at authentication.
* @throws AnaplanOperationException When the Action encounters an error
* while executing.
*/
@Processor(friendlyName="Delete")
public String deleteFromModel(
@FriendlyName("Workspace name or ID") String workspaceId,
@FriendlyName("Model name or ID") String modelId,
@FriendlyName("Delete action name or ID") String deleteActionId)
throws AnaplanConnectionException,
AnaplanOperationException {
// validate the API connectionStrategy
connectionStrategy.validateConnection();
// start the delete process
deleter = new AnaplanDeleteOperation(
connectionStrategy.getApiConnection());
return deleter.runDeleteAction(workspaceId, modelId, deleteActionId);
}
示例4: runProcess
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Runs a specific Anaplan Process, which could be a multitude of actions
* represented as a single Anaplan process.
*
* {@sample.xml ../../../doc/anaplan-connector.xml.sample anaplan:run-process}
*
* @param workspaceId Anaplan workspace ID against which to run the process.
* @param modelId Anaplan model ID against which to run the process.
* @param processId Anaplan process ID
* @return Status response string of running the process, along with any
* failure dump strings as applicable.
* @throws AnaplanConnectionException Thrown when if API connection errors out.
* @throws AnaplanOperationException Thrown when the Process operation fails.
*/
@Processor(friendlyName="Process")
public String runProcess(
@FriendlyName("Workspace name or ID") String workspaceId,
@FriendlyName("Model name or ID") String modelId,
@FriendlyName("Process name or ID") String processId)
throws AnaplanConnectionException,
AnaplanOperationException {
// validate the API connectionStrategy
connectionStrategy.validateConnection();
// run the process
processRunner = new AnaplanProcessOperation(
connectionStrategy.getApiConnection());
return processRunner.runProcess(workspaceId, modelId, processId);
}
示例5: Store
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Store an object given a specific key.
* <p/>
* {@sample.xml ../../../doc/Couchbase-connector.xml.sample couchbase:Store}
*
* @param key The key of the JSON object you want to store.
* @param value The value in JSON (as a string).
*/
@Processor
public void Store(String key, String value)
{
OperationFuture<Boolean> setOp = client.set(key, Integer.MAX_VALUE, value);
try
{
if (setOp.get().booleanValue())
{
System.out.println("Set Succeeded");
}
else
{
System.err.println("Set failed: " + setOp.getStatus().getMessage());
}
}
catch (Exception e)
{
System.err.println("Exception while doing set: " + e.getMessage());
}
}
示例6: alias
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Alias two identities.
*
* {@sample.xml ../../../doc/KissMetrics-connector.xml.sample kissmetrics:alias}
*
* @param person The person the event relates to.
* @param person2 the second identity.
* @throws IOException A problem communicating with KissMetrics occurred.
*/
@Processor
public void alias(String person, String person2) throws IOException {
WebTarget resource = client.target("https://trk.kissmetrics.com/s")
.queryParam("_k", apiKey)
.queryParam("_p", person)
.queryParam("_n", person2);
Response clientResponse = resource.request().get();
if (logger.isDebugEnabled()) {
logger.debug(clientResponse.toString());
}
if (clientResponse.getStatus() == 200) {
return;
}
throw new IOException("Could not record event. Got status: " + clientResponse.getStatus());
}
示例7: queryAndFetch
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Runs a NXQL Query against repository, result is returned as a list of
* pages of Records
*
* {@sample.xml ../../../doc/Nuxeo-connector.xml.sample
* nuxeo:query-and-fetch}
*
* @param query the NXQL Query
* @param page the page number
* @param pageSize the page size
* @param queryParams the query parameters if any
* @param sortInfo sort columns
* @return a batched list of Records
* @throws Exception if operation can not be executed
*/
@Category(name = "Query", description = "execute a queryAndFetch")
@Processor
public RecordSet queryAndFetch(@Placement(group = "operation parameters")
String query, @Placement(group = "operation parameters")
@Optional
@Default("0")
Integer page, @Placement(group = "operation parameters")
@Optional
@Default("20")
Integer pageSize, @Placement(group = "operation parameters")
@Optional
@FriendlyName("Query parameters")
List<String> queryParams, @Placement(group = "operation parameters")
@Optional
@FriendlyName("Sort columns")
List<String> sortInfo) throws Exception {
return (RecordSet) execPageProvider(null, query, page, pageSize,
queryParams, sortInfo, true);
}
示例8: pageProvider
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Runs a Page Provider (named query) against repository, result is returned
* as a list of pages of Document
*
* {@sample.xml ../../../doc/Nuxeo-connector.xml.sample nuxeo:page-provider}
*
* @param pageProviderName the name if the PagteProvider to run
* @param page the page number
* @param pageSize the page size
* @param queryParams the query parameters if any
* @param sortInfo sort columns
* @return a batched list of Documents
* @throws Exception if operation can not be executed
*/
@Processor
@Category(name = "Query", description = "execute a PageProvider")
public Documents pageProvider(@Placement(group = "operation parameters")
String pageProviderName, @Placement(group = "operation parameters")
@Optional
@Default("0")
Integer page, @Placement(group = "operation parameters")
@Optional
@Default("20")
Integer pageSize, @Placement(group = "operation parameters")
@Optional
@FriendlyName("Query parameters")
List<String> queryParams, @Placement(group = "operation parameters")
@Optional
@FriendlyName("Sort columns")
List<String> sortInfo) throws Exception {
return (Documents) execPageProvider(pageProviderName, null, page,
pageSize, queryParams, sortInfo, false);
}
示例9: setBlob
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Attach a Blob to a Document
*
* {@sample.xml ../../../doc/Nuxeo-connector.xml.sample nuxeo:set-blob}
*
* @param doc reference to the target Document
* @param blob Blob to attach
* @param xpath Xpath of the target property
* @throws Exception if operation can not be executed
*/
@Processor
public void setBlob(@Placement(group = "operation parameters")
String doc, @Placement(group = "operation parameters")
NuxeoBlob blob, @Optional
@Default("")
@Placement(group = "operation parameters")
String xpath) throws Exception {
OperationRequest req = session.newRequest(docService.SetBlob).setInput(
blob).set("document", doc);
if (xpath != null) {
req.set("xpath", xpath);
}
req.setHeader(Constants.HEADER_NX_VOIDOP, "true");
req.execute();
}
示例10: resizePicture
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* resize the input Blob Picture
*
* {@sample.xml ../../../doc/Nuxeo-connector.xml.sample
* nuxeo:resize-picture}
*
* @param blobOrDoc blob or document that contains the picture
* @param maxWidth target maximum Width in pixels
* @param maxHeight target maximum Height in pixels
*
* @return the resized Picture
*
* @throws Exception if operation can not be executed
*/
@Processor
public NuxeoBlob resizePicture(@Placement(group = "operation parameters")
Object blobOrDoc, @Placement(group = "operation parameters")
@Optional
Integer maxWidth, @Placement(group = "operation parameters")
@Optional
Integer maxHeight) throws Exception {
OperationRequest req = session.newRequest("Picture.resize").setInput(
getInput(blobOrDoc));
if (maxWidth != null) {
req.set("maxWidth", maxWidth);
}
if (maxHeight != null) {
req.set("maxHeight", maxHeight);
}
return new NuxeoBlob((Blob) req.execute());
}
示例11: importFile
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* create a Document from a file
*
* {@sample.xml ../../../doc/Nuxeo-connector.xml.sample nuxeo:import-file}
*
* @param blobOrDoc blob or document that contains the picture
* @param overwrite define if existing document should be overriden
* @param inbound inbound headers that can hold some automation Context info
*
* @return the created Document
*
* @throws Exception if operation can not be executed
*/
@Processor
public Document importFile(@Placement(group = "operation parameters")
NuxeoBlob blobOrDoc, @Placement(group = "operation parameters")
@Optional
@Default("false")
boolean overwrite, @InboundHeaders("*")
final Map<String, Object> inbound) throws Exception {
OperationRequest req = session.newRequest("FileManager.Import").setInput(
getInput(blobOrDoc));
propagateAutomationContext(inbound, req);
// XXX typo !
req.set("overwite", overwrite);
return (Document) req.execute();
}
示例12: startWorkflow
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
*
* Starts the workflow with the given model id on the input documents
*
* {@sample.xml ../../../doc/Nuxeo-connector.xml.sample
* nuxeo:start-workflow}
*
* @param docRef target Document the Workflow should be started on
* @param workflowId uuid of the workflow to be started
* @param start start flag
* @param wfVars workflow variables
*
* @return the doc
*
* @throws Exception if operation can not be executed
*/
@Processor
public Document startWorkflow(@Placement(group = "operation parameters")
String docRef, @Placement(group = "operation parameters")
String workflowId, @Placement(group = "operation parameters")
@Optional
@Default("false")
boolean start, @Placement(group = "operation parameters")
@Optional
Map<String, Object> wfVars) throws Exception {
OperationRequest req = session.newRequest("Context.StartWorkflow").setInput(
DocRef.newRef(docRef));
req.set("Id", workflowId);
req.set("start", start);
req.set("variables", MapUnmangler.unMangle(wfVars));
return (Document) req.execute();
}
示例13: completeTask
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Completes the input task document.
*
* {@sample.xml ../../../doc/Nuxeo-connector.xml.sample nuxeo:complete-task}
*
* @param docRef target Task document
* @param comment optional comment
* @param status optional status
*
* @return the task document
*
* @throws Exception if operation can not be executed
*/
@Processor
public Document completeTask(@Placement(group = "operation parameters")
String docRef, @Placement(group = "operation parameters")
@Optional
String comment, @Placement(group = "operation parameters")
@Optional
String status) throws Exception {
OperationRequest req = session.newRequest(
"Workflow.CompleteTaskOperation").setInput(
DocRef.newRef(docRef));
if (comment != null) {
req.set("comment", comment);
}
if (status != null) {
req.set("status", status);
}
return (Document) req.execute();
}
示例14: createSchedule
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Creates a scheduled command tht will execute at a specific date and time
* <p/>
* {@sample.xml ../../../doc/Hue-connector.xml.sample hue:create-schedule}
*
* @param command Representation of a command that that can be sent to the scheduling
* API to execute the command at a specific time
* i.e. 'turn the lights on in the morning at 7am'
* A command represents a resource address, the HTTP verb and the body as the data to
* send to the resource.
* @param scheduleName for the new schedule. If a name is not specified then the default name, “schedule”, is used.
* If the name is already taken a space and number will be appended by the bridge, e.g. “schedule 1”.
* @param time Time when the scheduled event will occur in ISO 8601:2004 format.
* The bridge measures time in UTC and only accepts extended format, non-recurring, local time (YYYY-MM-DDThh:mm:ss).
* Incorrectly formatted dates will raise an error of type 7. If the time is in the past an error 7 will also be raised.
* @param description Description of the new schedule. If the description is not specified it will be empty.
*
* @return a string json response with either success message. If there is an error returned then an IOExecption is thrown
* @throws IOException if there is a connection error or if the call returns an error response
*/
@Processor
public String createSchedule(@Placement(group = "Schedule", order = 1) @FriendlyName("Name") String scheduleName,
@Placement(group = "Schedule", order = 2) String time,
@Placement(group = "Schedule", order = 3) @Optional String description,
@Placement(group = "Command to Execute") Command command) throws IOException
{
Schedule s = new Schedule();
s.setCommand(command);
s.setName(scheduleName);
s.setTime(time);
s.setDescription(description);
WebResource resource = httpClient.resource(getBaseUri() + "/schedules");
String response = resource.post(String.class, mapper.writeValueAsString(s));
if (response.contains("error"))
{
throw new IOException(response);
}
return response;
}
示例15: compareXml
import org.mule.api.annotations.Processor; //导入依赖的package包/类
/**
* Compare two XML documents. See <a href="https://github.com/xmlunit/user-guide/wiki/">XMLUnit Wiki</a>} how this
* works
*
* @param expected
* The expected value, XML as String, InputStream, byte[] or DOM tree.
* @param actual
* The actual value, XML as String, InputStream, byte[] or DOM tree.
* @param xmlCompareOption
* How to compare the XML documents.
*
* IGNORE_COMMENTS: Will remove all comment-Tags "<!-- Comment -->" from test- and control-XML before
* comparing.
*
* IGNORE_WHITESPACE: Ignore whitespace by removing all empty text nodes and trimming the non-empty ones.
*
* NORMALIZE_WHITESPACE: Normalize Text-Elements by removing all empty text nodes and normalizing the
* non-empty ones.
*
* @return <code>actual</code>
*/
@Processor(friendlyName = "Compare XML")
public Object compareXml(Object expected, //
@Default("#[payload]") Object actual, //
@Default("NORMALIZE_WHITESPACE") @FriendlyName("XML compare option") XmlCompareOption xmlCompareOption) {
DiffBuilder diffBuilder = DiffBuilder.compare(expected).withTest(actual);
switch (xmlCompareOption) {
case IGNORE_COMMENTS:
diffBuilder = diffBuilder.ignoreComments();
break;
case IGNORE_WHITESPACE:
diffBuilder = diffBuilder.ignoreWhitespace();
break;
case NORMALIZE_WHITESPACE:
diffBuilder = diffBuilder.normalizeWhitespace();
break;
default:
throw new IllegalArgumentException("I forgot to implement for a new enum constant.");
}
Diff diff = diffBuilder.build();
if (diff.hasDifferences()) {
throw new AssertionError(diff.toString(new DefaultComparisonFormatter()));
}
return actual;
}