Subversion Repositories SmartDukaan

Rev

Rev 3561 | Rev 5192 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 3561 Rev 5101
Line 25... Line 25...
25
@SuppressWarnings("serial")
25
@SuppressWarnings("serial")
26
public class GlossaryController extends BaseController {
26
public class GlossaryController extends BaseController {
27
	private static Logger logger = Logger.getLogger(GlossaryController.class);
27
	private static Logger logger = Logger.getLogger(GlossaryController.class);
28
	
28
	
29
	private String id;
29
	private String id;
-
 
30
	private String title;
-
 
31
	private String definition;
-
 
32
	
30
	public GlossaryController(){
33
	public GlossaryController(){
31
		super();
34
		super();
32
	}
35
	}
33
 
36
 
34
	public String show() {
37
	public String show() {
-
 
38
		if(id == null)	{
-
 
39
			definition = "";
-
 
40
		} else	{
-
 
41
			try	{
-
 
42
				definition = FileUtils.read(Utils.EXPORT_ENTITIES_PATH + "../../../ROOT/helpdocs/" + id);
-
 
43
				
-
 
44
				String startTitleTagOpener = ">";
-
 
45
				String startTitleTagCloser = "</span";
-
 
46
				int titleBeginIndex = 1 + definition.indexOf(startTitleTagOpener);
-
 
47
				int titleEndIndex = definition.indexOf(startTitleTagCloser);
-
 
48
				
-
 
49
				title = definition.substring(titleBeginIndex, titleEndIndex);
-
 
50
				
-
 
51
			} catch (Exception e)	{
-
 
52
				logger.error("Unable to read helpdocs file for term " + id, e);
-
 
53
			}
-
 
54
		}
35
		return "show";
55
		return "show";
36
    }
56
    }
37
 
57
 
38
	public String index() {
58
	public String index() {
39
		return "show";
59
		return "show";
Line 45... Line 65...
45
	
65
	
46
	public void setId(String id){
66
	public void setId(String id){
47
		this.id = id;
67
		this.id = id;
48
	}
68
	}
49
	
69
	
-
 
70
	public String getTitle()	{
-
 
71
		return title;
-
 
72
	}
-
 
73
	
50
	public String getDefinition(){
74
	public String getDefinition(){
51
		String definition = "";
-
 
52
		if(id == null){
-
 
53
			return definition;
-
 
54
		}
-
 
55
		try{
-
 
56
			definition = FileUtils.read(Utils.EXPORT_ENTITIES_PATH + "../../../ROOT/helpdocs/" + id);
-
 
57
		}catch (Exception e) {
-
 
58
			logger.error("Unable to read helpdocs file for term " + id, e);
-
 
59
		}
-
 
60
		return definition;
75
		return definition;
61
	}
76
	}
62
 
77
 
63
    public Map<String, String> getItems(){
78
    public Map<String, String> getItems(){
64
    	Map<String, String> snippets = new HashMap<String, String>();
79
    	Map<String, String> snippets = new HashMap<String, String>();