Click here to Skip to main content
Click here to Skip to main content
Articles » Languages » Java » General » Downloads
 
Add your own
alternative version

Building Tree Structure Domain Model

, 12 Dec 2008
How to build domain model with tree structure, thinking Object-Oriented
treemodelsrc.zip
org
schedulemanager
demo
model
view
package org.schedulemanager.demo;

import org.schedulemanager.demo.model.BatchJob;
import org.schedulemanager.demo.model.JobGroup;
import org.schedulemanager.demo.model.Job;
import org.schedulemanager.demo.view.CommandLineView;

public class Manager {
	private Job rootJob;
	public Manager() {
		initJobs();
	}
	
	public void initJobs(){
		rootJob = new JobGroup("0", "rootJob",Job.DAILY);
		
		Job job1 = new BatchJob("1","job1");
		Job job2 = new BatchJob("2","job2");
		Job job3 = new JobGroup("3","job3",Job.DAILY);
		Job job4 = new BatchJob("4","job3-1");
		Job job5 = new BatchJob("5","job3-2");
		Job job6 = new JobGroup("6","job3-3",Job.DAILY);
		Job job7 = new BatchJob("7","job3-3-1");
		Job job8 = new BatchJob("8","job4");
		Job job9 = new BatchJob("9","job5");
		
		job6.addJob(job7);
		job3.addJob(job4);
		job3.addJob(job5);
		job3.addJob(job6);
		job3.addJob(job8);
		rootJob.addJob(job1);
		rootJob.addJob(job2);
		rootJob.addJob(job3);
		rootJob.addJob(job9);
	}

	public void run(){
		CommandLineView view = new CommandLineView();
		view.setJob(rootJob);
		view.printAllJobs();
	}
	public static void main(String[] args) {
		Manager manager = new Manager();
		manager.run();
	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

About the Author

RipleyKuo
Software Developer
Taiwan Taiwan
No Biography provided

| Advertise | Privacy | Mobile
Web04 | 2.8.140718.1 | Last Updated 12 Dec 2008
Article Copyright 2008 by RipleyKuo
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid