Advertisement
Guest User

Untitled

a guest
Dec 7th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.70 KB | None | 0 0
  1. public class UserType implements IJobDescriptor.IJobParameterStructureType {
  2. public UserType(String label) {
  3. if (label == null) {
  4. throw new IllegalArgumentException("label is null");
  5. }
  6.  
  7. this.label = label;
  8. }
  9.  
  10. private String label;
  11. private String description = null;
  12. private final Class typeClass = ReportJobUnitFactory.User.class;
  13.  
  14. public String getDescription() {
  15. return description;
  16. }
  17.  
  18. public ReportJobUnitFactory.UserType setDescription(String description) {
  19. this.description = description;
  20. return this;
  21. }
  22.  
  23. public String getLabel() {
  24. return this.label;
  25. }
  26.  
  27. public ReportJobUnitFactory.UserType setLabel(String label) {
  28. if (label == null) {
  29. throw new IllegalArgumentException("label is null");
  30. }
  31. this.label = label;
  32.  
  33. return this;
  34. }
  35.  
  36. public Class getTypeClass() {
  37. return this.typeClass;
  38. }
  39.  
  40. public Object createStructure(Map arg0) {
  41. ReportJobUnitFactory.User user = new ReportJobUnitFactory.User();
  42. if (arg0.containsKey("username") && arg0.get("username").getClass().equals(String.class)) {
  43. user.username = (String) arg0.get("username");
  44. } else {
  45. throw new IllegalArgumentException("no valid username configured");
  46. }
  47.  
  48. if (arg0.containsKey("password") && arg0.get("password").getClass().equals(String.class)) {
  49. user.password = (String) arg0.get("password");
  50. } else {
  51. throw new IllegalArgumentException("no valid password configured");
  52. }
  53.  
  54. return user;
  55. }
  56.  
  57. public Map getItemTypes() {
  58. return null;
  59. }
  60.  
  61. public IJobParameterType getUnknownItemType() {
  62. return null;
  63. }
  64. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement