Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package gauss.com.cesting.models;
- import android.database.sqlite.SQLiteException;
- import org.greenrobot.greendao.DaoException;
- import org.greenrobot.greendao.annotation.Entity;
- import org.greenrobot.greendao.annotation.Generated;
- import org.greenrobot.greendao.annotation.Id;
- import org.greenrobot.greendao.annotation.JoinEntity;
- import org.greenrobot.greendao.annotation.NotNull;
- import org.greenrobot.greendao.annotation.ToMany;
- import org.greenrobot.greendao.annotation.ToOne;
- import java.util.ArrayList;
- import java.util.List;
- import gauss.com.cesting.Cesting;
- /**
- * Created by vedran on 26.05.17..
- */
- @Entity
- public class SaveWorkorderRequest {
- //region PARAMS
- @Id
- private Long Id;
- private String adDate;
- private String travelEndTime;
- private String travelStartTime;
- private String acKey;
- private String worker;
- private String regOznaka;
- private String acStatus;
- private boolean active;
- @ToMany(referencedJoinProperty = "eventsJoinId")
- private List<EventsCombinedModel> events;
- @ToMany(referencedJoinProperty = "usedServicesId")
- private List<UsedServicesModel> usedServices;
- @ToMany(referencedJoinProperty = "accidentLargeModelId")
- private List<AccidentLargeModel> prometna;
- /**
- * Used to resolve relations
- */
- @Generated(hash = 2040040024)
- private transient DaoSession daoSession;
- /**
- * Used for active entity operations.
- */
- @Generated(hash = 1045882519)
- private transient SaveWorkorderRequestDao myDao;
- //endregion
- //region CONSTRUCTOR
- public SaveWorkorderRequest(boolean isActive, String acKey) {
- this.active = isActive;
- this.acKey = acKey;
- }
- public SaveWorkorderRequest(String adDate, String travelEndTime, String travelStartTime, String acKey, String worker, String regOznaka, String acStatus, List<EventsCombinedModel> events, List<UsedServicesModel> usedServices, List<AccidentLargeModel> prometna) {
- this.adDate = adDate;
- this.travelEndTime = travelEndTime;
- this.travelStartTime = travelStartTime;
- this.acKey = acKey;
- this.worker = worker;
- this.regOznaka = regOznaka;
- this.acStatus = acStatus;
- this.events = events;
- this.usedServices = usedServices;
- this.prometna = prometna;
- }
- @Generated(hash = 1753560489)
- public SaveWorkorderRequest(Long Id, String adDate, String travelEndTime, String travelStartTime, String acKey, String worker, String regOznaka, String acStatus, boolean active) {
- this.Id = Id;
- this.adDate = adDate;
- this.travelEndTime = travelEndTime;
- this.travelStartTime = travelStartTime;
- this.acKey = acKey;
- this.worker = worker;
- this.regOznaka = regOznaka;
- this.acStatus = acStatus;
- this.active = active;
- }
- @Generated(hash = 1470173319)
- public SaveWorkorderRequest() {
- }
- //endregion
- //region GETTERS AND SETTERS
- public String getAdDate() {
- return adDate;
- }
- public void setAdDate(String adDate) {
- this.adDate = adDate;
- }
- public String getTravelEndTime() {
- return travelEndTime;
- }
- public void setTravelEndTime(String travelEndTime) {
- this.travelEndTime = travelEndTime;
- }
- public String getTravelStartTime() {
- return travelStartTime;
- }
- public void setTravelStartTime(String travelStartTime) {
- this.travelStartTime = travelStartTime;
- }
- public String getAcKey() {
- return acKey;
- }
- public void setAcKey(String acKey) {
- this.acKey = acKey;
- }
- public String getWorker() {
- return worker;
- }
- public void setWorker(String worker) {
- this.worker = worker;
- }
- public String getRegOznaka() {
- return regOznaka;
- }
- public void setRegOznaka(String regOznaka) {
- this.regOznaka = regOznaka;
- }
- public String getAcStatus() {
- return acStatus;
- }
- public void setAcStatus(String acStatus) {
- this.acStatus = acStatus;
- }
- public Long getId() {
- return this.Id;
- }
- public void setId(Long Id) {
- this.Id = Id;
- }
- public boolean isActive() {
- return active;
- }
- public void setActive(boolean active) {
- this.active = active;
- }
- public static List<SaveWorkorderRequest> listAllModels() {
- return Cesting.getInstance().getDaoSession().getSaveWorkorderRequestDao().queryBuilder().list();
- }
- public static List<SaveWorkorderRequest> getActiveWorkOrder() {
- try {
- return Cesting.getInstance().getDaoSession().getSaveWorkorderRequestDao().queryBuilder().where(SaveWorkorderRequestDao.Properties.Active.eq(true)).list();
- } catch (SQLiteException ex) {
- return new ArrayList<>();
- }
- }
- /**
- * To-many relationship, resolved on first access (and after reset).
- * Changes to to-many relations are not persisted, make changes to the target entity.
- */
- @Generated(hash = 1174941244)
- public List<EventsCombinedModel> getEvents() {
- if (events == null) {
- final DaoSession daoSession = this.daoSession;
- if (daoSession == null) {
- throw new DaoException("Entity is detached from DAO context");
- }
- EventsCombinedModelDao targetDao = daoSession.getEventsCombinedModelDao();
- List<EventsCombinedModel> eventsNew = targetDao._querySaveWorkorderRequest_Events(Id);
- synchronized (this) {
- if (events == null) {
- events = eventsNew;
- }
- }
- }
- return events;
- }
- /**
- * To-many relationship, resolved on first access (and after reset).
- * Changes to to-many relations are not persisted, make changes to the target entity.
- */
- @Generated(hash = 7599493)
- public List<UsedServicesModel> getUsedServices() {
- if (usedServices == null) {
- final DaoSession daoSession = this.daoSession;
- if (daoSession == null) {
- throw new DaoException("Entity is detached from DAO context");
- }
- UsedServicesModelDao targetDao = daoSession.getUsedServicesModelDao();
- List<UsedServicesModel> usedServicesNew = targetDao._querySaveWorkorderRequest_UsedServices(Id);
- synchronized (this) {
- if (usedServices == null) {
- usedServices = usedServicesNew;
- }
- }
- }
- return usedServices;
- }
- /**
- * Resets a to-many relationship, making the next get call to query for a fresh result.
- */
- @Generated(hash = 1009978459)
- public synchronized void resetUsedServices() {
- usedServices = null;
- }
- /**
- * To-many relationship, resolved on first access (and after reset).
- * Changes to to-many relations are not persisted, make changes to the target entity.
- */
- @Generated(hash = 92949840)
- public List<AccidentLargeModel> getPrometna() {
- if (prometna == null) {
- final DaoSession daoSession = this.daoSession;
- if (daoSession == null) {
- throw new DaoException("Entity is detached from DAO context");
- }
- AccidentLargeModelDao targetDao = daoSession.getAccidentLargeModelDao();
- List<AccidentLargeModel> prometnaNew = targetDao._querySaveWorkorderRequest_Prometna(Id);
- synchronized (this) {
- if (prometna == null) {
- prometna = prometnaNew;
- }
- }
- }
- return prometna;
- }
- /**
- * Resets a to-many relationship, making the next get call to query for a fresh result.
- */
- @Generated(hash = 109329087)
- public synchronized void resetPrometna() {
- prometna = null;
- }
- /**
- * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
- * Entity must attached to an entity context.
- */
- @Generated(hash = 128553479)
- public void delete() {
- if (myDao == null) {
- throw new DaoException("Entity is detached from DAO context");
- }
- myDao.delete(this);
- }
- /**
- * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
- * Entity must attached to an entity context.
- */
- @Generated(hash = 1942392019)
- public void refresh() {
- if (myDao == null) {
- throw new DaoException("Entity is detached from DAO context");
- }
- myDao.refresh(this);
- }
- /**
- * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
- * Entity must attached to an entity context.
- */
- @Generated(hash = 713229351)
- public void update() {
- if (myDao == null) {
- throw new DaoException("Entity is detached from DAO context");
- }
- myDao.update(this);
- }
- public static Long insertModelToDb(SaveWorkorderRequest model) {
- return Cesting.getInstance().getDaoSession().getSaveWorkorderRequestDao().insertOrReplace(model);
- }
- //endregion
- public boolean getActive() {
- return this.active;
- }
- /** Resets a to-many relationship, making the next get call to query for a fresh result. */
- @Generated(hash = 1830105409)
- public synchronized void resetEvents() {
- events = null;
- }
- /** called by internal mechanisms, do not call yourself. */
- @Generated(hash = 274751260)
- public void __setDaoSession(DaoSession daoSession) {
- this.daoSession = daoSession;
- myDao = daoSession != null ? daoSession.getSaveWorkorderRequestDao() : null;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement