Our state of the art Gantt chart
Hi,
While importing the .msp file to the Gantt Chart, the Java application returns only the resource's name.
As you know, we can pick a resource type while adding a resource to the task in MS Project.
These are work, cost, and material.
So how can I get the resource type included result?
Thanks,
Sefa DOĞAN
The Gantt resource model doesn't support resource types so Java code does not extract it.
You can change the code and rebuild jar-file.
Edit examples/msprojectimport/projectreader/src/main/java/bryntum/gantt/projectreader/ResourcesJSONBuilder.java
file
You need to change this method:
public JSONObject getResourceJSON(Resource resource) {
JSONObject result = new JSONObject();
result.put(idField, resource.getUniqueID());
result.put(nameField, (resource.getName() != null ? resource.getName() : "New resource"));
result.put(calendarIdField, resource.getBaseCalendar());
return result;
}
add a line like this to add type
property to JSON representing a resource
result.put("type", resource.getType());
then to rebuild jar-file run this command in examples/msprojectimport/projectreader
folder:
Then you will need to add type
field to your resource model in javascript code and it should get loaded.
Hi arcady,
I'm facing some issues after rebuilding the .jar file. When I run the application, it throws an error which is about can't call some libraries.
Any chance to share the updated .jar file with me?
I'll reply to it.
Thanks
I'm facing some issues after rebuilding the .jar file. When I run the application, it throws an error which is about can't call some libraries.
What error and which libraries?
arcady wrote: ↑ Mon May 22, 2023 8:33 am
I'm facing some issues after rebuilding the .jar file. When I run the application, it throws an error which is about can't call some libraries.
What error and which libraries?
It throws at line 28. I've attached the results.
Attachments
streamerror2.png (17.76 KiB) Viewed 252 times
streamerror.png (97.79 KiB) Viewed 252 times
It doesn't say anything about missing libraries. It looks like you don't have examples/msprojectimport/projectreader/src/main/resources/META-INF/projectreader.default.properties
file. Did you remove it?
Sorry, it's been a very long time. I recognized the error is about missing libraries.
I didn't remove the file. You can see it as marked in the screenshot
Well I judge based on the info you gave:
The provided screenshot displays NullPointerException
exception inStream parameter is null
when calling Java.util.Properties.load()
its input argument is null
while it's expected to be an InputStream
. It looks it could not load parameters from one of *.properties
file.
If you recognized some other reason just fix it. This is an example code you are free to adjust it to your needs.