01: /*
02: * Created by IntelliJ IDEA.
03: * User: Jacques
04: * Date: May 28, 2005
05: * Time: 5:49:35 PM
06: */
07: package com.technoetic.xplanner.domain;
08:
09: import java.util.Map;
10: import java.util.HashMap;
11:
12: public class DomainObjectWikiLinkFormatter {
13: String fromText;
14: String toText;
15:
16: Map schemeByClass = new HashMap();
17:
18: public DomainObjectWikiLinkFormatter() {
19: initSchemeByClassMap();
20: }
21:
22: private void initSchemeByClassMap() {
23: schemeByClass.put(Project.class, "project");
24: schemeByClass.put(Iteration.class, "iteration");
25: // schemeByClass.put(Feature.class, "feature");
26: schemeByClass.put(UserStory.class, "story");
27: schemeByClass.put(Task.class, "task");
28: }
29:
30: public String format(DomainObject object) {
31: String link = "";
32: if (object != null) {
33: String scheme = (String) schemeByClass.get(object
34: .getClass());
35: link = scheme + ":" + object.getId();
36: }
37: return link;
38: }
39: }
|