当前位置: 首页>>代码示例>>Java>>正文


Java Fields.get方法代码示例

本文整理汇总了Java中org.biokoframework.utils.fields.Fields.get方法的典型用法代码示例。如果您正苦于以下问题:Java Fields.get方法的具体用法?Java Fields.get怎么用?Java Fields.get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.biokoframework.utils.fields.Fields的用法示例。


在下文中一共展示了Fields.get方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: 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;
}
 
开发者ID:bioko,项目名称:system,代码行数:27,代码来源:HeadBinaryEntityCommand.java

示例2: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
	logInput(input);

	// save text mandatory field into dummy1 entity repo
	Repository<DummyEntity1> dummy1Repo = getRepository(DummyEntity1.class);
	DummyEntity1 dummy1 = new DummyEntity1();
	dummy1.set(DummyEntity1.VALUE, input.get(TEXT_MANDATORY_FIELD));
	dummy1 = SafeRepositoryHelper.save(dummy1Repo, dummy1);

	// save integer optional field into dummy2
	Long integerFieldValue = input.get(INTEGER_OPTIONAL_FIELD); 
	if (integerFieldValue != null) {
		Repository<DummyEntity2> dummy2Repo = getRepository(DummyEntity2.class);
		DummyEntity2 dummy2 = new DummyEntity2();
		dummy2.set(DummyEntity2.VALUE, input.get(INTEGER_OPTIONAL_FIELD));
		dummy2.set(DummyEntity2.ENTITY1_ID, dummy1.getId());
		dummy2 = SafeRepositoryHelper.save(dummy2Repo, dummy2);
	}

	logOutput();
	return new Fields(GenericFieldNames.RESPONSE, new ArrayList<DomainEntity>());
}
 
开发者ID:bioko,项目名称:system-a,代码行数:24,代码来源:ValidatedCommand.java

示例3: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
	logInput(input);
	
	Repository<BinaryEntity> blobRepo = getRepository(BinaryEntity.class);
	Repository<DummyMultipart> dummyMPRepo = getRepository(DummyMultipart.class);
	
	BinaryEntity firstFile = input.get(FIRST_FILE_PART_NAME);
	BinaryEntity secondFile = input.get(SECOND_FILE_PART_NAME);
	
	DummyMultipart dummy = new DummyMultipart();
	dummy.setAll(input);
	
	// save blobs int its repo
	SafeRepositoryHelper.save(blobRepo, firstFile);
	SafeRepositoryHelper.save(blobRepo, secondFile);
	
	dummy.set(DummyMultipart.FIRST_FILE_ID, firstFile.getId());
	dummy.set(DummyMultipart.SECOND_FILE_ID, secondFile.getId());
	
	SafeRepositoryHelper.save(dummyMPRepo, dummy);
	
	logOutput();
	return new Fields(GenericFieldNames.RESPONSE, Arrays.asList(dummy));
}
 
开发者ID:bioko,项目名称:system-a,代码行数:26,代码来源:MultipartCommand.java

示例4: 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;
}
 
开发者ID:bioko,项目名称:system-a,代码行数:18,代码来源:PrintLoginIdCommand.java

示例5: 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.delete(blobId);
	if (blob == null) {
		throw CommandExceptionsFactory.createEntityNotFound(BinaryEntity.class, blobId);
	}
	
	result.put(GenericFieldNames.RESPONSE, response);
	logOutput(result);
	return result;
}
 
开发者ID:bioko,项目名称:system,代码行数:24,代码来源:DeleteBinaryEntityCommand.java

示例6: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException, ValidationException {
	logInput(input);

       String token = input.get("token");
       String newPassword = input.get("password");

       try {
           fPasswordResetService.performPasswordReset(token, newPassword);
       } catch (RepositoryException exception) {
           throw CommandExceptionsFactory.createContainerException(exception);
       }

       logOutput();
	return new Fields(GenericFieldNames.RESPONSE, new ArrayList<DomainEntity>());
}
 
开发者ID:bioko,项目名称:system,代码行数:17,代码来源:ApplyPasswordResetCommand.java

示例7: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
	logInput(input);

	Fields pushFields;
	while((pushFields = fPushQueueService.popFields(PUSH_QUEUE)) != null) {
		String userToken = pushFields.get(IPushNotificationService.USER_TOKEN);
		String content = pushFields.get(GenericFieldNames.CONTENT);
		Boolean production = pushFields.get(IPushNotificationService.PRODUCTION);

		try {
			if (StringUtils.isEmpty(userToken)) {
				sendBroadcastPush(content, production);
			} else {
				sendPush(userToken, content, production);
			}
		} catch (NotificationFailureException exception) {
			LOGGER.error("Pushing", exception);
		}
		
	}
		
	logOutput();
	return new Fields();
}
 
开发者ID:bioko,项目名称:system,代码行数:26,代码来源:SendPushCommand.java

示例8: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
	logInput(input);

	String userEmail = input.get(Login.USER_EMAIL);
	String token = input.get(EmailConfirmation.TOKEN);

       Repository<Login> loginRepo = getRepository(Login.class);
       Login login = loginRepo.retrieveByForeignKey(Login.USER_EMAIL, userEmail);
       if (login == null) {
           throw CommandExceptionsFactory.createEntityNotFound(Login.class, Login.USER_EMAIL,userEmail);
       }

       try {
           fConfirmationService.confirmEmailAddress(login.getId(), token);
       } catch (EmailException exception) {
           throw CommandExceptionsFactory.createContainerException(exception);
       }

	logOutput();
	return new Fields(GenericFieldNames.RESPONSE, new ArrayList<DomainEntity>());
}
 
