I need some help to figure out how to solve my problem.
I have a system which stores details of projects. For each project you have a start and end date and an allocation out of 100 which indicates you time on the project.
When I add a new project I need to go and check if the date range of the new project is inside the date range of any other entry for you, if it is I need to add the proposed allocation to your already stored allocations and see if that totals over 100, if so I need to flag that it totals over 100 and for what dates this occurs and present that back to the user.
I have not used the date functionality in Java and so am unsure how to start
**How much deeper would the ocean be if Sponges didn't grow in it?**
Can you share the class? Not sure how the date fields are populated and what data type. You can use getTime() in java.util.Date class. Look at Date class for more details.
Joined: Aug 15, 2004
I am using Hibernate as a middle tier and so my values are all stored in Hibernate objects. I have an object called ProjectAllocation which has your name as ResourceNm, the project name as ProjectNm, a Start Date as StartDt and an End Date as EndDt and an Allocation.
One person can have many objects for their name.
When I am adding a new entry I need to check and see if this will make the resource over allocated.
so I have a new start and End date which I wish to add and a new allocation. This is what I have so far:
So in the code I have got the objects and then pulled the start and end dates and allocation
what I need to do now is to compare the start and end input dates to the ones I have in the database and if they overlap, check if the allocation stored plus the new allocation is over 100, if so warn the user and ask if they still want to add the project, if they say yes then I want to add the record but change the color in the displaypage to red.
Ideally I would like to check week against week. I had read somewhere that I can convert a date range to week of year and then do an overlap but I have no idea how to start.