mirror of
https://github.com/DSpace/DSpace.git
synced 2025-10-18 07:23:08 +00:00
Fix dspace-api module per new code style
This commit is contained in:
@@ -7,6 +7,10 @@
|
||||
*/
|
||||
package org.dspace.health;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.dspace.content.Collection;
|
||||
import org.dspace.content.DSpaceObject;
|
||||
@@ -19,11 +23,6 @@ import org.dspace.eperson.factory.EPersonServiceFactory;
|
||||
import org.dspace.eperson.service.EPersonService;
|
||||
import org.dspace.eperson.service.GroupService;
|
||||
|
||||
import java.sql.SQLException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author LINDAT/CLARIN dev team
|
||||
*/
|
||||
@@ -31,10 +30,11 @@ public class UserCheck extends Check {
|
||||
|
||||
private static final EPersonService ePersonService = EPersonServiceFactory.getInstance().getEPersonService();
|
||||
private static final GroupService groupService = EPersonServiceFactory.getInstance().getGroupService();
|
||||
private static final CollectionService collectionService = ContentServiceFactory.getInstance().getCollectionService();
|
||||
private static final CollectionService collectionService = ContentServiceFactory.getInstance()
|
||||
.getCollectionService();
|
||||
|
||||
@Override
|
||||
public String run( ReportInfo ri ) {
|
||||
public String run(ReportInfo ri) {
|
||||
Context context = new Context();
|
||||
String ret = "";
|
||||
Map<String, Integer> info = new HashMap<String, Integer>();
|
||||
@@ -50,21 +50,28 @@ public class UserCheck extends Check {
|
||||
info.put("Self registered", 0);
|
||||
|
||||
for (EPerson e : epersons) {
|
||||
if (e.getEmail() != null && e.getEmail().length() > 0)
|
||||
if (e.getEmail() != null && e.getEmail().length() > 0) {
|
||||
info.put("Have email", info.get("Have email") + 1);
|
||||
if (e.canLogIn())
|
||||
}
|
||||
if (e.canLogIn()) {
|
||||
info.put("Can log in (password)",
|
||||
info.get("Can log in (password)") + 1);
|
||||
if (e.getFirstName() != null && e.getFirstName().length() > 0)
|
||||
info.get("Can log in (password)") + 1);
|
||||
}
|
||||
if (e.getFirstName() != null && e.getFirstName().length() > 0) {
|
||||
info.put("Have 1st name", info.get("Have 1st name") + 1);
|
||||
if (e.getLastName() != null && e.getLastName().length() > 0)
|
||||
}
|
||||
if (e.getLastName() != null && e.getLastName().length() > 0) {
|
||||
info.put("Have 2nd name", info.get("Have 2nd name") + 1);
|
||||
if (e.getLanguage() != null && e.getLanguage().length() > 0)
|
||||
}
|
||||
if (e.getLanguage() != null && e.getLanguage().length() > 0) {
|
||||
info.put("Have lang", info.get("Have lang") + 1);
|
||||
if (e.getNetid() != null && e.getNetid().length() > 0)
|
||||
}
|
||||
if (e.getNetid() != null && e.getNetid().length() > 0) {
|
||||
info.put("Have netid", info.get("Have netid") + 1);
|
||||
if (e.getNetid() != null && e.getNetid().length() > 0)
|
||||
}
|
||||
if (e.getNetid() != null && e.getNetid().length() > 0) {
|
||||
info.put("Self registered", info.get("Self registered") + 1);
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
@@ -78,7 +85,7 @@ public class UserCheck extends Check {
|
||||
for (Map.Entry<String, Integer> e : info.entrySet()) {
|
||||
if (!e.getKey().equals("Count") && !e.getKey().equals("Have email")) {
|
||||
ret += String.format("%-21s: %s\n", e.getKey(),
|
||||
String.valueOf(e.getValue()));
|
||||
String.valueOf(e.getValue()));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -89,7 +96,7 @@ public class UserCheck extends Check {
|
||||
List<Group> emptyGroups = groupService.getEmptyGroups(context);
|
||||
ret += String.format("Empty groups: #%d\n ", emptyGroups.size());
|
||||
for (Group group : emptyGroups) {
|
||||
ret += String.format("id=%s;name=%s,\n ", group.getID(), group.getName() );
|
||||
ret += String.format("id=%s;name=%s,\n ", group.getID(), group.getName());
|
||||
}
|
||||
|
||||
//subscribers
|
||||
@@ -113,11 +120,10 @@ public class UserCheck extends Check {
|
||||
return ret;
|
||||
}
|
||||
|
||||
private String formatIds(List<? extends DSpaceObject> objects){
|
||||
private String formatIds(List<? extends DSpaceObject> objects) {
|
||||
StringBuilder ids = new StringBuilder();
|
||||
for(DSpaceObject o : objects){
|
||||
ids.append(o.getID())
|
||||
.append(", ");
|
||||
for (DSpaceObject o : objects) {
|
||||
ids.append(o.getID()).append(", ");
|
||||
}
|
||||
return ids.toString();
|
||||
}
|
||||
|
Reference in New Issue
Block a user