开发者ID:bioko,项目名称:system,代码行数:23,代码来源:ResponseEmailConfirmationCommand.java

示例9: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
public Fields execute(Fields input) throws BiokoException {
		Fields output = new Fields();
		String commandName = input.get(FieldNames.COMMAND_NAME);
//		try {
		fLogger.info("----- Executing Command: " + commandName + " -----");
		fLogger.info("Command input: " + input.toString());
			
//		} catch (BiokoException systemException) {
//			fLogger.error("System exception", systemException);
//			throw systemException;
//		} catch (Exception exception) {
//			fLogger.error("Generic exception", exception);
//			throw new CommandException(exception);
//		}
		fLogger.info("Command output: " + output.toString());
		fLogger.info("----- Command execution finished -----");
		return output;
	}
 
开发者ID:bioko,项目名称:system,代码行数:19,代码来源:XSystem.java

示例10: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
	logInput(input);
	Repository<? extends DomainEntity> repository = getRepository(fDomainEntityClass);

	List<DomainEntity> entities = new ArrayList<>();
	
	String id = input.get(DomainEntity.ID);
	if (StringUtils.isEmpty(id)) {
		entities.addAll(repository.getAll());
	} else {
		DomainEntity entity = repository.retrieve(id);
		if (entity == null) {
			throw CommandExceptionsFactory.createEntityNotFound(fDomainEntityClass, id);
		}
		entities.add(entity);
	}
	
	Fields output = new Fields(GenericFieldNames.RESPONSE, entities);
	logOutput(output);
	return output;
}
 
开发者ID:bioko,项目名称:system,代码行数:23,代码来源:RetrieveEntityCommand.java

示例11: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
	logInput(input);
	Repository<? extends DomainEntity> repository = getRepository(fDomainEntityClass);
	
	String id = input.get(DomainEntity.ID);
	if (StringUtils.isEmpty(id)) {
		throw CommandExceptionsFactory.createExpectedFieldNotFound(DomainEntity.ID);
	}
	
	ArrayList<DomainEntity> response = new ArrayList<>();
	
	DomainEntity entity = repository.delete(id);
	if (entity == null) {
		throw CommandExceptionsFactory.createEntityNotFound(fDomainEntityClass, id);
	}
	response.add(entity);
	
	Fields output = new Fields(
			GenericFieldNames.RESPONSE, response);
	logOutput(output);
	return output;
}
 
开发者ID:bioko,项目名称:system,代码行数:24,代码来源:DeleteEntityCommand.java

示例12: execute

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
public Fields execute(Fields input) throws CommandException {
	logInput(input);

       String userEmail = input.get(Login.USER_EMAIL);
       Login login = getRepository(Login.class).retrieveByForeignKey(Login.USER_EMAIL, userEmail);
       if (login == null) {
           throw CommandExceptionsFactory.createEntityNotFound(Login.class, Login.USER_EMAIL, userEmail);
       }

       Template template = createEntity(Template.class, new Fields(
               Template.TITLE, EMAIL_CONFIRMATION_SUBJECT,
               Template.BODY, "<html>\n" +
                                   "<body>\n" +
                                       "Clicca sul link riportato sotto per confermare la tua mail\n" +
                                       "<a href=\"${url}?token=${token}&userEmail=${userEmail}\">Conferma email</a>\n" +
                                   "<body>\n" +
                               "</html>"));

       Map<String, Object> content = new HashMap<>();
       content.put("url", "http://www.example.net/confirm-email");
       content.put("userEmail", login.get(Login.USER_EMAIL));


       try {
           fConfirmationService.sendConfirmationEmail(login, template, content);
	} catch (EmailException|TemplatingException exception) {
		throw CommandExceptionsFactory.createContainerException(exception);
	}
	
	logOutput();
	return new Fields(GenericFieldNames.RESPONSE, new ArrayList<DomainEntity>());
}
 
开发者ID:bioko,项目名称:system-a,代码行数:34,代码来源:RequestEmailConfirmationCommand.java

示例13: build

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
@Override
  public void build(HttpServletResponse response, Fields output) throws IOException, RequestNotSupportedException {
      response.setContentType(MediaType.JSON_UTF_8.toString());

      Object responseContent = output.get(GenericFieldNames.RESPONSE);

      Writer writer = response.getWriter();
IOUtils.write(JSONValue.toJSONString(responseContent), writer);
  }
 
开发者ID:bioko,项目名称:http-exposer,代码行数:10,代码来源:JsonResponseBuilderImpl.java

示例14: findBuilderForForcedContentType

import org.biokoframework.utils.fields.Fields; //导入方法依赖的package包/类
private IResponseContentBuilder findBuilderForForcedContentType(Fields output) {
    MediaType mediaType = output.get(GenericFieldNames.RESPONSE_CONTENT_TYPE);
    if (mediaType != null) {
        return findBuilderForMediaType(mediaType);
    }
    return null;
}
 
开发者ID:bioko,项目名称:http-exposer,代码行数:8,代码来源:HttpResponseBuilderImpl.java

示例15: 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;
}
 
开发者ID:bioko,项目名称:system,代码行数:35,代码来源:PostBinaryEntityCommand.java


注:本文中的org.biokoframework.utils.fields.Fields.get方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。