本文整理汇总了Java中com.google.gdata.data.spreadsheet.ListEntry类的典型用法代码示例。如果您正苦于以下问题:Java ListEntry类的具体用法?Java ListEntry怎么用?Java ListEntry使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ListEntry类属于com.google.gdata.data.spreadsheet包,在下文中一共展示了ListEntry类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: returnValue
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
@Test
public void returnValue() throws Exception {
SpreadSheetReader spreadsheet = mock(SpreadSheetReader.class);
ListEntry row = mock(ListEntry.class);
when(spreadsheet.findRowByColumnValue("log-code", "+lms")).thenReturn(row);
GdataCell cell = spy(new GdataCell(spreadsheet, "userid", "log-code", "+lms"));
CustomElementCollection elementCollection = new CustomElementCollection();
when(row.getCustomElements()).thenReturn(elementCollection);
elementCollection.setValueLocal("userid", "newValue");
String expected = "newValue";
String actual = cell.value();
assertThat(actual, is(expected));
}
示例2: updateValueAndEscapeCode
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
@Test
public void updateValueAndEscapeCode() throws Exception {
SpreadSheetReader spreadsheet = mock(SpreadSheetReader.class);
ListEntry row = mock(ListEntry.class);
String header = "log-code";
String code = "+lms";
when(spreadsheet.findRowByColumnValue(header, code)).thenReturn(row);
CustomElementCollection elementCollection = new CustomElementCollection();
elementCollection.setValueLocal(header, code);
when(row.getCustomElements()).thenReturn(elementCollection);
GdataCell cell = spy(new GdataCell(spreadsheet, "userid", header, code));
String value = "newValue";
cell.update(value);
verify(row).update();
assertThat(elementCollection.getValue(header), is("'" + code));
assertThat(elementCollection.getValue("userid"), is(value));
}
示例3: getEmptyClinicalVariants
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
private static void getEmptyClinicalVariants(Gene gene, SpreadsheetService service, WorksheetEntry entry) throws IOException, ServiceException {
if (gene != null && service != null && entry != null) {
URL feedUrl = entry.getListFeedUrl();
Set<ClinicalVariant> variants = MainUtils.getClinicalVariants(gene);
for (ClinicalVariant variant : variants) {
if (variant.getOncoTreeType() == null || StringUtils.isNullOrEmpty(variant.getLevel())
|| (variant.getDrugAbstracts().isEmpty() && variant.getDrugPmids().isEmpty())
|| variant.getDrug().isEmpty()) {
ListEntry row = new ListEntry();
setValue(row, "Gene", gene.getHugoSymbol());
setValue(row, "Alteration", variant.getVariant().getAlteration());
setValue(row, "CancerType", getCancerType(variant.getOncoTreeType()));
setValue(row, "Level", variant.getLevel());
setValue(row, "Drug", org.apache.commons.lang3.StringUtils.join(variant.getDrug(), ", "));
setValue(row, "Pmids", org.apache.commons.lang3.StringUtils.join(variant.getDrugPmids(), ", "));
setValue(row, "Abstracts", org.apache.commons.lang3.StringUtils.join(variant.getDrugAbstracts(), ", "));
service.insert(feedUrl, row);
}
}
}
}
示例4: getEmptyBiologicalVariants
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
private static void getEmptyBiologicalVariants(Gene gene, SpreadsheetService service, WorksheetEntry entry) throws IOException, ServiceException {
if (gene != null && service != null && entry != null) {
URL feedUrl = entry.getListFeedUrl();
Set<BiologicalVariant> variants = MainUtils.getBiologicalVariants(gene);
for (BiologicalVariant variant : variants) {
if (variant.getOncogenic() == null || variant.getMutationEffect() == null
|| (variant.getMutationEffectPmids().isEmpty() && variant.getMutationEffectAbstracts().isEmpty())) {
ListEntry row = new ListEntry();
setValue(row, "Gene", gene.getHugoSymbol());
setValue(row, "Alteration", variant.getVariant().getAlteration());
setValue(row, "Oncogenicity", variant.getOncogenic());
setValue(row, "MutationEffect", variant.getMutationEffect());
setValue(row, "PMIDs", org.apache.commons.lang3.StringUtils.join(variant.getMutationEffectPmids(), ", "));
Set<ArticleAbstract> articleAbstracts = variant.getMutationEffectAbstracts();
Set<String> abstracts = new HashSet<>();
for (ArticleAbstract articleAbstract : articleAbstracts) {
abstracts.add(articleAbstract.getAbstractContent());
}
setValue(row, "Abstracts", org.apache.commons.lang3.StringUtils.join(abstracts, ", "));
service.insert(feedUrl, row);
}
}
}
}
示例5: printTumorTypeSummary
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
private static void printTumorTypeSummary(Set<Evidence> evidences, SpreadsheetService service, WorksheetEntry entry) throws IOException, ServiceException {
URL feedUrl = entry.getListFeedUrl();
if (evidences != null && service != null && entry != null) {
for (Evidence evidence : evidences) {
ListEntry row = new ListEntry();
setValue(row, "Gene", evidence.getGene().getHugoSymbol());
List<String> alterationNames = getAlterationNameByEvidence(evidence);
setValue(row, "Variants", MainUtils.listToString(alterationNames, ", "));
setValue(row, "CancerType", getCancerType(evidence.getOncoTreeType()));
setValue(row, "Summary", evidence.getDescription());
service.insert(feedUrl, row);
}
}
}
示例6: printAndCacheEntry
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
/**
* Prints the entire list entry, in a way that mildly resembles what the
* actual XML looks like.
*
* In addition, all printed entries are cached here. This way, they can be
* updated or deleted, without having to retrieve the version identifier again
* from the server.
*
* @param entry the list entry to print
*/
public void printAndCacheEntry(ListEntry entry) {
// We only care about the entry id, chop off the leftmost part.
// I.E., this turns http://spreadsheets.google.com/..../cpzh6 into cpzh6.
String id = entry.getId().substring(entry.getId().lastIndexOf('/') + 1);
// Cache all displayed entries so that they can be updated later.
entriesCached.put(id, entry);
out.println("-- id: " + id + " title: " + entry.getTitle().getPlainText());
for (String tag : entry.getCustomElements().getTags()) {
out.println(" <gsx:" + tag + ">"
+ entry.getCustomElements().getValue(tag) + "</gsx:" + tag + ">");
}
}
示例7: update
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
/**
* Updates an existing entry.
*
* See the comment in {@code delete} for why the entry is cached in a hash
* map.
*
* @param id the ID of the row to update
* @param nameValuePairs the name value pairs, such as "name=Rosa" to change
* the row's name field to Rosa
* @throws ServiceException when the request causes an error in the Google
* Spreadsheets service.
* @throws IOException when an error occurs in communication with the Google
* Spreadsheets service.
*/
public void update(String id, String nameValuePairs) throws IOException,
ServiceException {
// The next line of code finds the entry to update.
// See the javadoc on entriesCached.
ListEntry entry = entriesCached.get(id);
setEntryContentsFromString(entry, nameValuePairs);
if (entry != null) {
entry.update(); // This updates the existing entry.
out.println("Updated!");
} else {
out.println("I don't know that ID.");
out.println("In GData, you must get an entry before deleting it.");
out.println("You might have to 'list' first.");
}
}
示例8: resetEntries
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
/**
* Resets all the entries from a new list.
*
* This also tries to figure out what the set of valid columns is.
*/
public synchronized void resetEntries(List<ListEntry> entries) {
TreeSet<String> columnSet = new TreeSet<String>();
list.clear();
columnNames.clear();
for (ListEntry entry : entries) {
list.add(new ListEntryModel(entry));
columnSet.addAll(entry.getCustomElements().getTags());
}
// Always have an empty row to edit.
list.add(new ListEntryModel());
columnNames.add("(Edit)");
columnNames.addAll(columnSet);
fireTableStructureChanged();
fireTableDataChanged();
}
示例9: getSsEntryListHelper
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
/**
* Retrieves all <code>ListEntry</code> objects from the spreadsheet
*
* @return <code>List</code> of <code>ListEntry</code> instances
* @throws EPAuthenticationException
*/
private List<ListEntry> getSsEntryListHelper()
throws EPAuthenticationException {
List<ListEntry> returnList = null;
try {
SpreadsheetService ssService = getSsService();
ListFeed listFeed = ssService.getFeed(ssUrl, ListFeed.class);
returnList = listFeed.getEntries();
} catch (com.google.gdata.util.AuthenticationException authEx) {
throw new EPAuthenticationException("SS read access not available");
} catch (com.google.gdata.util.ServiceException svcex) {
System.err.println("ServiceException while retrieving " +
"entry list: " + svcex.getMessage());
returnList = null;
} catch (java.io.IOException ioex) {
System.err.println("IOException while retrieving " +
"entry list: " + ioex.getMessage());
returnList = null;
}
return returnList;
}
示例10: updateSyncPicasa
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
public static void updateSyncPicasa(Settings settings, String parseType, Object data, String picasaId, String imagePicasaURL, String isProcessed) throws IOException, ServiceException {
String paramPIcasaId = DotoQuizStructure.getStructureKey(parseType, settings, "iAlbumIdPicasa");
String paramImageURLPicasa = DotoQuizStructure.getStructureKey(parseType, settings, "iImageURLPicasa");
String paramIsProcessed = DotoQuizStructure.getStructureKey(parseType, settings, "iIsProcessed");
if(DATA_TYPE.EXCEL.toString().equals(settings.getDataType())) {
Row rowData = (Row) data;
if(StringUtils.hasValue(picasaId)) rowData.getCell(Integer.parseInt(paramPIcasaId)).setCellValue(picasaId);
if(StringUtils.hasValue(imagePicasaURL)) rowData.getCell(Integer.parseInt(paramImageURLPicasa)).setCellValue(imagePicasaURL);
rowData.getCell(Integer.parseInt(paramIsProcessed)).setCellValue(isProcessed);
} else if(DATA_TYPE.GOOGLESHEET.toString().equals(settings.getDataType())) {
ListEntry listEntry = (ListEntry) data;
if(StringUtils.hasValue(picasaId)) listEntry.getCustomElements().setValueLocal(paramPIcasaId, picasaId);
if(StringUtils.hasValue(imagePicasaURL)) listEntry.getCustomElements().setValueLocal(paramImageURLPicasa, imagePicasaURL);
listEntry.getCustomElements().setValueLocal(paramIsProcessed, isProcessed);
listEntry.update();
}
}
示例11: updateClearPicasa
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
public static void updateClearPicasa(Settings settings, String parseType, Object data) throws IOException, ServiceException {
String paramPIcasaId = DotoQuizStructure.getStructureKey(parseType, settings, "iAlbumIdPicasa");
String paramImageURLPicasa = DotoQuizStructure.getStructureKey(parseType, settings, "iImageURLPicasa");
String paramIsProcessed = DotoQuizStructure.getStructureKey(parseType, settings, "iIsProcessed");
String picasaId = "";
if(DATA_TYPE.EXCEL.toString().equals(settings.getDataType())) {
Row rowData = (Row) data;
picasaId = rowData.getCell(Integer.parseInt(paramPIcasaId)).getStringCellValue();
rowData.getCell(Integer.parseInt(paramPIcasaId)).setCellValue(QuizConstant.EMPTY_STRING);
rowData.getCell(Integer.parseInt(paramImageURLPicasa)).setCellValue(QuizConstant.EMPTY_STRING);
rowData.getCell(Integer.parseInt(paramIsProcessed)).setCellValue(QuizConstant.EMPTY_STRING);
} else if(DATA_TYPE.GOOGLESHEET.toString().equals(settings.getDataType())) {
ListEntry listEntry = (ListEntry) data;
picasaId = listEntry.getCustomElements().getValue(paramPIcasaId);
listEntry.getCustomElements().setValueLocal(paramPIcasaId, QuizConstant.EMPTY_STRING);
listEntry.getCustomElements().setValueLocal(paramImageURLPicasa, QuizConstant.EMPTY_STRING);
listEntry.getCustomElements().setValueLocal(paramIsProcessed, QuizConstant.EMPTY_STRING);
listEntry.update();
}
log.info("Clear Data " + parseType + ": " + picasaId);
}
示例12: showColumnHeader
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
private boolean showColumnHeader(Object data, String sheetName) {
if(APPLICATION_TYPE.SHOW_COLUMN_HEADER.toString().equals(settings.getApplicationType())) {
log.info("Show column header for \"" + sheetName + "\"");
if(DATA_TYPE.EXCEL.toString().equals(settings.getDataType())) {
Row rowData = (Row) data;
Iterator<Cell> cellIterator = rowData.iterator();
int columnCount = rowData.getRowNum();
for(int i=0;i<columnCount;i++) {
Cell cell = rowData.getCell(i);
log.info("\tColumn("+i+"): " + cell.getStringCellValue());
}
} else if(DATA_TYPE.GOOGLESHEET.toString().equals(settings.getDataType())) {
ListEntry listEntry = (ListEntry) data;
int index = 0;
for (String tag : listEntry.getCustomElements().getTags()) {
log.info("\tColumn" + (index++) + ": " + tag);
}
}
return true;
}
return false;
}
示例13: getAllEntries
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
private List<String> getAllEntries(ListFeed listFeed, String[] headerDefault)
{
List<String> returnValue = Lists.newArrayList();
Joiner joiner = Joiner.on(Properties.inputDelimiter.get());
Set<String> header = null;
List<ListEntry> entries = listFeed.getEntries();
if (entries != null && entries.size() > 0) {
ListEntry listEntry = entries.get(0);
if (listEntry != null)
header = listEntry.getCustomElements().getTags();
}
if (header == null && headerDefault != null) {
header = new LinkedHashSet<String>();
for (String headerItem : headerDefault) {
header.add(headerItem);
}
}
returnValue.add(joiner.join(header));
for (ListEntry row : entries) {
List<String> rowValues = Lists.newArrayList();
for (String tag : header) {
String value = row.getCustomElements().getValue(tag);
if (value == null)
value = "";
rowValues.add(value);
}
String rowValuesString = joiner.join(rowValues);
returnValue.add(rowValuesString);
}
return returnValue;
}
示例14: createsNewColumnForUserId
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
@Ignore
@Test
public void createsNewColumnForUserId() throws Exception {
final SpreadSheetReader spreadsheet =
JujacoreProgressServiceIntegrationTest.injector.getInstance(
Key.get(SpreadSheetReader.class, Names.named("progress"))
);
final String title = "TEST_HEADER";
final ListEntry header = spreadsheet.findRowByColumnValue(title, "");
header.update();
final CellEntry cell = spreadsheet.createNewHeader(title);
MatcherAssert.assertThat(cell.getCell().getInputValue(), Is.is(title));
}
示例15: printEvidences
import com.google.gdata.data.spreadsheet.ListEntry; //导入依赖的package包/类
private static void printEvidences(Set<Evidence> evidences, SpreadsheetService service, WorksheetEntry entry) throws IOException, ServiceException {
URL feedUrl = entry.getListFeedUrl();
if (evidences != null && service != null && entry != null) {
for (Evidence evidence : evidences) {
ListEntry row = new ListEntry();
setValue(row, "Level", evidence.getLevelOfEvidence().getLevel());
setValue(row, "Gene", evidence.getGene().getHugoSymbol());
List<String> alterationNames = getAlterationNameByEvidence(evidence);
setValue(row, "Variants", MainUtils.listToString(alterationNames, ", "));
setValue(row, "Disease", getCancerType(evidence.getOncoTreeType()));
Set<String> drugs = EvidenceUtils.getDrugs(Collections.singleton(evidence));
List<String> drugList = new ArrayList<>(drugs);
Collections.sort(drugList);
setValue(row, "Drugs", org.apache.commons.lang3.StringUtils.join(drugList, ", "));
Set<String> articles = EvidenceUtils.getPmids(Collections.singleton(evidence));
List<String> articleList = new ArrayList<>(articles);
Collections.sort(articleList);
setValue(row, "PMIDs", org.apache.commons.lang3.StringUtils.join(articleList, ", "));
setValue(row, "NumberOfPMIDs", Integer.toString(articleList.size()));
Set<String> abstractContent = getAbstractContentFromEvidence(evidence);
setValue(row, "Abstracts", org.apache.commons.lang3.StringUtils.join(abstractContent, ", "));
service.insert(feedUrl, row);
}
}
}