Package org.wso2.carbon.ui

Examples of org.wso2.carbon.ui.JSPContextFinder$Finder


  public Pagination getPage(Integer siteId, Integer sendUserId,
      Integer receiverUserId, String title, Date sendBeginTime,
      Date sendEndTime, Boolean status, Integer box, Boolean cacheable,
      int pageNo, int pageSize) {
    String hql = " select msg from CmsReceiverMessage msg where 1=1 ";
    Finder finder = Finder.create(hql);
    if (siteId != null) {
      finder.append(" and msg.site.id=:siteId")
          .setParam("siteId", siteId);
    }
    // 垃圾箱
    if (sendUserId != null && receiverUserId != null) {
      finder
          .append(
              " and ((msg.msgReceiverUser.id=:receiverUserId  and msg.msgBox =:box) or (msg.msgSendUser.id=:sendUserId  and msg.msgBox =:box) )")
          .setParam("sendUserId", sendUserId).setParam(
              "receiverUserId", receiverUserId).setParam("box",
              box);
    } else {
      if (sendUserId != null) {
        finder.append(" and msg.msgSendUser.id=:sendUserId").setParam(
            "sendUserId", sendUserId);
      }
      if (receiverUserId != null) {
        finder.append(" and msg.msgReceiverUser.id=:receiverUserId")
            .setParam("receiverUserId", receiverUserId);
      }
      if (box != null) {
        finder.append(" and msg.msgBox =:box").setParam("box", box);
      }
    }
    if (StringUtils.isNotBlank(title)) {
      finder.append(" and msg.msgTitle like:title").setParam("title",
          "%" + title + "%");
    }
    if (sendBeginTime != null) {
      finder.append(" and msg.sendTime >=:sendBeginTime").setParam(
          "sendBeginTime", sendBeginTime);
    }
    if (sendEndTime != null) {
      finder.append(" and msg.sendTime <=:sendEndTime").setParam(
          "sendEndTime", sendEndTime);
    }
    if (status != null) {
      if (status) {
        finder.append(" and msg.msgStatus =true");
      } else {
        finder.append(" and msg.msgStatus =false");
      }
    }
    finder.append(" order by msg.id desc");

    return find(finder, pageNo, pageSize);
  }
