/** * Marshals the given bean into the given map. * @param bean the bean * @return the content builder * @throws StorageException when a storage problem occurs while storing a bean */ public static XContentBuilder marshall(OrganizationBean bean) throws StorageException { try (XContentBuilder builder = XContentFactory.jsonBuilder()) { preMarshall(bean); builder .startObject() .field("id", bean.getId()) .field("name", bean.getName()) .field("description", bean.getDescription()) .field("createdBy", bean.getCreatedBy()) .field("createdOn", bean.getCreatedOn().getTime()) .field("modifiedBy", bean.getModifiedBy()) .field("modifiedOn", bean.getModifiedOn().getTime()) .endObject(); postMarshall(bean); return builder; } catch (IOException e) { throw new StorageException(e); } }
/** * Marshals the given bean into the given map. * @param bean the bean * @return the content builder * @throws StorageException when a storage problem occurs while storing a bean */ public static XContentBuilder marshall(OrganizationBean bean) throws StorageException { try (XContentBuilder builder = XContentFactory.jsonBuilder()) { preMarshall(bean); builder .startObject() .field("id", bean.getId()) .field("name", bean.getName()) .field("description", bean.getDescription()) .field("createdBy", bean.getCreatedBy()) .field("createdOn", bean.getCreatedOn().getTime()) .field("modifiedBy", bean.getModifiedBy()) .field("modifiedOn", bean.getModifiedOn().getTime()) .endObject(); postMarshall(bean); return builder; } catch (IOException e) { throw new StorageException(e); } }