Minor code improvements

This commit is contained in:
Graham Triggs 2017-09-18 11:50:07 +01:00
parent 2e7355fddf
commit 43dea89dae
8 changed files with 15 additions and 63 deletions

View file

@ -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();

View file

@ -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()]);

View file

@ -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()));
}
}

View file

@ -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()));
}
}
}

View file

@ -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;

View file

@ -4,7 +4,7 @@
# It's not very important, because the tests themselves will override this
# configuration in AbstractTestClass.initializeLogging().
#
log4j.rootLogger=WARN, AllAppender
log4j.appender.AllAppender=org.apache.log4j.ConsoleAppender
log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.AllAppender.layout.ConversionPattern=%p %t %c - %m%n
log4j.rootLogger=WARN, AllAppender
log4j.appender.AllAppender=org.apache.log4j.ConsoleAppender
log4j.appender.AllAppender.layout=org.apache.log4j.PatternLayout
log4j.appender.AllAppender.layout.ConversionPattern=%p %t %c - %m%n

View file

@ -334,7 +334,7 @@ http.createCacheHeaders = true
# VIVO 1.3 release mitigates this problem by the way of a caching mechanism &
# hence we can safely set this to be enabled by default.
#
visualization.temporal = enabled
visualization.temporal = enabled
#
# Types of individual for which we can create proxy editors.
@ -354,4 +354,4 @@ Vitro.reconcile.defaultTypeList = http://vivoweb.org/ontology/core#Role, core:Ro
http://vivoweb.org/ontology/core#Location, core:Location; \
http://xmlns.com/foaf/0.1/Organization, foaf:Organization; \
http://xmlns.com/foaf/0.1/Person, foaf:Person; \
http://purl.obolibrary.org/obo/IAO_0000030, obo:IAO_0000030
http://purl.obolibrary.org/obo/IAO_0000030, obo:IAO_0000030

View file

@ -10,7 +10,7 @@ source_dir = ../../
# (if relative, then relative to this file)
target_dir =
# A list of filename globs that match the files we want to license,
# A list of filename globs that match the files we want to license,
# delimited by commas with optional white-space.
file_matchers = *.java, *.jsp, *.tld, *.xsl, *.xslt, *.css, *.js, *.ftl, *.xml