Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
made some changes to adhere to the sonar rules
  • Loading branch information
fasseg committed Jun 5, 2013
1 parent 6ea778d commit f8efb62
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 18 deletions.
Expand Up @@ -24,27 +24,27 @@
*
*/
@Entity
@Table(name="FIXITY_STATS")
@XmlRootElement(name="statistics",namespace=FixityService.FIXITY_NAMESPACE)
@Table(name = "FIXITY_STATS")
@XmlRootElement(name = "statistics", namespace = FixityService.FIXITY_NAMESPACE)
@XmlAccessorType(XmlAccessType.FIELD)
public class DailyStatistics {

@Id
@GeneratedValue
@XmlAttribute(name="id")
@XmlAttribute(name = "id")
private long statisticId;

@XmlAttribute(name="success-count")
@XmlAttribute(name = "success-count")
private long successCount;

@XmlAttribute(name="error-count")
@XmlAttribute(name = "error-count")
private long errorCount;

@XmlAttribute(name="repair-count")
@XmlAttribute(name = "repair-count")
private long repairCount;

@Temporal(TemporalType.DATE)
@XmlAttribute(name="date")
@XmlAttribute(name = "date")
private Date statisticsDate;

public Date getStatisticsDate() {
Expand Down Expand Up @@ -79,4 +79,12 @@ public void setRepairCount(long repairCount) {
this.repairCount = repairCount;
}

public long getStatisticId() {
return statisticId;
}

public void setStatisticId(long statisticId) {
this.statisticId = statisticId;
}

}
Expand Up @@ -35,12 +35,14 @@
@XmlAccessorType(XmlAccessType.FIELD)
public class ObjectFixityResult {

private static final String COLUMN_OBJECT_FIXITY_ID = "OBJECT_FIXITY_ID";

public static enum FixityResult {
SUCCESS, ERROR, REPAIRED;
}
@Id
@GeneratedValue
@Column(name = "OBJECT_FIXITY_ID")
@Column(name = COLUMN_OBJECT_FIXITY_ID)
@XmlAttribute(name = "id")
private long resultId;

Expand All @@ -57,17 +59,17 @@ public static enum FixityResult {
private Date timeStamp;

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name="OBJECT_FIXITY_ID")
@JoinColumn(name=COLUMN_OBJECT_FIXITY_ID)
@XmlElement(name="successes",namespace=FixityService.FIXITY_NAMESPACE,type=ArrayList.class)
private List<DatastreamFixitySuccess> successes;

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name="OBJECT_FIXITY_ID")
@JoinColumn(name=COLUMN_OBJECT_FIXITY_ID)
@XmlElement(name="errors",namespace=FixityService.FIXITY_NAMESPACE,type=ArrayList.class)
private List<DatastreamFixityError> errors;

@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.EAGER)
@JoinColumn(name="OBJECT_FIXITY_ID")
@JoinColumn(name=COLUMN_OBJECT_FIXITY_ID)
@XmlElement(name="repairs",namespace=FixityService.FIXITY_NAMESPACE,type=ArrayList.class)
private List<DatastreamFixityRepaired> repairs;

Expand Down
Expand Up @@ -67,7 +67,7 @@ public void setFedoraFolderUri(String fedoraFolderUri) {
}

@PostConstruct
private void afterPropertiesSet() throws IllegalStateException {
public void afterPropertiesSet() throws IllegalStateException {
if (fedoraFolderUri == null) {
throw new IllegalStateException(
"fedoraFolderUri property has to be set via spring configuration or the system property 'org.fcrepo.fixity.fcrepo.url' to e.g. 'http://{fedora-host}:{port}/rest/objects");
Expand All @@ -78,17 +78,20 @@ private void afterPropertiesSet() throws IllegalStateException {
* Queue a List of object URIs for fixity checks
* @param uri the uri of the object to queue
*/
public void queueFixityChecks(List<String> uris) throws IOException {
if (uris == null) {
public void queueFixityChecks(final List<String> uris) throws IOException {
List<String> queueElements = uris;
if (queueElements == null) {
/* no pid was given, so queue all objects */
uris = fixityClient.retrieveUris(this.fedoraFolderUri);
if (uris == null) {
queueElements = fixityClient.retrieveUris(this.fedoraFolderUri);
if (queueElements == null) {
logger.warn("Fixity check was requested for all objects, but no objects could be discovered in the repository at " +
this.fedoraFolderUri);
return;
}
}else{
queueElements = uris;
}
for (String uri : uris) {
for (String uri : queueElements) {
this.queueFixityCheck(uri);
}
}
Expand Down
Expand Up @@ -41,7 +41,7 @@ public FixityJaxbContextResolver() {
DatastreamFixitySuccess.class,
ObjectFixityResult.class);
} catch (JAXBException e) {
throw new RuntimeException("Not able to instantiate Jaxb context");
throw new IllegalStateException("Not able to instantiate Jaxb context",e);
}
}

Expand Down

0 comments on commit f8efb62

Please sign in to comment.