### Get Assignment Cost Information Source: https://context7.com/erdincay/projectlibre/llms.txt Retrieves cost-related information for an assignment, including the total cost, actual cost incurred, and remaining cost. This helps in budget tracking and financial analysis of tasks. ```java import com.projity.pm.assignment.Assignment; // Get cost information double cost = assignment.getCost(); double actualCost = assignment.getActualCost(); double remainingCost = assignment.getRemainingCost(); ``` -------------------------------- ### Retrieve Assignment Properties Source: https://context7.com/erdincay/projectlibre/llms.txt Accesses various properties of an assignment, including units, work duration, actual work performed, remaining work, start and end times, and completion percentage. Use these to monitor task progress and resource allocation. ```java import com.projity.pm.assignment.Assignment; // Get assignment properties double units = assignment.getUnits(); // Resource units (0.0-n) long work = assignment.getWork(); // Total work in milliseconds long actualWork = assignment.getActualWork(); // Completed work long remainingWork = assignment.getRemainingWork(); long start = assignment.getStart(); long finish = assignment.getEnd(); double percentComplete = assignment.getPercentComplete(); ``` -------------------------------- ### Create and Initialize a Project in Java Source: https://context7.com/erdincay/projectlibre/llms.txt Demonstrates creating a new project, setting its properties, initializing the critical path algorithm, and creating initial tasks. Ensure necessary imports are present. ```java import com.projity.pm.task.Project; import com.projity.pm.task.NormalTask; import com.projity.pm.resource.ResourcePool; import com.projity.pm.criticalpath.CriticalPath; import com.projity.undo.DataFactoryUndoController; // Create a new project with a resource pool ResourcePool resourcePool = new ResourcePool(); DataFactoryUndoController undoController = new DataFactoryUndoController(); Project project = Project.createProject(resourcePool, undoController); // Set project properties project.setName("Software Development Project"); project.setManager("John Smith"); project.setStart(System.currentTimeMillis()); // Set project start date // Initialize the scheduling algorithm (Critical Path) project.setSchedulingAlgorithm(new CriticalPath(project)); project.initializeProject(); // Create a new task within the project NormalTask task = project.newNormalTaskInstance(); task.setName("Design Phase"); task.setDuration(Duration.getInstance(5, TimeUnit.DAYS)); // 5-day duration // Create a scripted task (programmatically added) NormalTask scriptedTask = project.createScriptedTask(); scriptedTask.setName("Implementation Phase"); // Run critical path calculation project.recalculate(); // Access project dates long projectStart = project.getStart(); long projectEnd = project.getEnd(); long projectDuration = project.getDuration(); ``` -------------------------------- ### Building and Running ProjectLibre with Ant Source: https://context7.com/erdincay/projectlibre/llms.txt Instructions for building ProjectLibre using Apache Ant and running the application. Requires Ant and a compatible Java JDK. Ensure all required projects are cloned or downloaded. ```bash # Prerequisites # - Apache Ant # - Sun/Oracle Java JDK 1.5 or later (JDK 8+ recommended) # Clone or download all required projects: # - openproj_build (build scripts and packaging) # - openproj_core (core business logic) # - openproj_ui (Swing GUI) # - openproj_exchange (file import/export) # - openproj_reports (JasperReports integration) # - openproj_contrib (third-party libraries) # Build everything from openproj_build directory cd openproj_build ant # Run the application java -jar dist/projectlibre.jar # Or run from IDE (Eclipse recommended) # Main class: com.projity.Main (in openproj_ui) ``` -------------------------------- ### Task Snapshot Management in Java Source: https://context7.com/erdincay/projectlibre/llms.txt Demonstrates how to save, retrieve, clear, and compare task snapshots for baseline tracking and earned value analysis. Requires importing specific classes from the com.projity.pm package. ```java import com.projity.pm.task.NormalTask; import com.projity.pm.task.TaskSnapshot; import com.projity.pm.snapshot.Snapshottable; NormalTask task = /* get task */; // Save current state as baseline 0 task.saveCurrentToSnapshot(0); // Save to other baselines (0-10 supported) task.saveCurrentToSnapshot(1); // Baseline 1 task.saveCurrentToSnapshot(2); // Baseline 2 // Get baseline snapshot TaskSnapshot baseline = (TaskSnapshot) task.getSnapshot(0); if (baseline != null) { long baselineStart = baseline.getCurrentSchedule().getStart(); long baselineFinish = baseline.getCurrentSchedule().getFinish(); System.out.println("Baseline Start: " + new Date(baselineStart)); System.out.println("Baseline Finish: " + new Date(baselineFinish)); } // Clear a baseline task.clearSnapshot(1); // Get current working snapshot TaskSnapshot current = (TaskSnapshot) task.getCurrentSnapshot(); // Compare current to baseline for earned value TaskSnapshot baselineSnapshot = task.getBaselineSnapshot(); if (baselineSnapshot != null) { // Baseline data available for EV calculations double bcws = task.getBcws(); // Budgeted Cost of Work Scheduled double bcwp = task.getBcwp(); // Budgeted Cost of Work Performed double acwp = task.getAcwp(); // Actual Cost of Work Performed } // Project-level baseline operations project.saveCurrentToSnapshot(Snapshottable.BASELINE.intValue()); project.clearSnapshot(Snapshottable.BASELINE.intValue()); ``` -------------------------------- ### Create and Configure a Material Resource Source: https://context7.com/erdincay/projectlibre/llms.txt This snippet demonstrates creating a material resource, setting its name and unit label. Material resources are typically used for consumable items or equipment. ```java import com.projity.pm.resource.ResourceImpl; import com.projity.pm.resource.ResourcePool; import com.projity.pm.resource.ResourceType; // Create a material resource ResourceImpl hardware = resourcePool.newResourceInstance(); hardware.setName("Server Hardware"); hardware.setResourceType(ResourceType.MATERIAL); hardware.setMaterialLabel("units"); ``` -------------------------------- ### Configure and Manage Task Properties in Java Source: https://context7.com/erdincay/projectlibre/llms.txt Shows how to create, configure, and manage task properties including duration, constraints, milestones, progress tracking, and accessing calculated scheduling data. Note the use of `CalendarOption` for date handling. ```java import com.projity.pm.task.NormalTask; import com.projity.pm.task.Project; import com.projity.pm.scheduling.ConstraintType; import com.projity.datatype.Duration; import com.projity.datatype.TimeUnit; import com.projity.options.CalendarOption; // Create and configure a task NormalTask task = project.newNormalTaskInstance(); task.setName("Database Design"); task.setNotes("Design the database schema for the application"); task.setWbs("1.1.2"); // Set task duration (5 days estimated) long durationValue = Duration.getInstance(5, TimeUnit.DAYS); task.setDuration(durationValue); // Set task constraints task.setConstraintType(ConstraintType.SNET); // Start No Earlier Than task.setConstraintDate(CalendarOption.getInstance().makeValidStart( System.currentTimeMillis() + (7 * 24 * 60 * 60 * 1000), true)); // One week from now // Set as milestone (zero duration) task.setMarkTaskAsMilestone(true); // Track progress task.setPercentComplete(0.5); // 50% complete task.setActualStart(System.currentTimeMillis()); // Get calculated values long earlyStart = task.getEarlyStart(); long earlyFinish = task.getEarlyFinish(); long lateStart = task.getLateStart(); long lateFinish = task.getLateFinish(); long totalSlack = task.getTotalSlack(); long freeSlack = task.getFreeSlack(); // Check task status boolean isCritical = task.isCritical(); boolean isMilestone = task.isMilestone(); boolean isSummary = task.isSummary(); boolean isComplete = task.isComplete(); boolean inProgress = task.inProgress(); // Work with predecessors and successors (as formatted strings) String predecessors = task.getPredecessors(); // e.g., "1FS+2d,3SS" String successors = task.getSuccessors(); ``` -------------------------------- ### Ant Build Configuration for ProjectLibre Source: https://context7.com/erdincay/projectlibre/llms.txt An excerpt from the Ant build.xml file, showing targets for building, compiling, and creating the JAR file. It specifies source directories, classpaths, and the main class for execution. ```xml Build complete ``` -------------------------------- ### Create and Configure a Work Resource Source: https://context7.com/erdincay/projectlibre/llms.txt Use this to create a new work resource, set its properties like name, email, and group, and define its availability and cost rates. Assign a custom working calendar and add it to the resource pool hierarchy. ```java import com.projity.pm.resource.ResourceImpl; import com.projity.pm.resource.ResourcePool; import com.projity.pm.resource.ResourceType; import com.projity.pm.costing.CostRateTable; import com.projity.pm.calendar.WorkingCalendar; import com.projity.grouping.core.Node; import com.projity.grouping.core.NodeFactory; // Create a resource pool for the project ResourcePool resourcePool = project.getResourcePool(); // Create a new work resource ResourceImpl developer = resourcePool.newResourceInstance(); developer.setName("Jane Developer"); developer.setResourceType(ResourceType.WORK); developer.setEmailAddress("jane@example.com"); developer.setInitials("JD"); developer.setGroup("Engineering"); // Set resource availability (maximum units) developer.setMaximumUnits(1.0); // 100% availability // Set cost rates CostRateTable costTable = developer.getCostRateTable(0); developer.setStandardRate(new Rate(75.0, TimeUnit.HOURS)); // $75/hour developer.setOvertimeRate(new Rate(112.50, TimeUnit.HOURS)); // $112.50/hour OT developer.setCostPerUse(0.0); // Assign a custom calendar to the resource WorkingCalendar resourceCalendar = WorkingCalendar.getStandardBasedInstance(); resourceCalendar.setName("Developer Calendar"); developer.setWorkCalendar(resourceCalendar); // Add resource to the resource pool hierarchy Node resourceNode = NodeFactory.getInstance().createNode(developer); resourcePool.addToDefaultOutline(null, resourceNode); ``` -------------------------------- ### Create a Standard Task Assignment Source: https://context7.com/erdincay/projectlibre/llms.txt Binds a resource to a task with a specified unit allocation. Ensure the task and resource objects are already initialized. The assignment is automatically connected to both the task and resource upon creation. ```java import com.projity.pm.assignment.Assignment; import com.projity.pm.assignment.AssignmentService; import com.projity.pm.task.NormalTask; import com.projity.pm.resource.ResourceImpl; // Create an assignment: assign resource to task at 100% Assignment assignment = Assignment.getInstance( task, // The task developer, // The resource 1.0, // Units (1.0 = 100%) 0 // Request demand type (0 = none) ); // Connect the assignment (adds to task and resource) AssignmentService.getInstance().connect(assignment, null); ``` -------------------------------- ### Import Microsoft Project Files with MicrosoftImporter Source: https://context7.com/erdincay/projectlibre/llms.txt Use MicrosoftImporter to load .mpp, .mpx, or .xml files. It supports asynchronous import via Job and can also load from an InputStream. Resource mapping is available for server environments. ```java import com.projity.exchange.MicrosoftImporter; import com.projity.pm.task.Project; import com.projity.job.Job; import java.io.FileInputStream; import java.io.InputStream; // Import from file path MicrosoftImporter importer = new MicrosoftImporter(); importer.setFileName("/path/to/project.mpp"); // Get import job for async processing with progress tracking Job importJob = importer.getImportFileJob(); // Execute synchronously try { importer.importFile(); Project importedProject = importer.getProject(); System.out.println("Project: " + importedProject.getName()); System.out.println("Start: " + new Date(importedProject.getStart())); System.out.println("End: " + new Date(importedProject.getEnd())); // Access imported tasks for (Object task : importedProject.getTasks()) { Task t = (Task) task; System.out.println("Task: " + t.getName() + " Duration: " + t.getDuration()); } } catch (Exception e) { System.err.println("Import failed: " + e.getMessage()); } // Import from InputStream try (InputStream in = new FileInputStream("/path/to/project.xml")) { Project project = importer.loadProject(in); } // Import with resource mapping (for server environments) ResourceMappingForm mappingForm = new ResourceMappingForm(); importer.setResourceMapping(mappingForm); ``` -------------------------------- ### Calculate Critical Path with CriticalPath Class Source: https://context7.com/erdincay/projectlibre/llms.txt The CriticalPath class implements the CPM algorithm. Initialize it with a project, set it as the scheduling algorithm, and then trigger recalculations. Results like early/late dates and slack can be accessed per task. ```java import com.projity.pm.criticalpath.CriticalPath; import com.projity.pm.task.Project; import com.projity.pm.task.Task; // Initialize critical path for project CriticalPath criticalPath = new CriticalPath(project); project.setSchedulingAlgorithm(criticalPath); // Initialize and calculate criticalPath.initialize(project); // Trigger recalculation after changes project.recalculate(); // Alternative: recalculate specific task task.markTaskAsNeedingRecalculation(); project.updateScheduling(this, task, ObjectEvent.UPDATE, null); // Access scheduling results for a task Task task = /* get task */; // Early dates (forward pass) long earlyStart = task.getEarlyStart(); long earlyFinish = task.getEarlyFinish(); // Late dates (backward pass) long lateStart = task.getLateStart(); long lateFinish = task.getLateFinish(); // Slack calculations long totalSlack = task.getTotalSlack(); // Total float long freeSlack = task.getFreeSlack(); // Free float long startSlack = task.getStartSlack(); long finishSlack = task.getFinishSlack(); // Check if task is on critical path boolean isCritical = task.isCritical(); boolean isOrWasCritical = task.isOrWasCritical(); // Set project scheduling direction project.setForward(true); // Forward scheduling (default) project.setForward(false); // Backward scheduling from finish date ``` -------------------------------- ### Create and Manage Task Dependencies Source: https://context7.com/erdincay/projectlibre/llms.txt Use the Dependency class to establish relationships between tasks. Supports Finish-to-Start, Start-to-Start, Finish-to-Finish, and Start-to-Finish types with optional lag or lead times. Dependencies are managed via the DependencyService. ```java import com.projity.pm.dependency.Dependency; import com.projity.pm.dependency.DependencyService; import com.projity.pm.dependency.DependencyType; import com.projity.datatype.Duration; import com.projity.datatype.TimeUnit; // Create a Finish-to-Start dependency (default) // task2 cannot start until task1 finishes Dependency fsLink = Dependency.getInstance(task1, task2); fsLink.setDependencyType(DependencyType.FS); // Create a Start-to-Start dependency with lag // task2 starts 3 days after task1 starts Dependency ssLink = Dependency.getInstance( task1, // Predecessor task2, // Successor DependencyType.SS, // Start-to-Start Duration.getInstance(3, TimeUnit.DAYS) // 3-day lag ); // Create a Finish-to-Finish dependency with lead (negative lag) Dependency ffLink = Dependency.getInstance( task1, task2, DependencyType.FF, Duration.getInstance(-1, TimeUnit.DAYS) // 1-day lead (overlap) ); // Add dependency to the project try { DependencyService.getInstance().connect(fsLink, null); } catch (InvalidAssociationException e) { // Handle circular dependency or invalid link System.err.println("Invalid dependency: " + e.getMessage()); } // Remove a dependency DependencyService.getInstance().remove(fsLink, null, false); // Check dependency properties HasDependencies predecessor = fsLink.getPredecessor(); HasDependencies successor = fsLink.getSuccessor(); int type = fsLink.getDependencyType(); // FS=0, FF=1, SS=2, SF=3 long lag = fsLink.getLag(); // Access task's dependency lists AssociationList predecessors = task.getPredecessorList(); AssociationList successors = task.getSuccessorList(); for (Object obj : predecessors) { Dependency dep = (Dependency) obj; Task predTask = (Task) dep.getPredecessor(); System.out.println("Predecessor: " + predTask.getName()); } ``` -------------------------------- ### Export Project to MS Project XML with MSPDISerializer Source: https://context7.com/erdincay/projectlibre/llms.txt MSPDISerializer exports ProjectLibre projects to Microsoft Project XML format. It supports exporting to a file path or an OutputStream and provides an asynchronous export job. ```java import com.projity.server.data.MSPDISerializer; import com.projity.pm.task.Project; import java.io.FileOutputStream; import java.io.OutputStream; // Create serializer MSPDISerializer serializer = new MSPDISerializer(); // Export to file path try { serializer.saveProject(project, "/path/to/exported_project.xml"); System.out.println("Project exported successfully"); } catch (Exception e) { System.err.println("Export failed: " + e.getMessage()); } // Export to OutputStream try (OutputStream out = new FileOutputStream("/path/to/project.xml")) { boolean success = serializer.saveProject(project, out); if (success) { System.out.println("Export completed"); } } catch (Exception e) { System.err.println("Export error: " + e.getMessage()); } // Get export job for async processing Job exportJob = serializer.getExportFileJob(); ``` -------------------------------- ### Create a Delayed Task Assignment Source: https://context7.com/erdincay/projectlibre/llms.txt Creates an assignment with a specified delay before the resource begins work. This is useful for scheduling resource availability that is not immediate. ```java import com.projity.pm.assignment.Assignment; import com.projity.pm.duration.Duration; import com.projity.pm.duration.TimeUnit; import com.projity.pm.task.NormalTask; import com.projity.pm.resource.ResourceImpl; // Alternative: create with delay Assignment delayedAssignment = Assignment.getInstance( task, developer, 0.5, // 50% allocation Duration.getInstance(2, TimeUnit.DAYS) // 2-day delay before starting ); ``` -------------------------------- ### Define Custom Working Calendars Source: https://context7.com/erdincay/projectlibre/llms.txt The WorkingCalendar class allows definition of project schedules, including working and non-working days, custom exceptions, and inheritance from base calendars. Calendars can be assigned to projects or resources and used for date calculations. ```java import com.projity.pm.calendar.WorkingCalendar; import com.projity.pm.calendar.CalendarService; import com.projity.pm.calendar.WorkDay; import com.projity.pm.calendar.WorkRange; // Get the standard base calendar WorkingCalendar standardCalendar = CalendarService.getInstance().getDefaultInstance(); // Create a custom calendar based on standard WorkingCalendar customCalendar = WorkingCalendar.getStandardBasedInstance(); customCalendar.setName("Night Shift Calendar"); // Define working hours for a specific day type WorkDay workDay = new WorkDay(); workDay.setWorking(true); // Add work ranges (e.g., 10 PM to 6 AM night shift) WorkRange nightRange1 = new WorkRange(); nightRange1.setStart(22, 0); // 10:00 PM nightRange1.setEnd(24, 0); // Midnight workDay.addWorkingRange(nightRange1); WorkRange nightRange2 = new WorkRange(); nightRange2.setStart(0, 0); // Midnight nightRange2.setEnd(6, 0); // 6:00 AM workDay.addWorkingRange(nightRange2); // Set this as the default week pattern for Monday customCalendar.setWeekDay(Calendar.MONDAY, workDay); // Add a holiday exception WorkDay holiday = new WorkDay(); holiday.setWorking(false); holiday.setStart(DateTime.parseDate("2024-12-25")); // Christmas holiday.setEnd(DateTime.parseDate("2024-12-25")); customCalendar.addOrReplaceException(holiday); // Register the calendar with the service CalendarService.getInstance().add(customCalendar); // Assign calendar to project project.setWorkCalendar(customCalendar); // Assign calendar to a resource resource.setWorkCalendar(customCalendar); // Use calendar for date calculations long startDate = System.currentTimeMillis(); long duration = Duration.getInstance(5, TimeUnit.DAYS); long endDate = customCalendar.add(startDate, duration, true); // Compare two dates in working time long workingTime = customCalendar.compare(endDate, startDate, false); ``` -------------------------------- ### Update Assignment Progress Source: https://context7.com/erdincay/projectlibre/llms.txt Updates the progress of an assignment by setting the actual work completed and the overall percentage complete. This is crucial for tracking task status and resource utilization. ```java import com.projity.pm.assignment.Assignment; import com.projity.pm.duration.Duration; import com.projity.pm.duration.TimeUnit; // Update assignment progress assignment.setActualWork(Duration.getInstance(16, TimeUnit.HOURS)); assignment.setPercentComplete(0.75); ``` -------------------------------- ### Set Assignment Overtime Work Source: https://context7.com/erdincay/projectlibre/llms.txt Specifies the amount of overtime work allocated to an assignment. This is useful for planning and tracking work that extends beyond standard hours. ```java import com.projity.pm.assignment.Assignment; import com.projity.pm.duration.Duration; import com.projity.pm.duration.TimeUnit; // Work with overtime assignment.setOvertimeWork(Duration.getInstance(4, TimeUnit.HOURS)); ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.