Package org.wso2.carbon.registry.core.jdbc.dataobjects

Examples of org.wso2.carbon.registry.core.jdbc.dataobjects.RatingDO


                ps.setInt(4, CurrentSession.getTenantId());
            }

            result = ps.executeQuery();
            while (result.next()) {
                RatingDO ratingDO = new RatingDO();
                ratingDO.setRating(result.getInt(DatabaseConstants.RATING_FIELD));
                ratingDO.setRatedTime(new java.util.Date(
                        result.getTimestamp(DatabaseConstants.RATED_TIME_FIELD).getTime()));
                ratingDO.setRatedUserName(result.getString(DatabaseConstants.USER_ID_FIELD));
                ratingDO.setRatingID(result.getInt(DatabaseConstants.ID_FIELD));

                ratingDOs.add(ratingDO);
            }
        } catch (SQLException e) {
View Full Code Here


        List<String> ratingPathList = new ArrayList<String>();

        while (results.next()) {
            long ratingID = results.getLong(DatabaseConstants.RATING_ID_FIELD);
            RatingDO ratingDAO = ((JDBCRatingsDAO)ratingsDAO).getRating(ratingID);
            String ratingPath =
                    ratingDAO.getResourcePath() + RegistryConstants.URL_SEPARATOR + "ratings:" +
                            ratingDAO.getRatedUserName();
            ratingPathList.add(ratingPath);
        }

        String[] ratingPaths =
                ratingPathList.toArray(new String[ratingPathList.size()]);
View Full Code Here

        String ratedUserName = resourcePath.getParameterValue("ratings");
        if (ratedUserName != null) {
            ResourceImpl resourceImpl = resourceDAO.getResourceMetaData(resourcePath.getPath());

            RatingDO ratingDO = ratingsDAO.getRatingDO(resourceImpl, ratedUserName);
            int rating = ratingDO.getRating();
            Date ratedTime = ratingDO.getRatedTime();

            ResourceImpl resource = new ResourceImpl();
            resource.setMediaType(RegistryConstants.RATING_MEDIA_TYPE);
            resource.setContent(rating);
            resource.setAuthorUserName(ratedUserName);
View Full Code Here

     * @return the rate id.
     * @throws RegistryException if an error occurs while getting the rate id.
     */
    public int getRateID(ResourceImpl resourceImpl, String userID) throws RegistryException {

        RatingDO ratingDO = getRatingDO(resourceImpl, userID);
        return ratingDO.getRatingID();
    }
View Full Code Here

        Connection conn = JDBCDatabaseTransaction.getConnection();

        PreparedStatement ps = null;
        ResultSet result = null;
        RatingDO ratingDO = new RatingDO();
        try {
            String sql = "SELECT R.REG_ID, R.REG_RATING, R.REG_RATED_TIME " +
                    "FROM REG_RATING R, REG_RESOURCE_RATING RR " +
                    "WHERE RR.REG_VERSION=? AND " +
                    "RR.REG_RATING_ID=R.REG_ID AND R.REG_USER_ID=? AND " +
                    "R.REG_TENANT_ID=? AND RR.REG_TENANT_ID=?";

            ps = conn.prepareStatement(sql);
            ps.setLong(1, resourceImpl.getVersionNumber());
            ps.setString(2, userID);
            ps.setInt(3, CurrentSession.getTenantId());
            ps.setInt(4, CurrentSession.getTenantId());

            result = ps.executeQuery();
            if (result.next()) {
                ratingDO.setRating(result.getInt(DatabaseConstants.RATING_FIELD));
                ratingDO.setRatedTime(new java.util.Date(
                        result.getTimestamp(DatabaseConstants.RATED_TIME_FIELD).getTime()));
                ratingDO.setRatedUserName(userID);
                ratingDO.setRatingID(result.getInt(DatabaseConstants.ID_FIELD));
            }
        } catch (SQLException e) {

            String msg = "Failed to get rating on resource " + resourceImpl.getPath() +
                    " done by user " + userID + ". " + e.getMessage();
View Full Code Here

            ps.setInt(2, CurrentSession.getTenantId());
            ps.setInt(3, CurrentSession.getTenantId());

            result = ps.executeQuery();
            while (result.next()) {
                RatingDO ratingDO = new RatingDO();
                ratingDO.setRating(result.getInt(DatabaseConstants.RATING_FIELD));
                ratingDO.setRatedTime(new java.util.Date(
                        result.getTimestamp(DatabaseConstants.RATED_TIME_FIELD).getTime()));
                ratingDO.setRatedUserName(result.getString(DatabaseConstants.USER_ID_FIELD));
                ratingDO.setRatingID(result.getInt(DatabaseConstants.ID_FIELD));

                ratingDOs.add(ratingDO);
            }
        } catch (SQLException e) {
View Full Code Here

                if (results.next()) {

                    java.util.Date ratedTime = new java.util.Date(
                            results.getTimestamp(DatabaseConstants.RATED_TIME_FIELD).getTime());

                    RatingDO ratingDAO = new RatingDO();
                    ratingDAO.setRatedUserName(results.getString(DatabaseConstants.USER_ID_FIELD));
                    ratingDAO.setRatedTime(ratedTime);
                    ratingDAO.setRating(results.getInt(DatabaseConstants.RATING_FIELD));
                    // TODO:
                    //ratingDAO.setResourceID(results.getString(DatabaseConstants.AID_FIELD));

                    String resourcePath = null;
                    long version = results.getLong(DatabaseConstants.VERSION_FIELD);
                    if (version > 0) {
                        resourcePath = resourceDAO.getPath(version);
                    }
                    if (resourcePath != null) {
                        ratingDAO.setResourcePath(resourcePath);
                    }
                    return ratingDAO;
                }
            } finally {
                if (results != null) {
View Full Code Here

        }

        public void run() {
            try {
                MessageContext msgCtx = ((Axis2MessageContext) synCtx).getAxis2MessageContext();
                Event<MessageContext> event = new Event(msgCtx);
                subscriptions = subscriptionManager.getMatchingSubscriptions(event);
            } catch (EventException e) {
                handleException("Matching subscriptions fetching error", e);
            }
View Full Code Here

     * @throws EventException event
     */
    private void processGetStatusRequest(MessageContext mc,
                                         ResponseMessageBuilder messageBuilder)
            throws AxisFault, EventException {
        Subscription subscription =
                SubscriptionMessageBuilder.createGetStatusMessage(mc);
        if (log.isDebugEnabled()) {
            log.debug("GetStatus request recived for SynapseSubscription ID : " +
                    subscription.getId());
        }
        subscription = subscriptionManager.getSubscription(subscription.getId());
        if (subscription != null) {
            if (log.isDebugEnabled()) {
                log.debug("Sending GetStatus responce for SynapseSubscription ID : " +
                        subscription.getId());
            }
            //send the responce
            SOAPEnvelope soapEnvelope = messageBuilder.genGetStatusResponse(subscription);
            dispatchResponse(soapEnvelope, EventingConstants.WSE_GET_STATUS_RESPONSE,
                    mc, false);
View Full Code Here


    public SynapseSubscription() {
        this.setId(UIDGenerator.generateURNString());
        this.setDeliveryMode(EventingConstants.WSE_DEFAULT_DELIVERY_MODE);
        SubscriptionData subscriptionData = new SubscriptionData();
        subscriptionData.setProperty(SynapseEventingConstants.STATIC_ENTRY, "false");
        this.setSubscriptionData(subscriptionData);
    }
View Full Code Here

TOP

Related Classes of org.wso2.carbon.registry.core.jdbc.dataobjects.RatingDO

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.