Package net.sourceforge.ganttproject.resource

Examples of net.sourceforge.ganttproject.resource.HumanResource


            // GanttCalendar.parseXMLDate(attrs.getValue(i)).getTime()

            String startAsString = atts.getValue("start");
            String endAsString = atts.getValue("end");
            String resourceIdAsString = atts.getValue("resourceid");
            HumanResource hr;
            hr = (HumanResource) myResourceManager.getById(Integer
                    .parseInt(resourceIdAsString));
            hr.addDaysOff(new GanttDaysOff(GanttCalendar
                    .parseXMLDate(startAsString), GanttCalendar
                    .parseXMLDate(endAsString)));
        } catch (NumberFormatException e) {
            System.out
                    .println("ERROR in parsing XML File year is not numeric: "
View Full Code Here


        HumanResourceManager hrm = (HumanResourceManager) m_project
                .getHumanResourceManager();
        LinkedList resources = mpx.getAllResources();
        Iterator iter = resources.iterator();
        Resource resource;
        HumanResource people;

        while (iter.hasNext() == true) {
            resource = (Resource) iter.next();
            if (resource.getName() != null) {
                people = hrm.newHumanResource();
                people.setName(resource.getName());
                people.setMail(resource.getEmailAddress());
                hrm.add(people);

                m_resourceMap
                        .put(resource.getID(), new Integer(people.getId()));
            }
        }
    }
View Full Code Here

        // were loaded.
        if (load == 0) {
            load = 100;
        }

        HumanResource human = (HumanResource) getResourceManager().getById(
                resourceId);
        if (human == null) {
            throw new FileFormatException("Human resource with id="
                    + resourceId + " not found");
        }
View Full Code Here

     * Process resource data.
     */
    private void processResources() {
        try {
            List resources = myHrManager.getResources();
            HumanResource ganttResource;
            Resource mpxResource;

            for (int i = 0; i < resources.size(); i++) {
                ganttResource = (HumanResource) resources.get(i);

                mpxResource = m_mpx.addResource();
                mpxResource.setName(ganttResource.getName());
                mpxResource.setEmailAddress(ganttResource.getMail());

                m_ganttMpxResourceMap.put(new Integer(ganttResource.getId()),
                        mpxResource.getUniqueID());
            }
        }

        catch (Exception ex) {
View Full Code Here

    /** Send an Email to the current resource */
    public void sendMail(GanttProject parent) {
      if(table != null && table.getSelectedNodes()!=null && table.getSelectedNodes().length>0)
      {
        HumanResource people = (HumanResource) table.getSelectedNodes()[0]
                .getUserObject();
        if (people != null) {
          try {
            BrowserControl.displayURL("mailto:" + people.getMail());
          } catch (Exception e) {
            System.err.println(e);
          }
        }
      }
View Full Code Here

    void save(IGanttProject project, TransformerHandler handler) throws SAXException {
        AttributesImpl attrs = new AttributesImpl();
        startElement("vacations", handler);
        ProjectResource[] resources = project.getHumanResourceManager().getResourcesArray();
        for (int i = 0; i < resources.length; i++) {
            HumanResource p = (HumanResource) resources[i];
            if (p.getDaysOff() != null)
                for (int j = 0; j < p.getDaysOff().size(); j++) {
                    GanttDaysOff gdo = (GanttDaysOff) p.getDaysOff()
                            .getElementAt(j);
                    addAttribute("start", gdo.getStart().toXMLString(), attrs);
                    addAttribute("end", gdo.getFinish().toXMLString(), attrs);
                    addAttribute("resourceid", String.valueOf(p.getId()), attrs);
                    emptyElement("vacation", attrs, handler);
                }
        }
        endElement("vacations", handler);
    }
View Full Code Here

        final AttributesImpl attrs = new AttributesImpl();
        startElement("resources", handler);
        saveCustomColumnDefinitions(project, handler);
        ProjectResource[] resources = project.getHumanResourceManager().getResourcesArray();
        for (int i = 0; i < resources.length; i++) {
            HumanResource p = (HumanResource) resources[i];
            addAttribute("id", String.valueOf(p.getId()), attrs);
            addAttribute("name", p.getName(), attrs);
            addAttribute("function", p.getRole().getPersistentID(), attrs);
            addAttribute("contacts", p.getMail(), attrs);
            addAttribute("phone", p.getPhone(), attrs);
            startElement("resource", attrs, handler);
            {
              saveCustomProperties(project, p, handler);
            }
            endElement("resource", handler);
View Full Code Here

      myCustomPropertyManager.createDefinition(id, type, name, defaultValue);
  }

  /** Las a resources */
    private void loadResource(Attributes atts) {
        final HumanResource hr;

        try {
            String id = atts.getValue("id");
            if (id == null) {
                hr = getResourceManager().newHumanResource();
                hr.setName(atts.getValue("name"));
                getResourceManager().add(hr);
            } else {
                hr = (HumanResource) getResourceManager().create(
                        atts.getValue("name"), Integer.parseInt(id));
            }
            myCurrentResource = hr;
        } catch (NumberFormatException e) {
            System.out.println("ERROR in parsing XML File id is not numeric: "
                    + e.toString());
            return;
        }

        hr.setMail(atts.getValue("contacts"));
        hr.setPhone(atts.getValue("phone"));
        try {
            String roleID = atts.getValue("function");
            myLateResource2roleBinding.put(hr, roleID);
            // hr.setFunction(Integer.parseInt());
        } catch (NumberFormatException e) {
View Full Code Here

            List resources = resourceManager.getResources();

            // String
            // []function=RoleManager.Access.getInstance().getRoleNames();
            for (int i = 0; i < resources.size(); i++) {
                HumanResource p = (HumanResource) resources.get(i);
                addAttribute("id", p.getId(), attrs);
                startPrefixedElement("resource", attrs, handler);
                addAttribute("id", "0", attrs);
                textElement("name", attrs, p.getName(), handler);
                addAttribute("id", "1", attrs);
                textElement("role", attrs, p.getRole().getName(), handler);
                addAttribute("id", "2", attrs);
                textElement("mail", attrs, p.getMail(), handler);
                addAttribute("id", "3", attrs);
                textElement("phone", attrs, p.getPhone(), handler);

                List/*<CustomProperty>*/ customFields = p.getCustomProperties();
                for (int j=0; j<customFields.size(); j++) {
                  CustomProperty nextProperty = (CustomProperty) customFields.get(j);
                  addAttribute("id", nextProperty.getDefinition().getID(), attrs);
                  String value = nextProperty.getValueAsString();
                  textElement("custom-field", attrs, value, handler);
View Full Code Here

  /** write the resources. */
    private void writeResources(OutputStreamWriter out) throws IOException {
      writeResourceHeaders(out);
        // parse all resources
        for (int i = 0; i < resources.size(); i++) {
            HumanResource p = (HumanResource) resources.get(i);

            // ID
            if (csvOptions.bExportResourceID) {
                writeCell(out, "" + p.getId());
            }
            // Name
            if (csvOptions.bExportResourceName) {
                writeTextCell(out, p.getName());
            }
            // Mail
            if (csvOptions.bExportResourceMail) {
                writeTextCell(out, p.getMail());
            }
            // Phone
            if (csvOptions.bExportResourcePhone) {
                writeTextCell(out,p.getPhone());
            }
            // Role
            if (csvOptions.bExportResourceRole) {
                Role role = p.getRole();
                String sRoleID = role==null ? "0":role.getPersistentID();
                writeTextCell(out, sRoleID);
            }
            List customProps = p.getCustomProperties();
            for (int j=0; j<customProps.size(); j++) {
              CustomProperty nextProperty = (CustomProperty) customProps.get(j);
              writeTextCell(out, nextProperty.getValueAsString());
            }
            out.write("\n");
View Full Code Here

TOP

Related Classes of net.sourceforge.ganttproject.resource.HumanResource

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.