Пример #1
0
 /**
  * Returns the resolved MulchEvents entity.
  *
  * @return an resolved entity
  */
 public MulchEvent resolveEntity(EntityManager em) {
   MulchLevel mulchLevels = entity.getMulchLevel();
   if (mulchLevels != null) {
     entity.setMulchLevel(em.getReference(MulchLevel.class, mulchLevels.getMulchLevelPK()));
   }
   return entity;
 }
Пример #2
0
 /**
  * Getter for mulchLevels.
  *
  * @return value for mulchLevels
  */
 @XmlElement
 public MulchLevelConverter getMulchLevel() {
   if (expandLevel > 0) {
     if (entity.getMulchLevel() != null) {
       return new MulchLevelConverter(
           entity.getMulchLevel(), uri.resolve("mulchLevel/"), expandLevel - 1, false);
     }
   }
   return null;
 }
Пример #3
0
 /**
  * Updates entity using data from newEntity.
  *
  * @param entity the entity to update
  * @param newEntity the entity containing the new data
  * @return the updated entity
  */
 private MulchEvent updateEntity(MulchEvent entity, MulchEvent newEntity) {
   EntityManager em = PersistenceService.getInstance().getEntityManager();
   MulchLevel mulchLevels = entity.getMulchLevel();
   MulchLevel mulchLevelsNew = newEntity.getMulchLevel();
   entity = em.merge(newEntity);
   if (mulchLevels != null && !mulchLevels.equals(mulchLevelsNew)) {
     mulchLevels.getMulchEventsCollection().remove(entity);
   }
   if (mulchLevelsNew != null && !mulchLevelsNew.equals(mulchLevels)) {
     mulchLevelsNew.getMulchEventsCollection().add(entity);
   }
   return entity;
 }
Пример #4
0
 /**
  * Creates a new instance of MulchEventConverter.
  *
  * @param entity associated entity
  * @param uri associated uri
  * @param expandLevel indicates the number of levels the entity graph should be expanded@param
  *     isUriExtendable indicates whether the uri can be extended
  */
 public MulchEventConverter(MulchEvent entity, URI uri, int expandLevel, boolean isUriExtendable) {
   this.entity = entity;
   this.uri =
       (isUriExtendable)
           ? UriBuilder.fromUri(uri)
               .path(
                   entity.getMulchEventPK().getExpId()
                       + ","
                       + entity.getMulchEventPK().getMl()
                       + ","
                       + entity.getMulchEventPK().getMlApplNo()
                       + "/")
               .build()
           : uri;
   this.expandLevel = expandLevel;
   getMulchLevel();
 }
Пример #5
0
 /**
  * Deletes the entity.
  *
  * @param entity the entity to deletle
  */
 private void deleteEntity(MulchEvent entity) {
   EntityManager em = PersistenceService.getInstance().getEntityManager();
   MulchLevel mulchLevels = entity.getMulchLevel();
   if (mulchLevels != null) {
     mulchLevels.getMulchEventsCollection().remove(entity);
   }
   em.remove(entity);
 }
Пример #6
0
 @Override
 public int hashCode() {
   int hash = uri == null ? 0 : uri.hashCode();
   if (expandLevel <= 0) {
     return hash + 37 * expandLevel;
   }
   return hash + 37 * (expandLevel + 37 * (entity == null ? 0 : entity.hashCode()));
 }
Пример #7
0
 @Override
 protected MulchLevel getEntity() {
   MulchLevel entity = parent.getMulchLevel();
   if (entity == null) {
     throw new WebApplicationException(
         new Throwable("Resource for " + uriInfo.getAbsolutePath() + " does not exist."), 404);
   }
   return entity;
 }
Пример #8
0
 /**
  * Returns the MulchEvents entity.
  *
  * @return an entity
  */
 @XmlTransient
 public MulchEvent getEntity() {
   if (entity.getMulchEventPK() == null) {
     MulchEventConverter converter =
         UriResolver.getInstance().resolve(MulchEventConverter.class, uri);
     if (converter != null) {
       entity = converter.getEntity();
     }
   }
   return entity;
 }
Пример #9
0
 /**
  * Setter for mltp.
  *
  * @param value the value to set
  */
 public void setMltp(String value) {
   entity.setMltp(value);
 }
Пример #10
0
 /**
  * Setter for mlthk.
  *
  * @param value the value to set
  */
 public void setMlthk(Float value) {
   entity.setMlthk(value);
 }
Пример #11
0
 /**
  * Getter for mlcol.
  *
  * @return value for mlcol
  */
 @XmlElement
 public String getMlcol() {
   return (expandLevel > 0) ? entity.getMlcol() : null;
 }
Пример #12
0
 /**
  * Setter for mldat.
  *
  * @param value the value to set
  */
 public void setMldat(Date value) {
   entity.setMldat(value);
 }
Пример #13
0
 /**
  * Getter for mldat.
  *
  * @return value for mldat
  */
 @XmlElement
 public Date getMldat() {
   return (expandLevel > 0) ? entity.getMldat() : null;
 }
Пример #14
0
 /**
  * Setter for mulchEventsPK.
  *
  * @param value the value to set
  */
 public void setMulchEventPK(MulchEventPK value) {
   entity.setMulchEventPK(value);
 }
Пример #15
0
 /**
  * Getter for mulchEventsPK.
  *
  * @return value for mulchEventsPK
  */
 @XmlElement
 public MulchEventPK getMulchEventPK() {
   return (expandLevel > 0) ? entity.getMulchEventPK() : null;
 }
Пример #16
0
 /**
  * Setter for mlcol.
  *
  * @param value the value to set
  */
 public void setMlcol(String value) {
   entity.setMlcol(value);
 }
Пример #17
0
 /**
  * Getter for mlthk.
  *
  * @return value for mlthk
  */
 @XmlElement
 public Float getMlthk() {
   return (expandLevel > 0) ? entity.getMlthk() : null;
 }
Пример #18
0
 /**
  * Setter for mulchLevels.
  *
  * @param value the value to set
  */
 public void setMulchLevel(MulchLevelConverter value) {
   entity.setMulchLevel((value != null) ? value.getEntity() : null);
 }