use of com.att.aro.core.peripheral.pojo.PrivateDataInfo in project VideoOptimzer by attdevsupport.
the class UserPreferencesTest method testSetPrivateData.
@Test
public void testSetPrivateData() {
PrivateDataInfo phoneNumber = new PrivateDataInfo();
phoneNumber.setCategory("KEYWORD");
phoneNumber.setType("Phone Number");
phoneNumber.setValue("123-123-1234");
phoneNumber.setSelected(true);
PrivateDataInfo somePattern = new PrivateDataInfo();
somePattern.setCategory("PATTERN");
somePattern.setType("PATTERNNAME");
somePattern.setValue("PATTERNVALUE");
somePattern.setSelected(false);
List<PrivateDataInfo> privateData = new ArrayList<PrivateDataInfo>();
privateData.add(phoneNumber);
privateData.add(somePattern);
UserPreferences userPrefs = MockUserPreferencesFactory.getInstance().create();
userPrefs.setPrivateData(privateData);
IPreferenceHandler mockPrefHandler = userPrefs.getPreferenceHandler();
String actualPrivateDataPersisted = mockPrefHandler.getPref(PRIVATE_DATA);
String expectedPrivateDataPersisted = "KEYWORD,Phone Number,123-123-1234,Y;PATTERN,PATTERNNAME,PATTERNVALUE,N";
assertEquals(expectedPrivateDataPersisted, actualPrivateDataPersisted);
}
use of com.att.aro.core.peripheral.pojo.PrivateDataInfo in project VideoOptimzer by attdevsupport.
the class TransmissionPrivateDataImpl method getKeywordsFromPreference.
/**
* get keywords from user preference
*
* @param builder
*/
private void getKeywordsFromPreference(SearchingPatternBuilder builder) {
UserPreferences pref = UserPreferencesFactory.getInstance().create();
List<PrivateDataInfo> list = pref.getPrivateData();
if (list != null) {
for (PrivateDataInfo info : list) {
if (info.isSelected()) {
String encodeURL = Util.encodeUrlEncoding(info.getValue());
builder.add(encodeURL, info.getType());
}
}
}
}
use of com.att.aro.core.peripheral.pojo.PrivateDataInfo in project VideoOptimzer by attdevsupport.
the class PrivateDataDialog method prepareSerializeUserPreference.
/**
* prepare data list and set to UserPreference
* @param entries
* @return
*/
private List<PrivateDataInfo> prepareSerializeUserPreference(Map<String, KeywordEntry> entries) {
Set<String> types = entries.keySet();
List<PrivateDataInfo> infos = new LinkedList<PrivateDataInfo>();
List<String> errors = new LinkedList<String>();
for (String type : types) {
KeywordEntry entry = entries.get(type);
String text = entries.get(entry.type).textField.getText();
boolean isSelected = entries.get(entry.type).checkBox.isSelected();
if (!validatePrivateData(text) && isSelected) {
errors.add(entry.type);
continue;
}
PrivateDataInfo info = new PrivateDataInfo();
info.setCategory(TraceDataConst.PrivateData.KEYWORD_CATEGORY);
info.setType(entry.type);
info.setValue(text);
info.setSelected(isSelected);
infos.add(info);
}
if (errors.isEmpty()) {
return infos;
} else {
errorMessage = getErrorMessage(errors);
return null;
}
}
use of com.att.aro.core.peripheral.pojo.PrivateDataInfo in project VideoOptimzer by attdevsupport.
the class PrivateDataDialog method setSelectAllCheckboxSelected.
/**
* initiate select all check box to be checked if all the entries have been checked
* @param infos
* @param selectAllCheckbox
*/
private void setSelectAllCheckboxSelected(List<PrivateDataInfo> infos, JCheckBox selectAllCheckbox) {
totalEntries = infos.size();
totalSelected = 0;
for (PrivateDataInfo info : infos) {
if (info.isSelected()) {
totalSelected++;
}
}
selectAllCheckbox.setSelected((totalEntries == 0) ? false : (totalSelected == totalEntries));
}
use of com.att.aro.core.peripheral.pojo.PrivateDataInfo in project VideoOptimzer by attdevsupport.
the class PrivateDataDialog method setCustomizedEntries.
/**
* set customized entries
* @param infos
*/
private void setCustomizedEntries(List<PrivateDataInfo> infos) {
for (PrivateDataInfo info : infos) {
if (TraceDataConst.PrivateData.KEYWORD_CATEGORY.equals(info.getCategory()) && !defaultKeywords.contains(info.getType())) {
KeywordEntry entry = initKeywordEntry(info);
privateDataListPanel.add(getKeywordEntryGrid(entry, true));
entries.put(entry.type, entry);
}
}
}
Aggregations