Jean-Francois Leveque

Refactoring int -> Integer pour les Id et changement nommage pour contourner ambiguïté Author

......@@ -9,7 +9,7 @@ import javax.persistence.Lob;
public class IndexedPublisher {
@Id
@Field
private int publisherId;
private Integer publisherId;
@Field
private String publisherName;
@Lob
......@@ -32,7 +32,7 @@ public class IndexedPublisher {
//no args constructor to make it proxyable
}
public int getPublisherId() {
public Integer getPublisherId() {
return publisherId;
}
......@@ -44,7 +44,7 @@ public class IndexedPublisher {
return publisherHistory;
}
public void setPublisherId(int publisherId) {
public void setPublisherId(Integer publisherId) {
this.publisherId = publisherId;
}
......
......@@ -15,7 +15,7 @@ public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
// TODO Attention, en v2 Linkable implique Traceable (journalisable) qui devrait aussi être évalué
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int publisherId;
private Integer publisherId;
@OneToOne
private PublisherVersion validatedVersion;
......@@ -26,11 +26,11 @@ public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
@OneToMany(mappedBy = "publisher", fetch = FetchType.EAGER)
private Set<PublisherAction> actions;
public int getPublisherId() {
public Integer getPublisherId() {
return publisherId;
}
public void setPublisherId(int publisherId) {
public void setPublisherId(Integer publisherId) {
this.publisherId = publisherId;
}
......
......@@ -10,12 +10,12 @@ import java.sql.Timestamp;
public class PublisherAction {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int publisherActionId;
private Integer publisherActionId;
@Enumerated
private ActionType actionType;
@ManyToOne
private Account publisherActionAuthor;
private Account publisherActionActor;
@ManyToOne
private PublisherVersion publisherVersion;
......@@ -25,8 +25,8 @@ public class PublisherAction {
@ManyToOne
private Publisher publisher;
public void setPublisherActionAuthor(Account publisherActionAuthor) {
this.publisherActionAuthor = publisherActionAuthor;
public void setPublisherActionActor(Account publisherActionActor) {
this.publisherActionActor = publisherActionActor;
}
public void setPublisherActionDatetime(Timestamp publisherActionDatetime) {
......@@ -49,8 +49,8 @@ public class PublisherAction {
return actionType;
}
public Account getPublisherActionAuthor() {
return publisherActionAuthor;
public Account getPublisherActionActor() {
return publisherActionActor;
}
public PublisherVersion getPublisherVersion() {
......@@ -65,10 +65,18 @@ public class PublisherAction {
return publisher;
}
public Integer getPublisherActionId() {
return publisherActionId;
}
public void setPublisherActionId(Integer publisherActionId) {
this.publisherActionId = publisherActionId;
}
@Override
public String toString() {
return "publisherActionId = " + publisherActionId + ", actionType = " + actionType +
", publisherActionAuthor = " + publisherActionAuthor + ", publisherVersion = " + publisherVersion +
", publisherActionAuthor = " + publisherActionActor + ", publisherVersion = " + publisherVersion +
", publisherActionDatetime = " + publisherActionDatetime + ", publisher = " + publisher;
}
}
\ No newline at end of file
......
......@@ -12,7 +12,7 @@ import java.sql.Timestamp;
public class PublisherVersion {
@Id
@GeneratedValue(strategy = GenerationType.IDENTITY)
private int publisherVersionId;
private Integer publisherVersionId;
@ManyToOne
private Publisher publisher;
private String publisherName;
......@@ -29,7 +29,7 @@ public class PublisherVersion {
@Lob
private String publisherHistory;
@ManyToOne
private Account publisherVersionAuthor;
private Account publisherVersionCreator;
private Timestamp publisherVersionDatetime;
public Timestamp getPublisherVersionDatetime() {
......@@ -112,11 +112,11 @@ public class PublisherVersion {
this.publisherURL = publisherURL;
}
public int getPublisherVersionId() {
public Integer getPublisherVersionId() {
return publisherVersionId;
}
public void setPublisherVersionId(int publisherVersionId) {
public void setPublisherVersionId(Integer publisherVersionId) {
this.publisherVersionId = publisherVersionId;
}
......@@ -136,12 +136,12 @@ public class PublisherVersion {
this.publisherAddressCountry = publisherAddressCountry;
}
public Account getPublisherVersionAuthor() {
return publisherVersionAuthor;
public Account getPublisherVersionCreator() {
return publisherVersionCreator;
}
public void setPublisherVersionAuthor(Account publisherVersionAuthor) {
this.publisherVersionAuthor = publisherVersionAuthor;
public void setPublisherVersionCreator(Account publisherVersionCreator) {
this.publisherVersionCreator = publisherVersionCreator;
}
@Override
......@@ -151,7 +151,7 @@ public class PublisherVersion {
", Region = " + publisherAddressRegion + ", Ville = " + publisherAddressLocality + ", Pays = " +
publisherAddressCountry + ", Telephone = " + publisherTelephone + ", email = " + publisherEmail +
", URL = " + publisherURL + ", History = " + publisherHistory +
", Version Author = " + publisherVersionAuthor + ", Version DateTime = " + publisherVersionDatetime;
", Version Author = " + publisherVersionCreator + ", Version DateTime = " + publisherVersionDatetime;
}
public Publisher getPublisher() {
......
......@@ -83,7 +83,7 @@ public class ListPublisherVersionsView implements Serializable {
*/
protected void filterOnID() {
publisherVersions = publisherVersions.stream()
.filter(version -> version.getPublisher().getPublisherId() == publisherId)
.filter(version -> version.getPublisher().getPublisherId().equals(publisherId))
.collect(Collectors.toList());
}
......
......@@ -58,7 +58,7 @@ public class PublisherServiceDefault implements PublisherService {
publisherVersions.add(publisherVersion);
publisher.setVersions(publisherVersions);
publisherVersion.setPublisher(publisher);
publisherVersion.setPublisherVersionAuthor(sharedService.getCurrentUser());
publisherVersion.setPublisherVersionCreator(sharedService.getCurrentUser());
publisherVersion.setPublisherVersionDatetime(new Timestamp(new Date().getTime()));
this.savePublisherVersion(publisherVersion);
this.savePublisher(publisher);
......@@ -72,7 +72,7 @@ public class PublisherServiceDefault implements PublisherService {
publisherVersionSet.add(publisherVersion);
publisher.setVersions(publisherVersionSet);
publisherVersion.setPublisher(publisher);
publisherVersion.setPublisherVersionAuthor(sharedService.getCurrentUser());
publisherVersion.setPublisherVersionCreator(sharedService.getCurrentUser());
publisherVersion.setPublisherVersionDatetime(new Timestamp(new Date().getTime()));
this.savePublisherVersion(publisherVersion);
this.savePublisher(publisher);
......@@ -85,7 +85,7 @@ public class PublisherServiceDefault implements PublisherService {
Publisher publisher = publisherVersion.getPublisher();
publisher.setValidatedVersion(publisherVersion);
PublisherAction publisherAction = new PublisherAction();
publisherAction.setPublisherActionAuthor(sharedService.getCurrentUser());
publisherAction.setPublisherActionActor(sharedService.getCurrentUser());
publisherAction.setPublisherActionDatetime(new Timestamp(new Date().getTime()));
publisherAction.setActionType(ActionType.VALIDATE);
publisherAction.setPublisherVersion(publisherVersion);
......
......@@ -199,7 +199,7 @@ public class PublisherVersionView implements Serializable {
if (publisherVersion == null) {
throw new IllegalStateException("Publisher version not found");
}
publisherVersionAuthor = publisherVersion.getPublisherVersionAuthor();
publisherVersionAuthor = publisherVersion.getPublisherVersionCreator();
publisherVersionDatetime = publisherVersion.getPublisherVersionDatetime();
}
......
......@@ -21,7 +21,7 @@
</h:column>
<h:column>
<f:facet name="header"/>
${action.publisherActionAuthor.displayName}
${action.publisherActionActor.displayName}
</h:column>
<h:column>
<f:facet name="header"/>
......@@ -57,7 +57,7 @@
</h:column>
<h:column>
<f:facet name="header">Version Author</f:facet>
${action.publisherVersion.publisherVersionAuthor.displayName}
${action.publisherVersion.publisherVersionCreator.displayName}
</h:column>
<h:column>
<f:facet name="header">Version Datetime</f:facet>
......
......@@ -41,7 +41,7 @@
<h:column>
<f:facet name="header"/>
<div jsf:rendered="#{version.publisherVersionId == version.publisher.validatedVersion.publisherVersionId}">
${listPublisherVersionsView.getLastValidate(version.publisher).publisherActionAuthor.displayName}
${listPublisherVersionsView.getLastValidate(version.publisher).publisherActionActor.displayName}
</div>
</h:column>
<h:column>
......@@ -80,7 +80,7 @@
</h:column>
<h:column>
<f:facet name="header">Version Author</f:facet>
${version.publisherVersionAuthor.displayName}
${version.publisherVersionCreator.displayName}
</h:column>
<h:column>
<f:facet name="header">Version Datetime</f:facet>
......
......@@ -59,7 +59,7 @@
</h:column>
<h:column>
<f:facet name="header"/>
${action.publisherActionAuthor.displayName}
${action.publisherActionActor.displayName}
</h:column>
<h:column>
<f:facet name="header"/>
......
......@@ -55,8 +55,8 @@ public class ListPublisherVersionsViewTest {
publisherVersion2.setPublisherVersionId(2);
publisher = new Publisher();
publisher1 = new Publisher();
publisher.setPublisherId(0);
publisher1.setPublisherId(1);
publisher.setPublisherId(new Integer(0));
publisher1.setPublisherId(new Integer(1));
publisherVersion.setPublisher(publisher);
publisherVersion1.setPublisher(publisher1);
publisherVersion2.setPublisher(publisher);
......