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();
|
StringBuilder progressSinceLastCheck = new StringBuilder();
|
||||||
for(int i = 0; i < unsentLogLines.length; i++) {
|
for (String unsentLogLine : unsentLogLines) {
|
||||||
progressSinceLastCheck.append(unsentLogLines[i]).append(newline);
|
progressSinceLastCheck.append(unsentLogLine).append(newline);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean finished = sessionInfo.isFinished();
|
boolean finished = sessionInfo.isFinished();
|
||||||
|
|
|
@ -173,12 +173,12 @@ class Harvester {
|
||||||
*/
|
*/
|
||||||
public static String[] stringsToArray(Object ... args) {
|
public static String[] stringsToArray(Object ... args) {
|
||||||
ArrayList<String> allData = new ArrayList<String>();
|
ArrayList<String> allData = new ArrayList<String>();
|
||||||
for(int i = 0; i < args.length; i++) {
|
for (Object arg : args) {
|
||||||
if(args[i] instanceof String[]) {
|
if (arg instanceof String[]) {
|
||||||
String[] array = (String[])(args[i]);
|
String[] array = (String[]) (arg);
|
||||||
Collections.addAll(allData, array);
|
Collections.addAll(allData, array);
|
||||||
} else {
|
} else {
|
||||||
allData.add(args[i].toString());
|
allData.add(arg.toString());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return allData.toArray(new String[allData.size()]);
|
return allData.toArray(new String[allData.size()]);
|
||||||
|
|
|
@ -27,40 +27,14 @@ import edu.cornell.mannlib.vitro.webapp.visualization.visutils.QueryRunner;
|
||||||
|
|
||||||
public class OrganizationUtilityFunctions {
|
public class OrganizationUtilityFunctions {
|
||||||
|
|
||||||
public static String getHighestLevelOrganizationURI(ResultSet resultSet,
|
public static String getHighestLevelOrganizationURI(ResultSet resultSet, Map<String, String> fieldLabelToOutputFieldLabel) {
|
||||||
Map<String, String> fieldLabelToOutputFieldLabel) {
|
|
||||||
|
|
||||||
GenericQueryMap queryResult = new GenericQueryMap();
|
|
||||||
|
|
||||||
while (resultSet.hasNext()) {
|
while (resultSet.hasNext()) {
|
||||||
QuerySolution solution = resultSet.nextSolution();
|
QuerySolution solution = resultSet.nextSolution();
|
||||||
|
|
||||||
RDFNode organizationNode = solution
|
RDFNode organizationNode = solution.get(fieldLabelToOutputFieldLabel.get("organization"));
|
||||||
.get(fieldLabelToOutputFieldLabel.get("organization"));
|
|
||||||
|
|
||||||
if (organizationNode != null) {
|
if (organizationNode != null) {
|
||||||
queryResult.addEntry(
|
|
||||||
fieldLabelToOutputFieldLabel.get("organization"),
|
|
||||||
organizationNode.toString());
|
|
||||||
|
|
||||||
return 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 VitroRequest vitroRequest;
|
||||||
private Map<String, String> fieldLabelToOutputFieldLabel;
|
private Map<String, String> fieldLabelToOutputFieldLabel;
|
||||||
private String topLevelURL = null;
|
private String topLevelURL = null;
|
||||||
private GenericQueryMap queryResult = new GenericQueryMap();
|
|
||||||
|
|
||||||
HighetTopLevelOrgTemporalGraphURLConsumer(VitroRequest vitroRequest, Map<String, String> fieldLabelToOutputFieldLabel) {
|
HighetTopLevelOrgTemporalGraphURLConsumer(VitroRequest vitroRequest, Map<String, String> fieldLabelToOutputFieldLabel) {
|
||||||
this.vitroRequest = vitroRequest;
|
this.vitroRequest = vitroRequest;
|
||||||
|
@ -366,8 +365,6 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
||||||
RDFNode organizationNode = qs.get(fieldLabelToOutputFieldLabel.get("organization"));
|
RDFNode organizationNode = qs.get(fieldLabelToOutputFieldLabel.get("organization"));
|
||||||
|
|
||||||
if (organizationNode != null) {
|
if (organizationNode != null) {
|
||||||
queryResult.addEntry(fieldLabelToOutputFieldLabel.get("organization"), organizationNode.toString());
|
|
||||||
|
|
||||||
String individualLocalName = UtilityFunctions.getIndividualLocalName(organizationNode.toString(), vitroRequest);
|
String individualLocalName = UtilityFunctions.getIndividualLocalName(organizationNode.toString(), vitroRequest);
|
||||||
|
|
||||||
if (StringUtils.isNotBlank(individualLocalName)) {
|
if (StringUtils.isNotBlank(individualLocalName)) {
|
||||||
|
@ -388,19 +385,6 @@ public class UtilitiesRequestHandler implements VisualizationRequestHandler {
|
||||||
highestLevelOrganizationTemporalGraphVisURLParams);
|
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
|
// Now add the person that is the focus to the start of the list
|
||||||
collaborators.add(0, data.getEgoCollaborator());
|
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
|
// If we only want to visualize collaborations between the main focus and others, set this to false
|
||||||
boolean fullMatrix = true;
|
boolean fullMatrix = true;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue