Search in sources :

Example 1 with APIException

use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.

the class PortalConnection method getJournalArticles.

public JSONArray getJournalArticles(long groupId, long userId) throws APIException {
    JSONArray journalArticles = null;
    // $NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$
    Object jsonResponse = getJSONAPI(GET_JOURNAL_ARTICLES_API, "groupId", groupId, "userId", userId, "start", -1, "end", -1, "-obc", null);
    if (jsonResponse instanceof JSONArray) {
        journalArticles = (JSONArray) jsonResponse;
    } else {
        // $NON-NLS-1$
        throw new APIException(GET_JOURNAL_ARTICLES_API, "Unable to get JSONArray");
    }
    return journalArticles;
}
Also used : APIException(com.liferay.ide.core.remote.APIException) JSONArray(org.json.JSONArray) JSONObject(org.json.JSONObject)

Example 2 with APIException

use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.

the class PortalConnection method getUserByEmailAddress.

public JSONObject getUserByEmailAddress(long companyId) throws APIException {
    JSONObject user = null;
    // $NON-NLS-1$ //$NON-NLS-2$
    Object jsonResponse = getJSONAPI(GET_USER_BY_EMAIL_ADDRESS_API, "companyId", Long.toString(companyId), "emailAddress", getUsername());
    if (jsonResponse instanceof JSONObject) {
        user = (JSONObject) jsonResponse;
    } else {
        // $NON-NLS-1$
        throw new APIException(GET_USER_BY_EMAIL_ADDRESS_API, "Unable to get JSONObject");
    }
    return user;
}
Also used : APIException(com.liferay.ide.core.remote.APIException) JSONObject(org.json.JSONObject) JSONObject(org.json.JSONObject)

Example 3 with APIException

use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.

the class PortalConnection method getStructures.

public JSONArray getStructures(long groupId) throws APIException {
    JSONArray structures = null;
    // $NON-NLS-1$
    Object jsonResponse = getJSONAPI(GET_STRUCTURES_API, "groupId", groupId);
    if (jsonResponse instanceof JSONArray) {
        structures = (JSONArray) jsonResponse;
    } else {
        // $NON-NLS-1$
        throw new APIException(GET_STRUCTURES_API, "Unable to get JSONArray");
    }
    return structures;
}
Also used : APIException(com.liferay.ide.core.remote.APIException) JSONArray(org.json.JSONArray) JSONObject(org.json.JSONObject)

Example 4 with APIException

use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.

the class PortalConnection method getUserSites.

public JSONArray getUserSites() throws APIException {
    JSONArray sites = null;
    Object jsonResponse = getJSONAPI(GET_USER_SITES_API);
    if (jsonResponse instanceof JSONArray) {
        sites = (JSONArray) jsonResponse;
    } else {
        // $NON-NLS-1$
        throw new APIException(GET_USER_SITES_API, "Unable to get JSONArray");
    }
    return sites;
}
Also used : APIException(com.liferay.ide.core.remote.APIException) JSONArray(org.json.JSONArray) JSONObject(org.json.JSONObject)

Example 5 with APIException

use of com.liferay.ide.core.remote.APIException in project liferay-ide by liferay.

the class DebugPortalLaunchParticipant method portalPostLaunch.

public void portalPostLaunch(ILaunchConfiguration configuration, String mode, ILaunch launch, IProgressMonitor monitor) throws CoreException {
    final IServer server = org.eclipse.wst.server.core.ServerUtil.getServer(configuration);
    final IServerManagerConnection connection = ServerUtil.getServerManagerConnection(server, monitor);
    if (connection != null) {
        try {
            final String fmDebugPassword = connection.getFMDebugPassword();
            final int fmDebugPort = connection.getFMDebugPort();
            if (fmDebugPassword != null && fmDebugPort != -1) {
                launch.setAttribute(PortalCore.PREF_FM_DEBUG_PASSWORD, fmDebugPassword);
                launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, Integer.toString(fmDebugPort));
                final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
                launch.addDebugTarget(target);
            }
        } catch (APIException e) {
            LiferayServerCore.logError("Unable to determine remote freemarker debugger connection info.", e);
        }
    }
    this.saveLaunchMode = null;
    final String stopServer = configuration.getAttribute(STOP_SERVER, "false");
    if (ILaunchManager.DEBUG_MODE.equals(mode) && "false".equals(stopServer)) {
        if (this.fmDebugPort != null) {
            launch.setAttribute(PortalCore.PREF_FM_DEBUG_PORT, this.fmDebugPort);
            this.fmDebugPort = null;
            final IDebugTarget target = new FMDebugTarget(server.getHost(), launch, launch.getProcesses()[0]);
            launch.addDebugTarget(target);
        } else {
            // $NON-NLS-1$
            PortalCore.logError("Launch freemarker port is invalid.");
        }
    }
}
Also used : FMDebugTarget(com.liferay.ide.portal.core.debug.fm.FMDebugTarget) IServer(org.eclipse.wst.server.core.IServer) APIException(com.liferay.ide.core.remote.APIException) IServerManagerConnection(com.liferay.ide.server.remote.IServerManagerConnection) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget)

Aggregations

APIException (com.liferay.ide.core.remote.APIException)14 JSONObject (org.json.JSONObject)11 JSONArray (org.json.JSONArray)5 JSONException (org.json.JSONException)4 File (java.io.File)2 MultipartEntity (org.apache.http.entity.mime.MultipartEntity)2 FileBody (org.apache.http.entity.mime.content.FileBody)2 IProject (org.eclipse.core.resources.IProject)2 CoreException (org.eclipse.core.runtime.CoreException)2 NullProgressMonitor (org.eclipse.core.runtime.NullProgressMonitor)2 ILiferayProject (com.liferay.ide.core.ILiferayProject)1 FMDebugTarget (com.liferay.ide.portal.core.debug.fm.FMDebugTarget)1 IServerManagerConnection (com.liferay.ide.server.remote.IServerManagerConnection)1 ArrayList (java.util.ArrayList)1 HttpPost (org.apache.http.client.methods.HttpPost)1 HttpPut (org.apache.http.client.methods.HttpPut)1 IPath (org.eclipse.core.runtime.IPath)1 IDebugTarget (org.eclipse.debug.core.model.IDebugTarget)1 IModule (org.eclipse.wst.server.core.IModule)1 IServer (org.eclipse.wst.server.core.IServer)1