Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class UserType implements IJobDescriptor.IJobParameterStructureType {
- public UserType(String label) {
- if (label == null) {
- throw new IllegalArgumentException("label is null");
- }
- this.label = label;
- }
- private String label;
- private String description = null;
- private final Class typeClass = ReportJobUnitFactory.User.class;
- public String getDescription() {
- return description;
- }
- public ReportJobUnitFactory.UserType setDescription(String description) {
- this.description = description;
- return this;
- }
- public String getLabel() {
- return this.label;
- }
- public ReportJobUnitFactory.UserType setLabel(String label) {
- if (label == null) {
- throw new IllegalArgumentException("label is null");
- }
- this.label = label;
- return this;
- }
- public Class getTypeClass() {
- return this.typeClass;
- }
- public Object createStructure(Map arg0) {
- ReportJobUnitFactory.User user = new ReportJobUnitFactory.User();
- if (arg0.containsKey("username") && arg0.get("username").getClass().equals(String.class)) {
- user.username = (String) arg0.get("username");
- } else {
- throw new IllegalArgumentException("no valid username configured");
- }
- if (arg0.containsKey("password") && arg0.get("password").getClass().equals(String.class)) {
- user.password = (String) arg0.get("password");
- } else {
- throw new IllegalArgumentException("no valid password configured");
- }
- return user;
- }
- public Map getItemTypes() {
- return null;
- }
- public IJobParameterType getUnknownItemType() {
- return null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement