Our state of the art Gantt chart


Post by isadogan »

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


Post by arcady »

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.

  1. 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());
  2. then to rebuild jar-file run this command in examples/msprojectimport/projectreader folder:

    mvn package
  3. Then you will need to add type field to your resource model in javascript code and it should get loaded.


Post by arcady »

FYI we're waiting for your reply here: viewtopic.php?p=123994#p123994


Post by isadogan »

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


Post by 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.

What error and which libraries?


Post by isadogan »

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
streamerror2.png (17.76 KiB) Viewed 233 times
streamerror.png
streamerror.png (97.79 KiB) Viewed 233 times

Post by arcady »

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?


Post by isadogan »

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


Post by arcady »

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.


Post Reply