Commit 6861409a authored by Maxym Borodenko's avatar Maxym Borodenko Committed by Matija Obreza
Browse files

Remove unused code

parent a3a8c8e6
...@@ -37,7 +37,7 @@ public class BasicModel extends EmptyModel { ...@@ -37,7 +37,7 @@ public class BasicModel extends EmptyModel {
@Id @Id
@GeneratedValue(strategy = GenerationType.IDENTITY) @GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "id", unique = true, nullable = false) @Column(name = "id", unique = true, nullable = false)
private Long id = null; // InMemoryIdGenerator.nextId(); private Long id = null;
/* /*
* (non-Javadoc) * (non-Javadoc)
......
/*
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys.blocks.model;
import java.util.concurrent.atomic.AtomicLong;
/**
* The Class InMemoryIdGenerator.
*/
public class InMemoryIdGenerator {
/** The Constant id. */
private static final AtomicLong id = new AtomicLong(-1l);
/**
* Next id.
*
* @return the long
*/
public static long nextId() {
// LOG.trace("Next random id will be " + (id.get() - 1));
return id.decrementAndGet();
}
}
/*
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys.blocks.model;
import java.io.Serializable;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import javax.persistence.PrePersist;
import javax.persistence.Version;
import com.fasterxml.jackson.annotation.JsonView;
/**
* The Class VersionedModelWithoutId.
*/
@MappedSuperclass
public abstract class VersionedModelWithoutId implements Serializable, Activatable {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = 292945663251323045L;
/** The version. */
@JsonView({ JsonViews.Update.class, JsonViews.Protected.class })
@Version
@Column(nullable = false)
Integer version = null;
/** Active by default!. */
@Column(nullable = false)
protected boolean active = VersionedModel.DEFAULT_ACTIVE_VALUE;
/**
* First persisted version is 1
*/
@PrePersist
private void prepersistVersionedModel() {
version = 1;
}
/**
* Gets the version.
*
* @return the version
*/
public Integer getVersion() {
return version;
}
/**
* Sets the version.
*
* @param version the new version
*/
public void setVersion(final Integer version) {
this.version = version;
}
/*
* (non-Javadoc)
* @see org.genesys.blocks.model.Activatable#isActive()
*/
@Override
public boolean isActive() {
return active;
}
/**
* Sets the active.
*
* @param active the new active
*/
public void setActive(final boolean active) {
this.active = active;
}
/*
* (non-Javadoc)
* @see java.lang.Object#hashCode()
*/
@Override
public int hashCode() {
final int prime = 31;
int result = 1;
result = (prime * result) + ((version == null) ? 0 : version.hashCode());
return result;
}
/*
* (non-Javadoc)
* @see java.lang.Object#equals(java.lang.Object)
*/
@Override
public boolean equals(final Object obj) {
if (this == obj)
return true;
if (obj == null)
return false;
if (getClass() != obj.getClass())
return false;
final VersionedModelWithoutId other = (VersionedModelWithoutId) obj;
if (version == null) {
if (other.version != null)
return false;
} else if (!version.equals(other.version))
return false;
return true;
}
}
/*
* Copyright 2018 Global Crop Diversity Trust
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.genesys.blocks.model;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.MappedSuperclass;
import org.genesys.blocks.util.JsonSidConverter;
import org.springframework.data.annotation.CreatedBy;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedBy;
import org.springframework.data.annotation.LastModifiedDate;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonProperty.Access;
import com.fasterxml.jackson.annotation.JsonView;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
/**
* The Class AuditedVersionedModelWithoutId.
*/
@MappedSuperclass
public abstract class AuditedVersionedModelWithoutId extends VersionedModelWithoutId {
/** The Constant serialVersionUID. */
private static final long serialVersionUID = -7370145391469993768L;
/** The created by. */
@JsonView(JsonViews.Protected.class)
@CreatedBy
@Column(updatable = false)
@JsonSerialize(converter = JsonSidConverter.class)
@JsonProperty(access = Access.READ_ONLY)
private Long createdBy;
/** The created date. */
@JsonView(JsonViews.Public.class)
@CreatedDate
@Column(name = "createdDate", updatable = false)
private Date createdDate;
/** The last modified by. */
@JsonView(JsonViews.Protected.class)
@LastModifiedBy
@JsonSerialize(converter = JsonSidConverter.class)
@JsonProperty(access = Access.READ_ONLY)
private Long lastModifiedBy;
/** The last modified date. */
@JsonView(JsonViews.Public.class)
@LastModifiedDate
@Column(name = "lastModifiedDate")
private Date lastModifiedDate;
/**
* Gets the created by.
*
* @return the created by
*/
public Long getCreatedBy() {
return createdBy;
}
/**
* Sets the created by.
*
* @param createdBy the new created by
*/
public void setCreatedBy(final Long createdBy) {
this.createdBy = createdBy;
}
/**
* Gets the created date.
*
* @return the created date
*/
public Date getCreatedDate() {
return createdDate;
}
/**
* Sets the created date.
*
* @param createdDate the new created date
*/
public void setCreatedDate(final Date createdDate) {
this.createdDate = createdDate;
}
/**
* Gets the last modified by.
*
* @return the last modified by
*/
public Long getLastModifiedBy() {
return lastModifiedBy;
}
/**
* Sets the last modified by.
*
* @param lastModifiedBy the new last modified by
*/
public void setLastModifiedBy(final Long lastModifiedBy) {
this.lastModifiedBy = lastModifiedBy;
}
/**
* Gets the last modified date.
*
* @return the last modified date
*/
public Date getLastModifiedDate() {
return lastModifiedDate;
}
/**
* Sets the last modified date.
*
* @param lastModifiedDate the new last modified date
*/
public void setLastModifiedDate(final Date lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment