mirror of
https://github.com/ebean-orm/ebean.git
synced 2026-11-03 00:23:24 +00:00
Change license to Apache2 and reformat
This commit is contained in:
1 parent
96ce4c0ddf
commit
7aae897def
560 files changed
+73292
-85907
No files matched your search
@@ -1,73 +1,54 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class CKeyDetail {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
@ManyToOne
|
||||
// @JoinColumns({
|
||||
// @JoinColumn(name="parent_one_key", referencedColumnName="one_key"),
|
||||
// @JoinColumn(name="parent_two_key", referencedColumnName="two_key")
|
||||
// })
|
||||
CKeyParent parent;
|
||||
|
||||
public CKeyDetail(){
|
||||
|
||||
}
|
||||
public CKeyDetail(String something){
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
public CKeyParent getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(CKeyParent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class CKeyDetail {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
@ManyToOne
|
||||
// @JoinColumns({
|
||||
// @JoinColumn(name="parent_one_key", referencedColumnName="one_key"),
|
||||
// @JoinColumn(name="parent_two_key", referencedColumnName="two_key")
|
||||
// })
|
||||
CKeyParent parent;
|
||||
|
||||
public CKeyDetail(){
|
||||
|
||||
}
|
||||
public CKeyDetail(String something){
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
public CKeyParent getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(CKeyParent parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,96 +1,77 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Version;
|
||||
|
||||
@Entity
|
||||
public class CKeyParent {
|
||||
|
||||
@EmbeddedId
|
||||
CKeyParentId id;
|
||||
|
||||
String name;
|
||||
|
||||
@Version
|
||||
int version;
|
||||
|
||||
@ManyToOne(cascade=CascadeType.PERSIST)
|
||||
CKeyAssoc assoc;
|
||||
|
||||
@OneToMany(cascade=CascadeType.PERSIST, mappedBy="parent")
|
||||
List<CKeyDetail> details;
|
||||
|
||||
public CKeyParentId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(CKeyParentId id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public CKeyAssoc getAssoc() {
|
||||
return assoc;
|
||||
}
|
||||
|
||||
public void setAssoc(CKeyAssoc assoc) {
|
||||
this.assoc = assoc;
|
||||
}
|
||||
|
||||
public List<CKeyDetail> getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(List<CKeyDetail> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public void add(CKeyDetail detail) {
|
||||
if (details == null){
|
||||
details = new ArrayList<CKeyDetail>();
|
||||
}
|
||||
details.add(detail);
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import javax.persistence.CascadeType;
|
||||
import javax.persistence.EmbeddedId;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.ManyToOne;
|
||||
import javax.persistence.OneToMany;
|
||||
import javax.persistence.Version;
|
||||
|
||||
@Entity
|
||||
public class CKeyParent {
|
||||
|
||||
@EmbeddedId
|
||||
CKeyParentId id;
|
||||
|
||||
String name;
|
||||
|
||||
@Version
|
||||
int version;
|
||||
|
||||
@ManyToOne(cascade=CascadeType.PERSIST)
|
||||
CKeyAssoc assoc;
|
||||
|
||||
@OneToMany(cascade=CascadeType.PERSIST, mappedBy="parent")
|
||||
List<CKeyDetail> details;
|
||||
|
||||
public CKeyParentId getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(CKeyParentId id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(int version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
public CKeyAssoc getAssoc() {
|
||||
return assoc;
|
||||
}
|
||||
|
||||
public void setAssoc(CKeyAssoc assoc) {
|
||||
this.assoc = assoc;
|
||||
}
|
||||
|
||||
public List<CKeyDetail> getDetails() {
|
||||
return details;
|
||||
}
|
||||
|
||||
public void setDetails(List<CKeyDetail> details) {
|
||||
this.details = details;
|
||||
}
|
||||
|
||||
public void add(CKeyDetail detail) {
|
||||
if (details == null){
|
||||
details = new ArrayList<CKeyDetail>();
|
||||
}
|
||||
details.add(detail);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,71 +1,52 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class CKeyParentId {
|
||||
|
||||
Integer oneKey;
|
||||
String twoKey;
|
||||
|
||||
public CKeyParentId() {
|
||||
|
||||
}
|
||||
public CKeyParentId(Integer oneKey, String twoKey){
|
||||
this.oneKey = oneKey;
|
||||
this.twoKey = twoKey;
|
||||
}
|
||||
|
||||
public Integer getOneKey() {
|
||||
return oneKey;
|
||||
}
|
||||
public void setOneKey(Integer oneKey) {
|
||||
this.oneKey = oneKey;
|
||||
}
|
||||
public String getTwoKey() {
|
||||
return twoKey;
|
||||
}
|
||||
public void setTwoKey(String twoKey) {
|
||||
this.twoKey = twoKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o){
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof CKeyParentId)){
|
||||
return false;
|
||||
}
|
||||
|
||||
CKeyParentId otherKey = (CKeyParentId) o;
|
||||
return otherKey.hashCode() == hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(){
|
||||
int hc = getClass().getName().hashCode();
|
||||
hc = 31 * hc + oneKey;
|
||||
hc = 31 * hc + twoKey.hashCode();
|
||||
return hc;
|
||||
}
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Embeddable;
|
||||
|
||||
@Embeddable
|
||||
public class CKeyParentId {
|
||||
|
||||
Integer oneKey;
|
||||
String twoKey;
|
||||
|
||||
public CKeyParentId() {
|
||||
|
||||
}
|
||||
public CKeyParentId(Integer oneKey, String twoKey){
|
||||
this.oneKey = oneKey;
|
||||
this.twoKey = twoKey;
|
||||
}
|
||||
|
||||
public Integer getOneKey() {
|
||||
return oneKey;
|
||||
}
|
||||
public void setOneKey(Integer oneKey) {
|
||||
this.oneKey = oneKey;
|
||||
}
|
||||
public String getTwoKey() {
|
||||
return twoKey;
|
||||
}
|
||||
public void setTwoKey(String twoKey) {
|
||||
this.twoKey = twoKey;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o){
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof CKeyParentId)){
|
||||
return false;
|
||||
}
|
||||
|
||||
CKeyParentId otherKey = (CKeyParentId) o;
|
||||
return otherKey.hashCode() == hashCode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode(){
|
||||
int hc = getClass().getName().hashCode();
|
||||
hc = 31 * hc + oneKey;
|
||||
hc = 31 * hc + twoKey.hashCode();
|
||||
return hc;
|
||||
}
|
||||
}
|
||||
@@ -1,63 +1,44 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class ContactNote extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = 7949702621226333278L;
|
||||
|
||||
@ManyToOne
|
||||
Contact contact;
|
||||
|
||||
String title;
|
||||
|
||||
@Lob
|
||||
String note;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Lob;
|
||||
import javax.persistence.ManyToOne;
|
||||
|
||||
@Entity
|
||||
public class ContactNote extends BasicDomain {
|
||||
|
||||
private static final long serialVersionUID = 7949702621226333278L;
|
||||
|
||||
@ManyToOne
|
||||
Contact contact;
|
||||
|
||||
String title;
|
||||
|
||||
@Lob
|
||||
String note;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public Contact getContact() {
|
||||
return contact;
|
||||
}
|
||||
|
||||
public void setContact(Contact contact) {
|
||||
this.contact = contact;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,51 +1,32 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import org.joda.time.LocalTime;
|
||||
|
||||
@Entity
|
||||
public class TJodaEntity {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
LocalTime localTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalTime getLocalTime() {
|
||||
return localTime;
|
||||
}
|
||||
|
||||
public void setLocalTime(LocalTime localTime) {
|
||||
this.localTime = localTime;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import org.joda.time.LocalTime;
|
||||
|
||||
@Entity
|
||||
public class TJodaEntity {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
LocalTime localTime;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public LocalTime getLocalTime() {
|
||||
return localTime;
|
||||
}
|
||||
|
||||
public void setLocalTime(LocalTime localTime) {
|
||||
this.localTime = localTime;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +1,30 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TruckRef {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.basic;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
|
||||
@Entity
|
||||
public class TruckRef {
|
||||
|
||||
@Id
|
||||
Integer id;
|
||||
|
||||
String something;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSomething() {
|
||||
return something;
|
||||
}
|
||||
|
||||
public void setSomething(String something) {
|
||||
this.something = something;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,66 +1,47 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.ddd;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Version;
|
||||
|
||||
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
|
||||
import com.avaje.tests.model.ivo.Oid;
|
||||
|
||||
@Entity
|
||||
public class DExhEntity {
|
||||
|
||||
@Id
|
||||
Oid<DExhEntity> oid;
|
||||
|
||||
ExhangeCMoneyRate exhange;
|
||||
|
||||
@Version
|
||||
Timestamp lastUpdated;
|
||||
|
||||
public Oid<DExhEntity> getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setOid(Oid<DExhEntity> oid) {
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public ExhangeCMoneyRate getExhange() {
|
||||
return exhange;
|
||||
}
|
||||
|
||||
public void setExhange(ExhangeCMoneyRate exhange) {
|
||||
this.exhange = exhange;
|
||||
}
|
||||
|
||||
public Timestamp getLastUpdated() {
|
||||
return lastUpdated;
|
||||
}
|
||||
|
||||
public void setLastUpdated(Timestamp lastUpdated) {
|
||||
this.lastUpdated = lastUpdated;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ddd;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.Id;
|
||||
import javax.persistence.Version;
|
||||
|
||||
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
|
||||
import com.avaje.tests.model.ivo.Oid;
|
||||
|
||||
@Entity
|
||||
public class DExhEntity {
|
||||
|
||||
@Id
|
||||
Oid<DExhEntity> oid;
|
||||
|
||||
ExhangeCMoneyRate exhange;
|
||||
|
||||
@Version
|
||||
Timestamp lastUpdated;
|
||||
|
||||
public Oid<DExhEntity> getOid() {
|
||||
return oid;
|
||||
}
|
||||
|
||||
public void setOid(Oid<DExhEntity> oid) {
|
||||
this.oid = oid;
|
||||
}
|
||||
|
||||
public ExhangeCMoneyRate getExhange() {
|
||||
return exhange;
|
||||
}
|
||||
|
||||
public void setExhange(ExhangeCMoneyRate exhange) {
|
||||
this.exhange = exhange;
|
||||
}
|
||||
|
||||
public Timestamp getLastUpdated() {
|
||||
return lastUpdated;
|
||||
}
|
||||
|
||||
public void setLastUpdated(Timestamp lastUpdated) {
|
||||
this.lastUpdated = lastUpdated;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,49 +1,30 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.ivo;
|
||||
|
||||
import com.avaje.ebeaninternal.server.type.reflect.KnownImmutable;
|
||||
|
||||
public class SimpleKnownImmutable implements KnownImmutable {
|
||||
|
||||
public boolean isKnownImmutable(Class<?> cls) {
|
||||
|
||||
// Check for all allowed property types...
|
||||
if (cls.isPrimitive() || String.class.equals(cls) || Object.class.equals(cls)) {
|
||||
return true;
|
||||
}
|
||||
if (java.util.Date.class.equals(cls) || java.sql.Date.class.equals(cls) || java.sql.Timestamp.class.equals(cls)) {
|
||||
// treat as immutable even through they are not strictly so
|
||||
return true;
|
||||
}
|
||||
if (java.math.BigDecimal.class.equals(cls) || java.math.BigInteger.class.equals(cls)) {
|
||||
// treat as immutable (contain non-final fields)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Integer.class.equals(cls) || Long.class.equals(cls) || Double.class.equals(cls) || Float.class.equals(cls)
|
||||
|| Short.class.equals(cls) || Byte.class.equals(cls) || Character.class.equals(cls)
|
||||
|| Boolean.class.equals(cls)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
package com.avaje.tests.model.ivo;
|
||||
|
||||
import com.avaje.ebeaninternal.server.type.reflect.KnownImmutable;
|
||||
|
||||
public class SimpleKnownImmutable implements KnownImmutable {
|
||||
|
||||
public boolean isKnownImmutable(Class<?> cls) {
|
||||
|
||||
// Check for all allowed property types...
|
||||
if (cls.isPrimitive() || String.class.equals(cls) || Object.class.equals(cls)) {
|
||||
return true;
|
||||
}
|
||||
if (java.util.Date.class.equals(cls) || java.sql.Date.class.equals(cls) || java.sql.Timestamp.class.equals(cls)) {
|
||||
// treat as immutable even through they are not strictly so
|
||||
return true;
|
||||
}
|
||||
if (java.math.BigDecimal.class.equals(cls) || java.math.BigInteger.class.equals(cls)) {
|
||||
// treat as immutable (contain non-final fields)
|
||||
return true;
|
||||
}
|
||||
|
||||
if (Integer.class.equals(cls) || Long.class.equals(cls) || Double.class.equals(cls) || Float.class.equals(cls)
|
||||
|| Short.class.equals(cls) || Byte.class.equals(cls) || Character.class.equals(cls)
|
||||
|| Boolean.class.equals(cls)) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -1,34 +1,15 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.ivo;
|
||||
|
||||
public class SysTime {
|
||||
|
||||
private final long millis;
|
||||
|
||||
public SysTime(long millis){
|
||||
this.millis = millis;
|
||||
}
|
||||
|
||||
public long getMillis() {
|
||||
return millis;
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ivo;
|
||||
|
||||
public class SysTime {
|
||||
|
||||
private final long millis;
|
||||
|
||||
public SysTime(long millis){
|
||||
this.millis = millis;
|
||||
}
|
||||
|
||||
public long getMillis() {
|
||||
return millis;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,73 +1,54 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import com.avaje.ebean.config.CompoundType;
|
||||
import com.avaje.ebean.config.CompoundTypeProperty;
|
||||
import com.avaje.tests.model.ivo.CMoney;
|
||||
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
|
||||
import com.avaje.tests.model.ivo.Rate;
|
||||
|
||||
public class ExhangeCompoundType implements CompoundType<ExhangeCMoneyRate> {
|
||||
|
||||
public ExhangeCMoneyRate create(Object[] propertyValues) {
|
||||
return new ExhangeCMoneyRate((Rate)propertyValues[0], (CMoney)propertyValues[1]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompoundTypeProperty<ExhangeCMoneyRate, ?>[] getProperties() {
|
||||
|
||||
CompoundTypeProperty[] props = {new RateProp(), new CMoneyProp()};
|
||||
return props;
|
||||
}
|
||||
|
||||
static class RateProp implements CompoundTypeProperty<ExhangeCMoneyRate, Rate> {
|
||||
|
||||
public String getName() {
|
||||
return "rate";
|
||||
}
|
||||
|
||||
public Rate getValue(ExhangeCMoneyRate valueObject) {
|
||||
return valueObject.getRate();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class CMoneyProp implements CompoundTypeProperty<ExhangeCMoneyRate, CMoney> {
|
||||
|
||||
public String getName() {
|
||||
return "cmoney";
|
||||
}
|
||||
|
||||
public CMoney getValue(ExhangeCMoneyRate valueObject) {
|
||||
return valueObject.getCmoney();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import com.avaje.ebean.config.CompoundType;
|
||||
import com.avaje.ebean.config.CompoundTypeProperty;
|
||||
import com.avaje.tests.model.ivo.CMoney;
|
||||
import com.avaje.tests.model.ivo.ExhangeCMoneyRate;
|
||||
import com.avaje.tests.model.ivo.Rate;
|
||||
|
||||
public class ExhangeCompoundType implements CompoundType<ExhangeCMoneyRate> {
|
||||
|
||||
public ExhangeCMoneyRate create(Object[] propertyValues) {
|
||||
return new ExhangeCMoneyRate((Rate)propertyValues[0], (CMoney)propertyValues[1]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompoundTypeProperty<ExhangeCMoneyRate, ?>[] getProperties() {
|
||||
|
||||
CompoundTypeProperty[] props = {new RateProp(), new CMoneyProp()};
|
||||
return props;
|
||||
}
|
||||
|
||||
static class RateProp implements CompoundTypeProperty<ExhangeCMoneyRate, Rate> {
|
||||
|
||||
public String getName() {
|
||||
return "rate";
|
||||
}
|
||||
|
||||
public Rate getValue(ExhangeCMoneyRate valueObject) {
|
||||
return valueObject.getRate();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static class CMoneyProp implements CompoundTypeProperty<ExhangeCMoneyRate, CMoney> {
|
||||
|
||||
public String getName() {
|
||||
return "cmoney";
|
||||
}
|
||||
|
||||
public CMoney getValue(ExhangeCMoneyRate valueObject) {
|
||||
return valueObject.getCmoney();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,70 +1,51 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import org.joda.time.Interval;
|
||||
|
||||
import com.avaje.ebean.config.CompoundType;
|
||||
import com.avaje.ebean.config.CompoundTypeProperty;
|
||||
|
||||
public class JodaIntervalCompoundType implements CompoundType<Interval>{
|
||||
|
||||
public Interval create(Object[] propertyValues) {
|
||||
return new Interval((Long)propertyValues[0], (Long)propertyValues[1]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompoundTypeProperty<Interval, ?>[] getProperties() {
|
||||
CompoundTypeProperty[] props = {new Start(), new End()};
|
||||
return props;
|
||||
}
|
||||
|
||||
static class Start implements CompoundTypeProperty<Interval, Long> {
|
||||
|
||||
public String getName() {
|
||||
return "startMillis";
|
||||
}
|
||||
|
||||
public Long getValue(Interval valueObject) {
|
||||
return valueObject.getStartMillis();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return java.sql.Types.TIMESTAMP;
|
||||
}
|
||||
}
|
||||
|
||||
static class End implements CompoundTypeProperty<Interval, Long> {
|
||||
|
||||
public String getName() {
|
||||
return "endMillis";
|
||||
}
|
||||
|
||||
public Long getValue(Interval valueObject) {
|
||||
return valueObject.getEndMillis();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return java.sql.Types.TIMESTAMP;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import org.joda.time.Interval;
|
||||
|
||||
import com.avaje.ebean.config.CompoundType;
|
||||
import com.avaje.ebean.config.CompoundTypeProperty;
|
||||
|
||||
public class JodaIntervalCompoundType implements CompoundType<Interval>{
|
||||
|
||||
public Interval create(Object[] propertyValues) {
|
||||
return new Interval((Long)propertyValues[0], (Long)propertyValues[1]);
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "rawtypes" })
|
||||
public CompoundTypeProperty<Interval, ?>[] getProperties() {
|
||||
CompoundTypeProperty[] props = {new Start(), new End()};
|
||||
return props;
|
||||
}
|
||||
|
||||
static class Start implements CompoundTypeProperty<Interval, Long> {
|
||||
|
||||
public String getName() {
|
||||
return "startMillis";
|
||||
}
|
||||
|
||||
public Long getValue(Interval valueObject) {
|
||||
return valueObject.getStartMillis();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return java.sql.Types.TIMESTAMP;
|
||||
}
|
||||
}
|
||||
|
||||
static class End implements CompoundTypeProperty<Interval, Long> {
|
||||
|
||||
public String getName() {
|
||||
return "endMillis";
|
||||
}
|
||||
|
||||
public Long getValue(Interval valueObject) {
|
||||
return valueObject.getEndMillis();
|
||||
}
|
||||
|
||||
public int getDbType() {
|
||||
return java.sql.Types.TIMESTAMP;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,43 +1,24 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.tests.model.ivo.SysTime;
|
||||
|
||||
public class SysTimeConverter implements ScalarTypeConverter<SysTime, Timestamp> {
|
||||
|
||||
|
||||
public SysTime getNullValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Timestamp unwrapValue(SysTime beanType) {
|
||||
return new Timestamp(beanType.getMillis());
|
||||
}
|
||||
|
||||
public SysTime wrapValue(Timestamp scalarType) {
|
||||
return new SysTime(scalarType.getTime());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ivo.converter;
|
||||
|
||||
import java.sql.Timestamp;
|
||||
|
||||
import com.avaje.ebean.config.ScalarTypeConverter;
|
||||
import com.avaje.tests.model.ivo.SysTime;
|
||||
|
||||
public class SysTimeConverter implements ScalarTypeConverter<SysTime, Timestamp> {
|
||||
|
||||
|
||||
public SysTime getNullValue() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public Timestamp unwrapValue(SysTime beanType) {
|
||||
return new Timestamp(beanType.getMillis());
|
||||
}
|
||||
|
||||
public SysTime wrapValue(Timestamp scalarType) {
|
||||
return new SysTime(scalarType.getTime());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,149 +1,130 @@
|
||||
/**
|
||||
* Copyright (C) 2009 Authors
|
||||
*
|
||||
* This file is part of Ebean.
|
||||
*
|
||||
* Ebean is free software; you can redistribute it and/or modify it
|
||||
* under the terms of the GNU Lesser General Public License as published by
|
||||
* the Free Software Foundation; either version 2.1 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* Ebean is distributed in the hope that it will be useful, but
|
||||
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public License
|
||||
* along with Ebean; if not, write to the Free Software Foundation, Inc.,
|
||||
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*/
|
||||
package com.avaje.tests.model.ldap;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
import com.avaje.ebean.annotation.EnumValue;
|
||||
import com.avaje.ebean.annotation.LdapAttribute;
|
||||
import com.avaje.ebean.annotation.LdapDomain;
|
||||
import com.avaje.tests.ldap.SimpleLdapSetAdapater;
|
||||
|
||||
@LdapDomain(
|
||||
baseDn = "ou=avajepeople,o=avajecustomers,dc=avaje,dc=net,dc=nz",
|
||||
objectclass = "top,organizationalperson,avajeperson,inetadmin,inetorgperson,person,inetuser")
|
||||
@Entity
|
||||
public class LDPerson {
|
||||
|
||||
public enum Status {
|
||||
@EnumValue(value = "Active")
|
||||
ACTIVE,
|
||||
|
||||
@EnumValue(value = "Inactive")
|
||||
INACTIVE
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "uid")
|
||||
private String userId;
|
||||
|
||||
@Column(name = "inetUserStatus")
|
||||
private Status status;
|
||||
|
||||
private String cn;
|
||||
|
||||
private String sn;
|
||||
|
||||
private String givenName;
|
||||
|
||||
private String userPassword;
|
||||
|
||||
@Basic(fetch=FetchType.LAZY)
|
||||
private LocalDateTime modifiedTime;
|
||||
|
||||
@Basic(fetch=FetchType.LAZY)
|
||||
@LdapAttribute(adapter=SimpleLdapSetAdapater.class)
|
||||
private Set<Long> accounts;
|
||||
|
||||
public String toString() {
|
||||
return userId + " " + status;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCn() {
|
||||
return cn;
|
||||
}
|
||||
|
||||
public void setCn(String cn) {
|
||||
this.cn = cn;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getGivenName() {
|
||||
return givenName;
|
||||
}
|
||||
|
||||
public void setGivenName(String givenName) {
|
||||
this.givenName = givenName;
|
||||
}
|
||||
|
||||
public String getUserPassword() {
|
||||
return userPassword;
|
||||
}
|
||||
|
||||
public void setUserPassword(String userPassword) {
|
||||
this.userPassword = userPassword;
|
||||
}
|
||||
|
||||
public LocalDateTime getModifiedTime() {
|
||||
return modifiedTime;
|
||||
}
|
||||
|
||||
public void setModifiedTime(LocalDateTime modifiedTime) {
|
||||
this.modifiedTime = modifiedTime;
|
||||
}
|
||||
|
||||
public Set<Long> getAccounts() {
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public void setAccounts(Set<Long> accounts) {
|
||||
this.accounts = accounts;
|
||||
}
|
||||
|
||||
public void addAccount(long accountNumber){
|
||||
if (accounts == null){
|
||||
accounts = new HashSet<Long>();
|
||||
}
|
||||
accounts.add(accountNumber);
|
||||
}
|
||||
|
||||
}
|
||||
package com.avaje.tests.model.ldap;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import javax.persistence.Basic;
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Entity;
|
||||
import javax.persistence.FetchType;
|
||||
import javax.persistence.Id;
|
||||
|
||||
import org.joda.time.LocalDateTime;
|
||||
|
||||
import com.avaje.ebean.annotation.EnumValue;
|
||||
import com.avaje.ebean.annotation.LdapAttribute;
|
||||
import com.avaje.ebean.annotation.LdapDomain;
|
||||
import com.avaje.tests.ldap.SimpleLdapSetAdapater;
|
||||
|
||||
@LdapDomain(
|
||||
baseDn = "ou=avajepeople,o=avajecustomers,dc=avaje,dc=net,dc=nz",
|
||||
objectclass = "top,organizationalperson,avajeperson,inetadmin,inetorgperson,person,inetuser")
|
||||
@Entity
|
||||
public class LDPerson {
|
||||
|
||||
public enum Status {
|
||||
@EnumValue(value = "Active")
|
||||
ACTIVE,
|
||||
|
||||
@EnumValue(value = "Inactive")
|
||||
INACTIVE
|
||||
}
|
||||
|
||||
@Id
|
||||
@Column(name = "uid")
|
||||
private String userId;
|
||||
|
||||
@Column(name = "inetUserStatus")
|
||||
private Status status;
|
||||
|
||||
private String cn;
|
||||
|
||||
private String sn;
|
||||
|
||||
private String givenName;
|
||||
|
||||
private String userPassword;
|
||||
|
||||
@Basic(fetch=FetchType.LAZY)
|
||||
private LocalDateTime modifiedTime;
|
||||
|
||||
@Basic(fetch=FetchType.LAZY)
|
||||
@LdapAttribute(adapter=SimpleLdapSetAdapater.class)
|
||||
private Set<Long> accounts;
|
||||
|
||||
public String toString() {
|
||||
return userId + " " + status;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public void setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public Status getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Status status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCn() {
|
||||
return cn;
|
||||
}
|
||||
|
||||
public void setCn(String cn) {
|
||||
this.cn = cn;
|
||||
}
|
||||
|
||||
public String getSn() {
|
||||
return sn;
|
||||
}
|
||||
|
||||
public void setSn(String sn) {
|
||||
this.sn = sn;
|
||||
}
|
||||
|
||||
public String getGivenName() {
|
||||
return givenName;
|
||||
}
|
||||
|
||||
public void setGivenName(String givenName) {
|
||||
this.givenName = givenName;
|
||||
}
|
||||
|
||||
public String getUserPassword() {
|
||||
return userPassword;
|
||||
}
|
||||
|
||||
public void setUserPassword(String userPassword) {
|
||||
this.userPassword = userPassword;
|
||||
}
|
||||
|
||||
public LocalDateTime getModifiedTime() {
|
||||
return modifiedTime;
|
||||
}
|
||||
|
||||
public void setModifiedTime(LocalDateTime modifiedTime) {
|
||||
this.modifiedTime = modifiedTime;
|
||||
}
|
||||
|
||||
public Set<Long> getAccounts() {
|
||||
return accounts;
|
||||
}
|
||||
|
||||
public void setAccounts(Set<Long> accounts) {
|
||||
this.accounts = accounts;
|
||||
}
|
||||
|
||||
public void addAccount(long accountNumber){
|
||||
if (accounts == null){
|
||||
accounts = new HashSet<Long>();
|
||||
}
|
||||
accounts.add(accountNumber);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in new issue
Block a user