JAVA 存储选项
好的,我有一个预订对象,它存储预订活动的所有详细信息。现在,要批准一个活动,它必须由三个不同的用户查看。每次进行预订时,都应分配这三个。现在,当三人中的任何一个审核预订请求并给出响应时,必须将该用户标记为他已响应。
我需要存储以下内容,例如
User1 ----> Response & Type & ID
User2 ----> Response & Type & ID
User3 ----> Response & Type & ID
,当 user1 评论并接受时,我以这种方式访问
reservationInstance.approvers.user1.response(true);
当然只是一个示例,而不是实际代码。最好的建议是什么?可以提供代码进行澄清吗?我将致力于其定制
Ok I have a reservation object which stores all details of event for which the reservation is made. Now for an event to be approved, it has to be viewed by three different users. Each time a reservation is made, those three should be assigned. Now when the reservation request is reviewed by any of the three, and a response is given, that user has to be marked that he responded.
I need to store the following like
User1 ----> Response & Type & ID
User2 ----> Response & Type & ID
User3 ----> Response & Type & ID
So when user1 for example reviews and accepts, then i access this way
reservationInstance.approvers.user1.response(true);
just an example of course and not practical code. What would the best suggestion be? and can there be code provided for clarification? I will work on its customization
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的预订不必有一组批准者,一个就足够了。既然你提到:
预订可以有一个 Approver 属性,即“用户类型”,用于存储哪个用户审阅了此预订并给出了响应。在数据库层,这可以是用户表的外键。
如果您想找出哪个用户(1,2 或 3)查看过。只是reservationInstance.getApprover().getUserId()
(假设您的 User 类有一个 userId 属性。)
编辑
根据评论明确说明:
您有一个 Reservation 类:
您就有 User 类
如果我正确理解您的要求,
:创建预订实例时,设置了一组作为接收者的用户。这意味着,这些用户将收到预订。在你的情况下,可能有 3 个用户。您可以在这里向他们发送电子邮件、传真、短信等。
然后,假设 user2 (id=2),打开它并批准此预订。 servation.approver 将被设置为 User 对象(id=2)。此预订的状态(如果有状态要求)将更改为“已批准”或“已回复”...
我不知道您的确切要求是什么,但希望这会有所帮助。
your Reservation doesn't have to have a List/Set of approvers, one is enough. since you mentioned:
Reservation could have an Approver attribute, which would be the Type User, to store which user has reviewed this reservation and gave response. In database layer, this can be a foreign key to User table.
If you want to find out which user (1,2 or3) has viewed. just
reservationInstance.getApprover().getUserId()
(Assume your User class has a userId property.)
EDIT
to make it clear based on comments:
you have a Reservation class:
You have User class
if I understood your requirement right:
when a reservation instance was created, a set of Users as recievers were set. which means, those users will recieve the reservation. in your case, maybe 3 users. here you sent email, fax, sms whatever to them.
Then, say user2 (id=2), opened it, and approved this reservation. The reservation.approver will be set as User object(id=2). and status of this reservation (if there was a status requirement) will be changed to "Approved" or "Responsed"...
I don't know what's your exact requirement, however hope this helps.