本文整理汇总了Java中org.biokoframework.utils.fields.Fields.put方法的典型用法代码示例。如果您正苦于以下问题:Java Fields.put方法的具体用法?Java Fields.put怎么用?Java Fields.put使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.biokoframework.utils.fields.Fields
的用法示例。
在下文中一共展示了Fields.put方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: twoWorkingCommands
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Test
public void twoWorkingCommands() throws BiokoException {
EntityBuilder<Login> login = new LoginBuilder().loadDefaultExample();
login.setId("1");
Fields input = new Fields();
input.put(FieldNames.COMMAND_NAME, "POST_login");
input.putAll(login.build(false).fields());
Fields output = _system.execute(input);
Fields input2 = new Fields();
input2.put(FieldNames.COMMAND_NAME, "GET_login");
input2.put(GenericFieldNames.USER_EMAIL, "matto");
input2.put(GenericFieldNames.PASSWORD, "fatto");
output = _system.execute(input2);
assertEquals("[" + login.build(true).toJSONString() + "]",
JSONValue.toJSONString(output.get(GenericFieldNames.RESPONSE)));
}
示例2: execute
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
logInput(input);
String loginId = input.get(GenericFieldNames.AUTH_LOGIN_ID);
if (loginId == null)
loginId = "";
Fields output = new Fields();
output.put("value", loginId);
Fields result = new Fields(GenericFieldNames.RESPONSE, output);
logOutput(result);
return result;
}
示例3: extractQueryString
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
private Fields extractQueryString(HttpServletRequest request) {
Fields queryStringFields = new Fields();
String queryString = request.getQueryString();
if (queryString != null) {
try {
for (String aQuery : queryString.split("&")) {
String[] splittedQuery = aQuery.split("=");
queryStringFields.put(URLDecoder.decode(splittedQuery[0], "utf8"), URLDecoder.decode(splittedQuery[1], "utf8"));
}
request.getQueryString();
} catch (UnsupportedEncodingException exception) {
LOGGER.error("Unsupported encoding", exception);
}
}
return queryStringFields;
}
示例4: execute
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
LOGGER.info("EXECUTING Command:" + this.getClass().getSimpleName());
Fields result = new Fields();
// Meta linguaggio? Il comando descrive il command handler con lo stesso meccanismo con cui
// descriverebbe qualunque altra cosa
ArrayList<DomainEntity> response = new ArrayList<DomainEntity>();
for (String aCommandName : _commandHandler.keys()) {
CommandEntity commandEntity = new CommandEntity();
commandEntity.set(CommandEntity.NAME, aCommandName);
response.add(commandEntity);
}
result.put(GenericFieldNames.RESPONSE, response);
result.putAll(input);
LOGGER.info("END Command:" + this.getClass().getSimpleName());
return result;
}
示例5: matches
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public boolean matches(IRoute route) {
if (fMethod.equals(route.getMethod())) {
Matcher matcher = fRoutePattern.matcher(route.getPath());
if (matcher.matches()) {
Fields parameters = new Fields();
int i = 1;
for (String aParameterName : fParameterNames) {
String paramValue = matcher.group(i);
if (!paramValue.isEmpty()) {
parameters.put(aParameterName, paramValue);
}
i++;
}
route.matchedParameters(parameters);
return true;
}
}
return false;
}
示例6: retrieveEntities
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
public static <DE extends DomainEntity> ArrayList<DE> retrieveEntities(ResultSet result, Class<DE> entityClass, SqlTypesTranslator translator, IEntityBuilderService entityBuilder) throws SQLException {
ArrayList<DE> entities = new ArrayList<DE>();
Set<Entry<String, Field>> fields = new HashSet<Map.Entry<String,Field>>();
try {
fields = ComponingFieldsFactory.createWithAnnotation(entityClass).entrySet();
} catch (Exception exception) {
// THIS SHOULD NEVER HAPPEN
LOGGER.error("retrieving fields:", exception);
exception.printStackTrace();
}
while (!result.isClosed() && result.next()) {
Fields entityFields = new Fields();
for (Entry<String, Field> aFieldEntry : fields) {
String fieldName = aFieldEntry.getKey();
entityFields.put(fieldName, translator.convertFromDBValue(fieldName, result, aFieldEntry.getValue()));
}
entityFields.put(DomainEntity.ID, translator.convertFromDBValue(DomainEntity.ID, result, null));
entities.add(entityBuilder.getInstance(entityClass, entityFields));
}
return entities;
}
示例7: execute
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
logInput(input);
Fields result = new Fields();
BinaryEntityRepository blobRepo = getRepository(BinaryEntity.class);
ArrayList<BinaryEntity> response = new ArrayList<BinaryEntity>();
String blobId = input.get(DomainEntity.ID);
if (blobId == null || blobId.isEmpty()) {
throw CommandExceptionsFactory.createExpectedFieldNotFound(DomainEntity.ID);
}
BinaryEntity blob = blobRepo.retrieveWithoutFile(blobId);
if (blob == null) {
throw CommandExceptionsFactory.createEntityNotFound(BinaryEntity.class, blobId);
}
response.add(blob);
String mediaType = blob.get(BinaryEntity.MEDIA_TYPE);
result.put(GenericFieldNames.RESPONSE_CONTENT_TYPE, MediaType.parse(mediaType));
result.put(GenericFieldNames.RESPONSE, response);
logOutput(result);
return result;
}
示例8: execute
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException, ValidationException {
logInput(input);
Fields result = new Fields();
BinaryEntityRepository blobRepo = getRepository(BinaryEntity.class);
ArrayList<BinaryEntity> response = new ArrayList<BinaryEntity>();
String blobFieldName = "";
if (input.keys().size() != 1) {
throw CommandExceptionsFactory.createBadCommandInvocationException();
} else {
blobFieldName = input.keys().get(0);
}
BinaryEntity blob = input.get(blobFieldName);
if (!blob.isValid()) {
throw CommandExceptionsFactory.createNotCompleteEntity(blob.getClass().getSimpleName());
}
try {
blob = blobRepo.save(blob);
} catch (RepositoryException e) {
LOGGER.error("Saving blob", e);
throw CommandExceptionsFactory.createBadCommandInvocationException();
}
response.add(blob);
result.put(GenericFieldNames.RESPONSE, response);
logOutput(result);
return result;
}
示例9: getTriangoloShape
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
private static DummyEntity1 getTriangoloShape() {
Fields input = new Fields();
input.put(DomainEntity.ID,"2");
input.put(DummyEntity1.VALUE,"triangolo");
DummyEntity1 entity = new DummyEntity1();
entity.setAll(input);
return entity;
}
示例10: execute
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
Fields result = new Fields();
ArrayList<DomainEntity> responsEntities = new ArrayList<DomainEntity>();
responsEntities.add(Dummy1Mock.getShape());
result.put(GenericFieldNames.RESPONSE, responsEntities );
return result;
}
示例11: parse
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields parse(Part part, String charset) {
Fields parsed = new Fields();
try {
String value = IOUtils.toString(part.getInputStream(), charset);
parsed.put(part.getName(), convertToNumberIfPossibile(value));
} catch (IOException exception) {
LOGGER.error("Parsing part " + part.getName(), exception);
}
return parsed;
}
示例12: parse
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields parse(Part part, String charset) {
Fields parsed = new Fields();
try {
BinaryEntity entity = prepareEntityStub(part.getContentType(), part.getSize());
entity.setStream(part.getInputStream());
parsed.put(part.getName(), entity);
} catch (IOException exception) {
LOGGER.error("Accessing stream of request content part (" + part.getName() + "," + part.getContentType() + ")", exception);
}
return parsed;
}
示例13: execute
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException, ValidationException {
Fields overAllOutput = Fields.successful();
LOGGER.info("Executing MultipleCommand: " + this.getClass().getSimpleName());
LOGGER.info("Steps: " + _steps.size());
for (Entry<String,AbstractCommand> step : _steps.entrySet()) {
Fields output = new Fields();
LOGGER.info("Executing step: " + step.getKey());
output = step.getValue().execute(input);
if (output.containsKey(FieldsErrors.FAILURE)) {
output.put(FieldNames.FAILED_COMMAND, step.getValue().getClass().getSimpleName());
LOGGER.info("Step " + step.getKey() + " execution failed!");
return overAllOutput.putAll(Fields.failed()).putAll(output);
} else if (output.containsKey(FieldsErrors.ERROR)) {
output.put(FieldNames.ERROR_COMMAND, step.getValue().getClass().getSimpleName());
LOGGER.info("Step " + step.getKey() + " execution error!");
return overAllOutput.putAll(Fields.failed()).putAll(output);
}
overAllOutput.putAll(output);
input.putAll(output);
}
LOGGER.info("MultipleCommand output: " + overAllOutput.toString());
LOGGER.info("End MultipleCommand: " + this.getClass().getSimpleName());
return overAllOutput;
}
示例14: sendPush
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public void sendPush(String userToken, String message) throws NotificationFailureException {
Fields sendMailInputFields = new Fields();
sendMailInputFields.put(IPushNotificationService.USER_TOKEN, userToken);
sendMailInputFields.put(GenericFieldNames.CONTENT, message);
sendMailInputFields.put(IPushNotificationService.PRODUCTION, fProduction);
fPushQueueService.pushFields(PUSH_QUEUE, sendMailInputFields);
}
示例15: sendBroadcastPush
import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public void sendBroadcastPush(String message) throws NotificationFailureException {
Fields sendMailInputFields = new Fields();
sendMailInputFields.put(GenericFieldNames.CONTENT, message);
sendMailInputFields.put(IPushNotificationService.PRODUCTION, fProduction);
fPushQueueService.pushFields(PUSH_QUEUE, sendMailInputFields);
}