本文整理汇总了Java中com.wm.data.IDataUtil.getString方法的典型用法代码示例。如果您正苦于以下问题:Java IDataUtil.getString方法的具体用法?Java IDataUtil.getString怎么用?Java IDataUtil.getString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.wm.data.IDataUtil
的用法示例。
在下文中一共展示了IDataUtil.getString方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: enableInterception
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public void enableInterception(IData pipeline) {
IDataCursor pipelineCursor = pipeline.getCursor();
String resourceID = IDataUtil.getString( pipelineCursor, ENABLED );
boolean enabled;
if (resourceID == null || resourceID.length() == 0) {
enabled = AOPChainProcessor.getInstance().isEnabled();
} else {
enabled = Boolean.valueOf(resourceID);
AOPChainProcessor.getInstance().setEnabled(enabled);
}
// pipeline
IDataUtil.put( pipelineCursor, ENABLED, Boolean.toString(enabled) );
pipelineCursor.destroy();
}
示例2: getRemit
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public Remit getRemit(IData pipeline) throws ServiceException {
IDataCursor pipelineCursor = pipeline.getCursor();
String requiredScope = IDataUtil.getString(pipelineCursor, SCOPE);
if (requiredScope == null) {
return new UserRemit();
}
Remit remit;
switch (Scope.valueOf(requiredScope.toUpperCase())) {
case GLOBAL:
remit = new GlobalRemit();
break;
case SESSION:
remit = new SessionRemit();
break;
case USER:
String username = IDataUtil.getString(pipelineCursor, USERNAME);
remit = (username == null || username.length() == 0) ? new UserRemit() : new UserRemit(username);
break;
default:
throw new ServiceException("Inapplicable scope: " + requiredScope);
}
return remit;
}
示例3: registerException
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public void registerException(IData pipeline) throws ServiceException {
IDataCursor pipelineCursor = pipeline.getCursor();
String adviceId = IDataUtil.getString(pipelineCursor, ADVICE_ID);
String interceptPoint = IDataUtil.getString(pipelineCursor, INTERCEPT_POINT);
String serviceName = IDataUtil.getString(pipelineCursor, SERVICE_NAME);
String pipelineCondition = IDataUtil.getString(pipelineCursor, CONDITION);
String exception = IDataUtil.getString(pipelineCursor, EXCEPTION);
String calledBy = IDataUtil.getString(pipelineCursor, CALLED_BY);
pipelineCursor.destroy();
mandatory(pipeline, "{0} must exist when creating an assertion", ADVICE_ID, INTERCEPT_POINT, SERVICE_NAME, EXCEPTION);
try {
registerInterceptor(adviceId, getRemit(pipeline), interceptPoint, serviceName, pipelineCondition, new ExceptionInterceptor(exception, "WMAOP " + serviceName), calledBy);
} catch (InstantiationException | IllegalAccessException | ClassNotFoundException | IllegalArgumentException | SecurityException e) {
throw new ServiceException(e);
}
}
示例4: convertToObject
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
@Override
public Address convertToObject(final IData iData)
{
final Address a = new Address();
final IDataCursor addressCursor = iData.getCursor();
final String shortCity = IDataUtil.getString(addressCursor, "ShortCity");
final String shortStreet = IDataUtil.getString(addressCursor, "ShortStreet");
addressCursor.destroy();
a.setStreet(shortStreet);
final Pattern p = Pattern.compile("(.+)-([0-9]+) (.*)");
final Matcher m = p.matcher(shortCity);
if (m.matches())
{
a.country = Country.valueOf(m.group(1));
a.ZipCode = m.group(2);
a.setCity(m.group(3));
}
return a;
}
示例5: convertToObject
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
@Override
public AnnotatedAddress convertToObject(final IData iData)
{
final AnnotatedAddress a = new AnnotatedAddress();
final IDataCursor addressCursor = iData.getCursor();
final String shortCity = IDataUtil.getString(addressCursor, "ShortCity");
final String shortStreet = IDataUtil.getString(addressCursor, "ShortStreet");
addressCursor.destroy();
a.setStreet(shortStreet);
final Pattern p = Pattern.compile("(.+)-([0-9]+) (.*)");
final Matcher m = p.matcher(shortCity);
if (m.matches())
{
a.country = Country.valueOf(m.group(1));
a.ZipCode = m.group(2);
a.setCity(m.group(3));
}
return a;
}
示例6: amend
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
* Amends the given IData document with the key value pairs specified in the amendments IData document.
*
* @param document The IData document to be amended.
* @param amendments The list of key value pairs to amend the document with.
* @param scope The scope against which to resolve variable substitution statements.
* @return The amended IData document.
* @throws ServiceException If an error occurs.
*/
public static IData amend(IData document, IData[] amendments, IData scope) throws ServiceException {
if (amendments == null || amendments.length == 0) return document;
IData output = duplicate(document);
for (int i = 0; i < amendments.length; i++) {
if (amendments[i] != null) {
IDataCursor cursor = amendments[i].getCursor();
String key = IDataUtil.getString(cursor, "key");
String value = IDataUtil.getString(cursor, "value");
String condition = IDataUtil.getString(cursor, "condition");
cursor.destroy();
key = SubstitutionHelper.substitute(key, scope);
value = SubstitutionHelper.substitute(value, scope);
if ((condition == null) || ConditionEvaluator.evaluate(condition, scope)) {
output = IDataHelper.put(output, key, value);
}
}
}
return output;
}
示例7: normalize
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
* Returns a GuaranteedJob, if given either a subset or full GuaranteedJob as an IData document.
*
* @param input An IData document which could be a GuaranteedJob, or could be a subset of a
* GuaranteedJob that includes an TaskId key.
* @return The GuaranteedJob associated with the given IData document.
*/
public static GuaranteedJob normalize(IData input) {
if (input == null) return null;
GuaranteedJob job = null;
if (input instanceof GuaranteedJob) {
job = (GuaranteedJob)input;
} else {
IDataCursor cursor = input.getCursor();
String id = IDataUtil.getString(cursor, "TaskId");
cursor.destroy();
if (id == null) throw new IllegalArgumentException("TaskId is required");
job = get(id);
}
return job;
}
示例8: normalize
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
* Returns the given IData if its already a BizDocType, otherwise converts it to a BizDocType object.
*
* @param input The IData object to be converted to a BizDocType object.
* @return The BizDocType object that represents the given IData object.
*/
public static BizDocType normalize(IData input) {
if (input == null) return null;
BizDocType output = null;
if (input instanceof BizDocType) {
output = (BizDocType)input;
} else {
IDataCursor cursor = input.getCursor();
String id = IDataUtil.getString(cursor, "TypeID");
cursor.destroy();
if (id == null) throw new IllegalArgumentException("TypeID is required");
output = get(id);
}
return output;
}
示例9: toIData
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
/**
* Converts the given destination to an IData representation.
*
* @param destination The destination to be converted.
* @return The IData representation of the given destination.
*/
public static IData toIData(Destination destination) {
if (destination == null ) return null;
// take a copy of the destination so we can fix some field values for backwards-compatibility
IData output = IDataFactory.create();
IDataUtil.append(destination, output);
IDataCursor cursor = output.getCursor();
// fix protocol to be an actual protocol rather than the destination name for custom destinations
String protocol = IDataUtil.getString(cursor, "B2BService");
if (protocol != null) {
IDataUtil.put(cursor, "Protocol", protocol);
}
// add name to the destination structure
IDataUtil.put(cursor, "DestinationName", getName(destination));
// add whether destination is the primary destination as a boolean string
IDataUtil.put(cursor, "IsPrimary", BooleanHelper.emit(destination.isPrimary()));
cursor.destroy();
return output;
}
示例10: getPackagePath
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public static final void getPackagePath (IData pipeline)
throws ServiceException
{
// --- <<IS-START(getPackagePath)>> ---
// @specification pgp.specifications:getPackagePathSpec
// @subtype unknown
// @sigtype java 3.5
// Handle input params
IDataCursor pc = pipeline.getCursor();
String packageName = IDataUtil.getString(pc, "package");
String subdir = IDataUtil.getString(pc, "subDir");
String filename = IDataUtil.getString(pc, "fileName");
if (packageName == null) {
packageName = Service.getServiceEntry().getPackage().getName();
}
String packageDir = Server.getResources().getPackageDir(packageName)
.getAbsolutePath().concat(File.separator);
if (new File(packageDir).exists()) {
if (subdir != null) {
packageDir = packageDir.concat(subdir).concat(File.separator);
}
if (filename != null) {
packageDir = packageDir.concat(filename);
}
IDataUtil.put(pc, "path", packageDir);
}
pc.destroy();
// --- <<IS-END>> ---
}
示例11: getSupportedEncodings
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public static final void getSupportedEncodings (IData pipeline)
throws ServiceException
{
// --- <<IS-START(getSupportedEncodings)>> ---
// @specification pgp.specifications:getSupportedEncodingsSpec
// @subtype unknown
// @sigtype java 3.5
// Get input
IDataCursor pc = pipeline.getCursor();
String encoding = IDataUtil.getString(pc, "encoding");
// Validate input
if (encoding != null && !encoding.equals("")) {
IDataUtil.put(pc, "isSupported", String.valueOf(Charset.isSupported(encoding)));
}
// Get supported encodings
IDataUtil.put(pc, "encodings",
Charset.availableCharsets().keySet().toArray(new String[0]));
IDataUtil.put(pc, "default", Charset.defaultCharset().name());
pc.destroy();
// --- <<IS-END>> ---
}
示例12: reset
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public void reset(IData pipeline) throws ServiceException {
IDataCursor pipelineCursor = pipeline.getCursor();
String scope = IDataUtil.getString( pipelineCursor, SCOPE );
pipelineCursor.destroy();
try {
Scope applicableScope = scope == null ? null : Scope.valueOf(scope.toUpperCase());
AOPChainProcessor.getInstance().reset(applicableScope);
} catch (IllegalArgumentException e) {
throw new ServiceException("Unknown scope ["+scope+']');
}
}
示例13: getAdvice
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public void getAdvice(IData pipeline) {
IDataCursor pipelineCursor = pipeline.getCursor();
String adviceId = IDataUtil.getString( pipelineCursor, ADVICE_ID );
AdviceManager adviceMgr = AOPChainProcessor.getInstance().getAdviceManager();
Map<String, ?> adviceMap;
if (adviceId == null || adviceId.length() == 0) {
adviceMap = adviceToMap(adviceMgr.listAdvice().toArray(new Advice[0]));
} else {
adviceMap = adviceToMap(adviceMgr.getAdvice(adviceId));
}
IDataUtil.put(pipelineCursor, "advice", new StructureConverter().toIData(adviceMap));
pipelineCursor.destroy();
}
示例14: removeAdvice
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
public void removeAdvice(IData pipeline) {
IDataCursor pipelineCursor = pipeline.getCursor();
String id = IDataUtil.getString( pipelineCursor, ADVICE_ID);
pipelineCursor.destroy();
AOPChainProcessor.getInstance().getAdviceManager().unregisterAdvice(id);
}
示例15: registerFixedResponseMock
import com.wm.data.IDataUtil; //导入方法依赖的package包/类
@SuppressWarnings("unchecked")
public void registerFixedResponseMock(IData pipeline) throws ServiceException {
IDataCursor pipelineCursor = pipeline.getCursor();
String adviceId = IDataUtil.getString(pipelineCursor, ADVICE_ID);
String interceptPoint = IDataUtil.getString(pipelineCursor, INTERCEPT_POINT);
String serviceName = IDataUtil.getString(pipelineCursor, SERVICE_NAME);
Object idata = IDataUtil.get(pipelineCursor, RESPONSE);
String pipelineCondition = IDataUtil.getString(pipelineCursor, CONDITION);
String calledBy = IDataUtil.getString(pipelineCursor, CALLED_BY);
pipelineCursor.destroy();
mandatory(pipeline, "{0} must exist when creating a fixed response mock", ADVICE_ID, INTERCEPT_POINT, SERVICE_NAME, RESPONSE);
Interceptor interceptor;
try {
if (idata instanceof IData) {
interceptor = new CannedResponseInterceptor((IData)idata);
} else if (idata instanceof List){
interceptor = new CannedResponseInterceptor(ResponseSequence.SEQUENTIAL, (List<String>)idata);
} else {
interceptor = new CannedResponseInterceptor(idata.toString());
}
} catch (Exception e) { // Catch ICoder exceptions
throw new ServiceException("Unable to parse response IData for " + adviceId + " - Is the response valid IData XML? - " + e.getMessage());
}
registerInterceptor(adviceId, getRemit(pipeline), interceptPoint.toUpperCase(), serviceName, pipelineCondition, interceptor, calledBy);
}