本文整理汇总了Java中org.mule.api.annotations.param.Default类的典型用法代码示例。如果您正苦于以下问题:Java Default类的具体用法?Java Default怎么用?Java Default使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Default类属于org.mule.api.annotations.param包,在下文中一共展示了Default类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: retrieveApplicationLogs
import org.mule.api.annotations.param.Default; //导入依赖的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.param.Default; //导入依赖的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: connect
import org.mule.api.annotations.param.Default; //导入依赖的package包/类
/**
* Connect to the Anaplan API using an issued certificate. The certificate
* path is provided and the file is loaded into a Java Keystore and loaded
* into a X509Certificate object for use.
*
* @param certificatePath Filepath to certificate on local filesystem
* @param url API URL.
* @param proxyHost Proxy username if behind firewall.
* @param proxyUser Proxy username to get through firewall.
* @param proxyPass Proxy password to get through firewall.
* @throws org.mule.api.ConnectionException Whenever the connection to API
* fails due to expired certificate or invalid API endpoint or proxy
* details.
*/
@Connect
@TestConnectivity
public synchronized void connect(
@ConnectionKey @Path String certificatePath,
@Default("https://api.anaplan.com/") String url,
@Optional @Default("") String proxyHost,
@Optional @Default("") String proxyUser,
@Optional @Default("") String proxyPass)
throws org.mule.api.ConnectionException {
logger.info("Initiating certificate connection...");
if (apiConn == null) {
// create the connection strategy using certificate path.
apiConn = new AnaplanConnection(true, certificatePath, url,
proxyHost, proxyUser, proxyPass);
// Establish connection using new connection object and verify
// service parameters
connectToApi();
}
}
示例4: connect
import org.mule.api.annotations.param.Default; //导入依赖的package包/类
/**
* Connect to the Anaplan API via basic authentication using provided
* username and password.
*
* @param username User's username to login to Anaplan API.
* @param password User's password to login to Anaplan API.
* @param url API URL.
* @param proxyHost Proxy URL if behind firewall.
* @param proxyUser Proxy username to get past firewall.
* @param proxyPass Proxy password to get past firewall.
* @throws org.mule.api.ConnectionException Whenever the connection to
* Anaplan API fails using provided credentials.
*/
@Connect
@TestConnectivity
public synchronized void connect(
@ConnectionKey String username,
@Password String password,
@Default("https://api.anaplan.com/") String url,
@Optional @Default("") String proxyHost,
@Optional @Default("") String proxyUser,
@Optional @Password @Default("") String proxyPass)
throws org.mule.api.ConnectionException {
logger.info("Initiating basic connection...");
if (apiConn == null) {
// create the connStrategy object using credentials provided.
apiConn = new AnaplanConnection(false, username, password, url,
proxyHost, proxyUser, proxyPass);
// Establish connection using new connection object and verify
// service parameters
connectToApi();
}
}
示例5: queryAndFetch
import org.mule.api.annotations.param.Default; //导入依赖的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);
}
示例6: pageProvider
import org.mule.api.annotations.param.Default; //导入依赖的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);
}
示例7: setBlob
import org.mule.api.annotations.param.Default; //导入依赖的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();
}
示例8: importFile
import org.mule.api.annotations.param.Default; //导入依赖的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();
}
示例9: startWorkflow
import org.mule.api.annotations.param.Default; //导入依赖的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();
}
示例10: compareXml
import org.mule.api.annotations.param.Default; //导入依赖的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;
}
示例11: log
import org.mule.api.annotations.param.Default; //导入依赖的package包/类
@Processor
public Object log(MuleEvent context, @Placement(group = "Logger") @Default("") String message,
@Placement(group = "Logger") @Default("") String variables,
@Placement(group = "Logger") @Default("INFO") LogLevel level,
@Placement(group = "Logger") @Optional String loggerName) {
MuleMessage muleMessage = context.getMessage();
LogMessage logMessage = LogHelper.getBasicLogMessage(muleMessage, message);
HashSet<String> variableNames = new HashSet<String>(
Arrays.asList(variables != null ? variables.replace(" ", "").split(",") : new String[0]));
List<LogVariable> varsToBeLogged = new ArrayList<>();
LogVariable payload = new LogVariable();
if (variableNames.contains(PAYLOAD_NAME)) {
try {
payload.setName(PAYLOAD_NAME);
if (muleMessage.getPayload() != null) {
payload.setValue(muleMessage.getPayloadForLogging());
} else {
payload.setValue("NULL PAYLOAD");
}
variableNames.remove(PAYLOAD_NAME);
} catch (Exception e) {
String errorMessage = "Unable to log payload. Message: " + message + ". Exception: " + e.getMessage();
LOG.fatal(errorMessage, e);
payload.setValue(errorMessage);
}
varsToBeLogged.add(payload);
}
varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.INBOUND, variableNames,
config.getLogVariableType()));
varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.OUTBOUND, variableNames,
config.getLogVariableType()));
varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.INVOCATION, variableNames,
config.getLogVariableType()));
logMessage.setVariables(varsToBeLogged);
log(logMessage, level, StringUtils.isNotBlank(loggerName) ? loggerName : config.getDefaultLoggerName());
return context.getMessage().getPayload();
}
示例12: logAllProperties
import org.mule.api.annotations.param.Default; //导入依赖的package包/类
@Processor
public Object logAllProperties(MuleEvent context, @Placement(group = "Logger") @Default("") String message,
@Placement(group = "Logger") @Default("Invocation") LogPropertyScope scope,
@Placement(group = "Logger") @Default("INFO") LogLevel level,
@Placement(group = "Logger") @Optional String loggerName) {
MuleMessage muleMessage = context.getMessage();
LogMessage logMessage = LogHelper.getBasicLogMessage(muleMessage, message);
List<LogVariable> varsToBeLogged = new ArrayList<>();
if (scope == LogPropertyScope.Inbound || scope == LogPropertyScope.All) {
varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.INBOUND,
muleMessage.getPropertyNames(PropertyScope.INBOUND), config.getLogVariableType()));
}
if (scope == LogPropertyScope.Outbound || scope == LogPropertyScope.All) {
varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.OUTBOUND,
muleMessage.getPropertyNames(PropertyScope.OUTBOUND), config.getLogVariableType()));
}
if (scope == LogPropertyScope.Invocation || scope == LogPropertyScope.All) {
varsToBeLogged.addAll(LogHelper.extractVariables(muleMessage, PropertyScope.INVOCATION,
muleMessage.getPropertyNames(PropertyScope.INVOCATION), config.getLogVariableType()));
}
logMessage.setVariables(varsToBeLogged);
log(logMessage, level, loggerName == null ? config.getDefaultLoggerName() : loggerName);
return context.getMessage().getPayload();
}
示例13: publish
import org.mule.api.annotations.param.Default; //导入依赖的package包/类
/**
* Publishes the data on all clients connected on the publisher.
*
* {@sample.xml ../../../doc/NettyPublisher-connector.xml.sample nettypublisher:publish}
*
* @param data Content to be published
* @param publisher The publisher to publish the data on
* @throws UnsupportedDataTypeException thrown when data type to be written is not supported
*/
@Processor
public void publish(String publisher, @Default(value="#[payload]") String data) throws UnsupportedDataTypeException
{
List<NettyPublisherHandler> publishers = publisherHandlers.get(publisher).getChannelInboundHandlers();
for(NettyPublisherHandler publisherHandler : publishers)
{
publisherHandler.publish(data);
}
}
示例14: write
import org.mule.api.annotations.param.Default; //导入依赖的package包/类
/**
* To be used as a TCP client. Writes data to a TCP server
*
* {@sample.xml../../../doc/NettyPublisher-connector.xml.sample nettypublisher:write}
* @param host The host of the server
* @param port The port of the server
* @param data The data to be written
* @throws Exception Anything that goes wrong
*/
@Processor
public void write(String host, Integer port, @Default(value="#[message.payload]") String data) throws Exception
{
NettyClientHandler clientHandler = new NettyClientHandler();
NettyChannelInfo channelInfo = NettyUtils.startClient(host, port, clientHandler);
clientHandler.writeToServer(data);
clientHandler.close();
channelInfo.getWorkerGroup().shutdownGracefully();
}
示例15: copy
import org.mule.api.annotations.param.Default; //导入依赖的package包/类
/**
* Copy a Document
*
* {@sample.xml ../../../doc/Nuxeo-connector.xml.sample nuxeo:copy}
*
* @param src reference of the source document
* @param targetParent reference of the destination document
* @param docName name of the copied document
* @return a Document Object
* @throws Exception if operation can not be executed
*/
@Processor
public Document copy(@Placement(group = "operation parameters")
String src, @Placement(group = "operation parameters")
String targetParent, @Placement(group = "operation parameters")
@Optional
@Default("")
String docName) throws Exception {
if (docName == null || docName.isEmpty()) {
return docService.copy(new DocRef(src), new DocRef(targetParent));
} else {
return docService.copy(new DocRef(src), new DocRef(targetParent),
docName);
}
}