PageRenderTime 52ms CodeModel.GetById 18ms RepoModel.GetById 0ms app.codeStats 0ms

/net/suddenelfilio/ws/tag/Tag.java

https://bitbucket.org/suddenelfilio/mstagjavalib
Java | 63 lines | 50 code | 13 blank | 0 comment | 10 complexity | f34e46e514edc9a193037ea5850a45bd MD5 | raw file
  1. package net.suddenelfilio.ws.tag;
  2. import java.net.MalformedURLException;
  3. import java.net.URL;
  4. import java.util.HashMap;
  5. import java.util.Map;
  6. public abstract class Tag extends TagItemAPIBase
  7. {
  8. public String InteractionNote;
  9. public Status TagStatus;
  10. public String Title;
  11. public ImageTypes Types;
  12. public String UTCEndDate;
  13. public String UTCStartDate;
  14. public String CategoryName;
  15. @Override
  16. public abstract URL ToURL(URLType type) throws MalformedURLException,
  17. Exception;
  18. protected final URL Activate() throws Exception
  19. {
  20. if (MSTagService.SVCAPITOKEN == null || MSTagService.SVCAPITOKEN.equals(""))
  21. throw new Exception("Did you forget to set the MSTagService.SVCAPITOKEN with your token?");
  22. Map<String, String> mp = new HashMap<String, String>();
  23. mp.put("at", MSTagService.SVCAPITOKEN);
  24. if (IsNullOrEmpty(Title))
  25. throw new Exception("The Title cannot be null or empty when activating a Tag.");
  26. else
  27. mp.put("tt", Title);
  28. if (IsNullOrEmpty(CategoryName))
  29. throw new Exception("The CategoryName cannot be null or empty when activating a Tag.");
  30. else
  31. mp.put("cn", CategoryName);
  32. return new URL(GenerateURL(mp, "ActivateTag"));
  33. }
  34. protected final URL Pause() throws Exception
  35. {
  36. if (MSTagService.SVCAPITOKEN == null || MSTagService.SVCAPITOKEN.equals(""))
  37. throw new Exception("Did you forget to set the MSTagService.SVCAPITOKEN with your token?");
  38. Map<String, String> mp = new HashMap<String, String>();
  39. mp.put("at", MSTagService.SVCAPITOKEN);
  40. if (IsNullOrEmpty(Title))
  41. throw new Exception("The Title cannot be null or empty when pausing a Tag.");
  42. else
  43. mp.put("tt", Title);
  44. if (IsNullOrEmpty(CategoryName))
  45. throw new Exception("The CategoryName cannot be null or empty when pausing a Tag.");
  46. else
  47. mp.put("cn", CategoryName);
  48. return new URL(GenerateURL(mp, "PauseTag"));
  49. }
  50. }