View Full Code Here


  public List getList(Integer siteId, Integer sendUserId,
      Integer receiverUserId, String title, Date sendBeginTime,
      Date sendEndTime, Boolean status, Integer box, Boolean cacheable) {
    String hql = " select msg from CmsReceiverMessage msg where 1=1  ";
    Finder finder = Finder.create(hql);
    if (siteId != null) {
      finder.append(" and msg.site.id=:siteId")
          .setParam("siteId", siteId);
    }
    // 垃圾箱
    if (sendUserId != null && receiverUserId != null) {
      finder
          .append(
              " and ((msg.msgReceiverUser.id=:receiverUserId  and msg.msgBox =:box) or (msg.msgSendUser.id=:sendUserId  and msg.msgBox =:box) )")
          .setParam("sendUserId", sendUserId).setParam(
              "receiverUserId", receiverUserId).setParam("box",
              box);
    else {
      if (sendUserId != null) {
        finder.append(" and msg.msgSendUser.id=:sendUserId").setParam(
            "sendUserId", sendUserId);
      }
      if (receiverUserId != null) {
        finder.append(" and msg.msgReceiverUser.id=:receiverUserId")
            .setParam("receiverUserId", receiverUserId);
      }
      if (box != null) {
        finder.append(" and msg.msgBox =:box").setParam("box", box);
      }
    }
    if (StringUtils.isNotBlank(title)) {
      finder.append(" and msg.msgTitle like:title").setParam("title",
          "%" + title + "%");
    }
    if (sendBeginTime != null) {
      finder.append(" and msg.sendTime >=:sendBeginTime").setParam(
          "sendBeginTime", sendBeginTime);
    }
    if (sendEndTime != null) {
      finder.append(" and msg.sendTime <=:sendEndTime").setParam(
          "sendEndTime", sendEndTime);
    }
    if (status != null) {
      if (status) {
        finder.append(" and msg.msgStatus =true");
      } else {
        finder.append(" and msg.msgStatus =false");
      }
    }
    finder.append(" order by msg.id desc");
    return find(finder);
  }
View Full Code Here

public class CmsFriendlinkDaoImpl extends
    HibernateBaseDao<CmsFriendlink, Integer> implements CmsFriendlinkDao {
  @SuppressWarnings("unchecked")
  public List<CmsFriendlink> getList(Integer siteId, Integer ctgId,
      Boolean enabled) {
    Finder f = Finder.create("from CmsFriendlink bean where 1=1");
    if (enabled != null) {
      f.append(" and bean.enabled=:enabled");
      f.setParam("enabled", enabled);
    }
    if (siteId != null) {
      f.append(" and bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    }
    if (ctgId != null) {
      f.append(" and bean.category.id=:ctgId");
      f.setParam("ctgId", ctgId);
    }
    f.append(" order by bean.priority asc");
    return find(f);
  }
View Full Code Here

public class CmsAcquisitionTempDaoImpl extends
    HibernateBaseDao<CmsAcquisitionTemp, Integer> implements
    CmsAcquisitionTempDao {
  @SuppressWarnings("unchecked")
  public List<CmsAcquisitionTemp> getList(Integer siteId) {
    Finder f = Finder.create("from CmsAcquisitionTemp bean where 1=1");
    if (siteId != null) {
      f.append(" and bean.site.id=:siteId");
      f.setParam("siteId", siteId);
    }
    f.append(" order by bean.id desc");
    return find(f);
  }
View Full Code Here

  public Pagination getPage(Integer siteId, Integer sendUserId,
      Integer receiverUserId, String title, Date sendBeginTime,
      Date sendEndTime, Boolean status, Integer box, Boolean cacheable,
      int pageNo, int pageSize) {
    String hql = " select msg from CmsMessage msg where 1=1 ";
    Finder finder = Finder.create(hql);
    if (siteId != null) {
      finder.append(" and msg.site.id=:siteId")
          .setParam("siteId", siteId);
    }
    if(sendUserId != null&&receiverUserId != null){
      finder.append(" and (msg.msgSendUser.id=:sendUserId or msg.msgReceiverUser.id=:receiverUserId)").setParam(
          "sendUserId", sendUserId).setParam("receiverUserId", receiverUserId);
    }else{
      if (sendUserId != null) {
        finder.append(" and msg.msgSendUser.id=:sendUserId").setParam(
            "sendUserId", sendUserId);
      }
      if (receiverUserId != null) {
        finder.append(" and msg.msgReceiverUser.id=:receiverUserId")
            .setParam("receiverUserId", receiverUserId);
      }
    }
   
    if (StringUtils.isNotBlank(title)) {
      finder.append(" and msg.msgTitle like:title").setParam("title",
          "%" + title + "%");
    }
    if (sendBeginTime != null) {
      finder.append(" and msg.sendTime >=:sendBeginTime").setParam(
          "sendBeginTime", sendBeginTime);
    }
    if (sendEndTime != null) {
      finder.append(" and msg.sendTime <=:sendEndTime").setParam(
          "sendEndTime", sendEndTime);
    }
    if (status != null) {
      if (status) {
        finder.append(" and msg.msgStatus =true");
      } else {
        finder.append(" and msg.msgStatus =false");
      }
    }
    if (box != null) {
      finder.append(" and msg.msgBox =:box").setParam("box", box);
    }
    finder.append(" order by msg.id desc");
    return find(finder, pageNo, pageSize);
  }
View Full Code Here

                    + cacheKey);
        }

        // look up cache
        Object prop = cfgCtx.getPropertyNonReplicable(CachingConstants.CACHE_MANAGER);
        CacheManager cacheManager;
        if (prop != null && prop instanceof CacheManager) {
            cacheManager = (CacheManager) prop;
        } else {
            synchronized (cfgCtx) {
                // check again after taking the lock to make sure no one else did it before us
                prop = cfgCtx.getPropertyNonReplicable(CachingConstants.CACHE_MANAGER);
                if (prop != null && prop instanceof CacheManager) {
                    cacheManager = (CacheManager) prop;

                } else {
                    synLog.traceOrDebug("Creating/recreating the cache object");
                    cacheManager = new CacheManager();
                    cfgCtx.setProperty(CachingConstants.CACHE_MANAGER, cacheManager);
                }
            }
        }
View Full Code Here

            if (synLog.isTraceOrDebugEnabled()) {
                synLog.traceOrDebug("Storing the response message into the cache at scope : " +
                    scope + " with ID : " + cacheKey + " for request hash : " + requestHash);
            }

            CachedObject cachedObj = cacheManager.getResponseForKey(cacheKey, requestHash, cfgCtx);
            if (cachedObj != null) {

                if (synLog.isTraceOrDebugEnabled()) {
                    synLog.traceOrDebug("Storing the response for the message with ID : " +
                        synCtx.getMessageID() + " with request hash ID : " +
                        cachedObj.getRequestHash() + " in the cache : " + cacheKey);
                }

                ByteArrayOutputStream outStream = new ByteArrayOutputStream();
                try {
                    MessageHelper.cloneSOAPEnvelope(synCtx.getEnvelope()).serialize(outStream);
                    cachedObj.setResponseEnvelope(outStream.toByteArray());
                } catch (XMLStreamException e) {
                    handleException("Unable to set the response to the Cache", e, synCtx);
                }

                /* this is not required yet, can commented this for perf improvements
                   in the future there can be a situation where user sends the request
                   with the response hash (if client side caching is on) in which case
                   we can compare that response hash with the given response hash and
                   respond with not-modified http header */
                // cachedObj.setResponseHash(cache.getGenerator().getDigest(
                //     ((Axis2MessageContext) synCtx).getAxis2MessageContext()));

                if (cachedObj.getTimeout() > 0) {
                    cachedObj.setExpireTimeMillis(System.currentTimeMillis() + cachedObj.getTimeout());
                }

                cfgCtx.setProperty(CachingConstants.CACHE_MANAGER, cacheManager);
//                Replicator.replicate(cfgCtx, new String[]{cacheManagerKey});
                Replicator.replicate(cfgCtx);
View Full Code Here

        if (cacheManager.containsKey(cacheKey, requestHash) &&
            cacheManager.getResponseForKey(cacheKey, requestHash, cfgCtx) != null) {

            // get the response from the cache and attach to the context and change the
            // direction of the message
            CachedObject cachedObj = cacheManager.getResponseForKey(cacheKey, requestHash, cfgCtx);

            if (!cachedObj.isExpired() && cachedObj.getResponseEnvelope() != null) {

                if (synLog.isTraceOrDebugEnabled()) {
                    synLog.traceOrDebug("Cache-hit for message ID : " + synCtx.getMessageID());
                }

                // mark as a response and replace envelope from cache
                synCtx.setResponse(true);
                try {
                    SOAPEnvelope omSOAPEnv = SOAPMessageHelper.buildSOAPEnvelopeFromBytes(
                            cachedObj.getResponseEnvelope());

                    // todo: if there is a WSA messageID in the response, is that need to be unique on each and every resp

                    synCtx.setEnvelope(omSOAPEnv);
                } catch (AxisFault axisFault) {
                    handleException("Error setting response envelope from cache : "
                        + cacheKey, synCtx);
                } catch (IOException ioe) {
                    handleException("Error setting response envelope from cache : "
                        + cacheKey, ioe, synCtx);
                } catch (SOAPException soape) {
                    handleException("Error setting response envelope from cache : "
                        + cacheKey, soape, synCtx);
                }

                // take specified action on cache hit
                if (onCacheHitSequence != null) {
                    // if there is an onCacheHit use that for the mediation
                    synLog.traceOrDebug("Delegating message to the onCachingHit "
                            + "Anonymous sequence");
                    onCacheHitSequence.mediate(synCtx);

                } else if (onCacheHitRef != null) {

                    if (synLog.isTraceOrDebugEnabled()) {
                        synLog.traceOrDebug("Delegating message to the onCachingHit " +
                            "sequence : " + onCacheHitRef);
                    }
                    synCtx.getSequence(onCacheHitRef).mediate(synCtx);

                } else {

                    if (synLog.isTraceOrDebugEnabled()) {
                        synLog.traceOrDebug("Request message " + synCtx.getMessageID() +
                            " was served from the cache : " + cacheKey);
                    }
                    // send the response back if there is not onCacheHit is specified
                    synCtx.setTo(null);
                    Axis2Sender.sendBack(synCtx);
                }
                // stop any following mediators from executing
                return false;

            } else {
                // cache exists, but has expired...
                cachedObj.expire();
                cachedObj.setTimeout(timeout);
                synLog.traceOrDebug("Existing cached response has expired. Reset cache element");

                cfgCtx.setProperty(CachingConstants.CACHE_MANAGER, cacheManager);
//                Replicator.replicate(cfgCtx, new String[]{cacheManagerKey});
                Replicator.replicate(cfgCtx);
View Full Code Here

     * @throws ClusteringFault if there is an error in replicating the cfgCtx
     */
    private void storeRequestToCache(ConfigurationContext cfgCtx,
        String requestHash, CacheManager cacheManager) throws ClusteringFault {

        CachedObject cachedObj = new CachedObject();
        cachedObj.setRequestHash(requestHash);
        // this does not set the expiretime but just sets the timeout and the espiretime will
        // be set when the response is availabel
        cachedObj.setTimeout(timeout);
        cacheManager.addResponseWithKey(cacheKey, requestHash, cachedObj, cfgCtx);

        cfgCtx.setProperty(CachingConstants.CACHE_MANAGER, cacheManager);
//        Replicator.replicate(cfgCtx, new String[]{cacheManagerKey});
        Replicator.replicate(cfgCtx);
View Full Code Here

     * @return The end line number, or -1 if could not be determined
     */
    public int getEndLineNumber() {
      int ret=-1;
     
      ActivityInterface parent=getParent();
     
      if (parent != null) {
        int index=parent.getSubActivities().indexOf(this);
       
        if (index != -1) {
          if (index < (parent.getSubActivities().size()-1)) {
            ActivityInterface other=parent.getSubActivities().get(index+1);
           
            ret = other.getStartLineNumber()-1;
          } else {
            ret = parent.getEndLineNumber();
          }
        }
      }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.ui.JSPContextFinder$Finder

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.