1 6 7 package com.sun.enterprise.config.backup; 8 import com.sun.enterprise.config.backup.status.Status; 9 import com.sun.enterprise.config.backup.utils.FactoryHelper; 10 11 12 17 public class ActiveAssistanceManager { 18 19 20 public ActiveAssistanceManager() { 21 } 22 23 public void assist(Status s) { 24 if(s == null) { 26 return; 28 } 29 30 if(s.isSuccess()) { 31 addDidYouKnow(s); 32 } else { 33 addDiagnosabilityInfo(s); 34 } 35 } 36 37 private void addDidYouKnow(Status s) { 38 s.setExtraInfo(getDidYouKnow(s)); 39 } 40 41 private String getDidYouKnow(Status s) { 42 String text = getDidYouKnowText(s); 43 if (text == null || "".equals(text)) return null; 44 return "Did You Know? \n" + text; 45 } 46 47 private void addDiagnosabilityInfo(Status s) { 48 if(s == null) return; 49 50 String info = getDiagInfo(s); 51 if (info == null || "".equals(info)) return; 52 53 s.setExtraInfo(info); 54 } 55 private String getDiagInfo(Status s) { 56 String info = getDiagText(s); 57 if(info == null) return null; 58 return "Hints: \n" + info; 59 } 60 61 private String getDidYouKnowText(Status status) { 62 return FactoryHelper.getAssistance().getDidYouKnow(status); 63 } 64 65 private String getDiagText(Status s) { 66 return FactoryHelper.getAssistance().getDiagnosabilityInfo(s); 67 } 68 } 69 | Popular Tags |