Minor code improvements
This commit is contained in:
parent
2e7355fddf
commit
43dea89dae
8 changed files with 15 additions and 63 deletions
|
@ -456,8 +456,8 @@ public class FileHarvestController extends FreemarkerHttpServlet {
|
|||
}
|
||||
|
||||
StringBuilder progressSinceLastCheck = new StringBuilder();
|
||||
for(int i = 0; i < unsentLogLines.length; i++) {
|
||||
progressSinceLastCheck.append(unsentLogLines[i]).append(newline);
|
||||
for (String unsentLogLine : unsentLogLines) {
|
||||
progressSinceLastCheck.append(unsentLogLine).append(newline);
|
||||
}
|
||||
|
||||
boolean finished = sessionInfo.isFinished();
|
||||
|
|
|
@ -173,12 +173,12 @@ class Harvester {
|
|||
*/
|
||||
public static String[] stringsToArray(Object ... args) {
|
||||
ArrayList<String> allData = new ArrayList<String>();
|
||||
for(int i = 0; i < args.length; i++) {
|
||||
if(args[i] instanceof String[]) {
|
||||
String[] array = (String[])(args[i]);
|
||||
for (Object arg : args) {
|
||||
if (arg instanceof String[]) {
|
||||
String[] array = (String[]) (arg);
|
||||
Collections.addAll(allData, array);
|
||||
} else {
|
||||
allData.add(args[i].toString());
|
||||
allData.add(arg.toString());
|
||||
}
|
||||
}
|
||||
return allData.toArray(new String[allData.size()]);
|
||||
|
|
|
@ -27,40 +27,14 @@ import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
|||
|
||||
public class OrganizationUtilityFunctions {
|
||||
|
||||
public static String getHighestLevelOrganizationURI(ResultSet resultSet,
|
||||
Map<String, String> fieldLabelToOutputFieldLabel) {
|
||||
|
||||
GenericQueryMap queryResult = new GenericQueryMap();
|
||||
|
||||
public static String getHighestLevelOrganizationURI(ResultSet resultSet, Map<String, String> fieldLabelToOutputFieldLabel) {
|
||||
while (resultSet.hasNext()) {
|
||||
QuerySolution solution = resultSet.nextSolution();
|
||||
|
||||
RDFNode organizationNode = solution
|
||||
.get(fieldLabelToOutputFieldLabel.get("organization"));
|
||||
RDFNode organizationNode = solution.get(fieldLabelToOutputFieldLabel.get("organization"));
|
||||
|
||||
if (organizationNode != null) {
|
||||
queryResult.addEntry(
|
||||
fieldLabelToOutputFieldLabel.get("organization"),
|
||||
organizationNode.toString());
|
||||
|
||||
return organizationNode.toString();
|
||||
|
||||
}
|
||||
|
||||
RDFNode organizationLabelNode = solution
|
||||
.get(fieldLabelToOutputFieldLabel.get("organizationLabel"));
|
||||
|
||||
if (organizationLabelNode != null) {
|
||||
queryResult.addEntry(
|
||||
fieldLabelToOutputFieldLabel.get("organizationLabel"),
|
||||
organizationLabelNode.toString());
|
||||
}
|
||||
|
||||
RDFNode numberOfChildrenNode = solution.getLiteral("numOfChildren");
|
||||
|
||||
if (numberOfChildrenNode != null) {
|
||||
queryResult.addEntry("numOfChildren", String
|
||||
.valueOf(numberOfChildrenNode.asLiteral().getInt()));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -350,7 +350,6 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
private VitroRequest vitroRequest;
|
||||
private Map<String, String> fieldLabelToOutputFieldLabel;
|
||||
private String topLevelURL = null;
|
||||
private GenericQueryMap queryResult = new GenericQueryMap();
|
||||
|
||||
HighetTopLevelOrgTemporalGraphURLConsumer(VitroRequest vitroRequest, Map<String, String> fieldLabelToOutputFieldLabel) {
|
||||
this.vitroRequest = vitroRequest;
|
||||
|
@ -366,8 +365,6 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
RDFNode organizationNode = qs.get(fieldLabelToOutputFieldLabel.get("organization"));
|
||||
|
||||
if (organizationNode != null) {
|
||||
queryResult.addEntry(fieldLabelToOutputFieldLabel.get("organization"), organizationNode.toString());
|
||||
|
||||
String individualLocalName = UtilityFunctions.getIndividualLocalName(organizationNode.toString(), vitroRequest);
|
||||
|
||||
if (StringUtils.isNotBlank(individualLocalName)) {
|
||||
|
@ -388,19 +385,6 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
|||
highestLevelOrganizationTemporalGraphVisURLParams);
|
||||
|
||||
}
|
||||
} else {
|
||||
RDFNode organizationLabelNode = qs.get(fieldLabelToOutputFieldLabel.get("organizationLabel"));
|
||||
|
||||
if (organizationLabelNode != null) {
|
||||
queryResult.addEntry(fieldLabelToOutputFieldLabel.get("organizationLabel"), organizationLabelNode.toString());
|
||||
}
|
||||
|
||||
RDFNode numberOfChildrenNode = qs.getLiteral("numOfChildren");
|
||||
|
||||
if (numberOfChildrenNode != null) {
|
||||
queryResult.addEntry("numOfChildren",
|
||||
String.valueOf(numberOfChildrenNode.asLiteral().getInt()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -102,12 +102,6 @@ public class CollaborationDataViewHelper {
|
|||
// Now add the person that is the focus to the start of the list
|
||||
collaborators.add(0, data.getEgoCollaborator());
|
||||
|
||||
// Generate a list of collaborator IDs for use in filling the matrix
|
||||
List<Integer> collabIDs = new ArrayList<Integer>(collaborators.size());
|
||||
for (Collaborator collaborator : collaborators) {
|
||||
collabIDs.add(collaborator.getCollaboratorID());
|
||||
}
|
||||
|
||||
// If we only want to visualize collaborations between the main focus and others, set this to false
|
||||
boolean fullMatrix = true;
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue