String[] paths = collection.getChildren();
for (String path : paths) {
AccountInfo accountInfo = new AccountInfo();
GenericCredentials credentials = new GenericCredentials();
Resource resource = registry.get(path);
List<String> accountPropertySet= resource.getPropertyValues(IssueTrackerConstants.ACCOUNT_KEY);
accountInfo.setKey(accountPropertySet.get(accountPropertySet.size()-1));
List<String> urlPropertySet = resource.getPropertyValues(IssueTrackerConstants.ISSUE_TRACKER_URL);
String url = urlPropertySet.get(urlPropertySet.size()-1);
List<String> usernamePropertySet= resource.getPropertyValues(IssueTrackerConstants.ACCOUNT_USERNAME);
String username = usernamePropertySet.get(usernamePropertySet.size()-1);
List<String> passwordPropertySet = resource.getPropertyValues(IssueTrackerConstants.ACCOUNT_PASSWORD);
String encryptedPassword = passwordPropertySet.get(passwordPropertySet.size()-1);
byte[] base64DecodedBytes = (new BASE64Decoder()).decodeBuffer(encryptedPassword);
String password = new String(CryptoUtil.getDefaultCryptoUtil().decrypt(base64DecodedBytes));
String isAutoReportingEnabled = resource.getProperty(IssueTrackerConstants.AUTO_REPORTING);
if (null != isAutoReportingEnabled &&
IssueTrackerConstants.IS_AUTO_REPORTING_ENABLED.equals(isAutoReportingEnabled)) {
accountInfo.setAutoReportingEnable(true);
AutoReportingSettings settings=new AutoReportingSettings();
String projectName=resource.getProperty(IssueTrackerConstants.AUTO_REPORTING_PROJECT);
settings.setProjectName(projectName);
String priority = resource.getProperty(IssueTrackerConstants.AUTO_REPORTING_PRIORITY);
settings.setPriority(priority);
String type = resource.getProperty(IssueTrackerConstants.AUTO_REPORTING_ISSUE_TYPE);
settings.setIssueType(type);
accountInfo.setAutoReportingSettings(settings);
} else {
accountInfo.setAutoReportingEnable(false);
}
if (!"".equals(url) && !"".equals(username) && !"".equals(password)) {
credentials.setUrl(url);
credentials.setUsername(username);
credentials.setPassword(password);
accountInfo.setCredentials(credentials);
accounts.add(accountInfo);
}
}