All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.liferay.mobile.android.v7.microblogsentry.MicroblogsentryService Maven / Gradle / Ivy

There is a newer version: 7.0.8
Show newest version
/**
 * Copyright (c) 2000-present Liferay, Inc. All rights reserved.
 *
 * This library 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.
 *
 * This library 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.
 */

package com.liferay.mobile.android.v7.microblogsentry;

import com.liferay.mobile.android.http.file.UploadData;
import com.liferay.mobile.android.service.BaseService;
import com.liferay.mobile.android.service.JSONObjectWrapper;
import com.liferay.mobile.android.service.Session;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

/**
 * @author Bruno Farache
 */
public class MicroblogsentryService extends BaseService {

	public MicroblogsentryService(Session session) {
		super(session);
	}

	public JSONArray getMicroblogsEntries(int start, int end) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("start", start);
			_params.put("end", end);

			_command.put("/microblogs.microblogsentry/get-microblogs-entries", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getJSONArray(0);
	}

	public JSONArray getMicroblogsEntries(String assetTagName, int start, int end) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("assetTagName", checkNull(assetTagName));
			_params.put("start", start);
			_params.put("end", end);

			_command.put("/microblogs.microblogsentry/get-microblogs-entries", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getJSONArray(0);
	}

	public Integer getMicroblogsEntriesCount(String assetTagName) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("assetTagName", checkNull(assetTagName));

			_command.put("/microblogs.microblogsentry/get-microblogs-entries-count", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getInt(0);
	}

	public Integer getMicroblogsEntriesCount() throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_command.put("/microblogs.microblogsentry/get-microblogs-entries-count", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getInt(0);
	}

	public JSONObject getMicroblogsEntry(long microblogsEntryId) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("microblogsEntryId", microblogsEntryId);

			_command.put("/microblogs.microblogsentry/get-microblogs-entry", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getJSONObject(0);
	}

	public JSONObject addMicroblogsEntry(long userId, String content, int type, long parentMicroblogsEntryId, int socialRelationType, JSONObjectWrapper serviceContext) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("userId", userId);
			_params.put("content", checkNull(content));
			_params.put("type", type);
			_params.put("parentMicroblogsEntryId", parentMicroblogsEntryId);
			_params.put("socialRelationType", socialRelationType);
			mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext", serviceContext);

			_command.put("/microblogs.microblogsentry/add-microblogs-entry", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getJSONObject(0);
	}

	public JSONObject deleteMicroblogsEntry(long microblogsEntryId) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("microblogsEntryId", microblogsEntryId);

			_command.put("/microblogs.microblogsentry/delete-microblogs-entry", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getJSONObject(0);
	}

	public JSONArray getUserMicroblogsEntries(long microblogsEntryUserId, int type, int start, int end) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("microblogsEntryUserId", microblogsEntryUserId);
			_params.put("type", type);
			_params.put("start", start);
			_params.put("end", end);

			_command.put("/microblogs.microblogsentry/get-user-microblogs-entries", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getJSONArray(0);
	}

	public JSONArray getUserMicroblogsEntries(long microblogsEntryUserId, int start, int end) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("microblogsEntryUserId", microblogsEntryUserId);
			_params.put("start", start);
			_params.put("end", end);

			_command.put("/microblogs.microblogsentry/get-user-microblogs-entries", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getJSONArray(0);
	}

	public Integer getUserMicroblogsEntriesCount(long microblogsEntryUserId, int type) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("microblogsEntryUserId", microblogsEntryUserId);
			_params.put("type", type);

			_command.put("/microblogs.microblogsentry/get-user-microblogs-entries-count", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getInt(0);
	}

	public Integer getUserMicroblogsEntriesCount(long microblogsEntryUserId) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("microblogsEntryUserId", microblogsEntryUserId);

			_command.put("/microblogs.microblogsentry/get-user-microblogs-entries-count", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getInt(0);
	}

	public JSONObject updateMicroblogsEntry(long microblogsEntryId, String content, int socialRelationType, JSONObjectWrapper serviceContext) throws Exception {
		JSONObject _command = new JSONObject();

		try {
			JSONObject _params = new JSONObject();

			_params.put("microblogsEntryId", microblogsEntryId);
			_params.put("content", checkNull(content));
			_params.put("socialRelationType", socialRelationType);
			mangleWrapper(_params, "serviceContext", "com.liferay.portal.kernel.service.ServiceContext", serviceContext);

			_command.put("/microblogs.microblogsentry/update-microblogs-entry", _params);
		}
		catch (JSONException _je) {
			throw new Exception(_je);
		}

		JSONArray _result = session.invoke(_command);

		if (_result == null) {
			return null;
		}

		return _result.getJSONObject(0);
	}

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy