/** * Wrapper method is used to delete/ignore a Invite * * @param connectionId unique id of the connection * @return returns true if invite is deleted successfully * @throws ProfileServiceException */ public boolean deleteInvite(String connectionId) throws ProfileServiceException { if (logger.isLoggable(Level.FINEST)) { logger.entering(sourceClass, "deleteInvite", connectionId); } Map<String, String> parameters = new HashMap<String, String>(); parameters.put(ProfileRequestParams.CONNECTIONID, connectionId); String url = resolveProfileUrl( ProfileEntity.NONADMIN.getProfileEntityType(), ProfileType.CONNECTION.getProfileType()); boolean result = executeDelete(url, parameters); if (logger.isLoggable(Level.FINEST)) { logger.exiting(sourceClass, "deleteInvite"); } return result; }
/** * Wrapper method to accept a Invite * * @param connectionId unique id of the connection * @param title message to the other user * @param content message to the other user * @return if invite is accepted then return true * @throws ProfileServiceException */ public boolean acceptInvite(String connectionId, String title, String content) throws ProfileServiceException { if (logger.isLoggable(Level.FINEST)) { logger.entering(sourceClass, "acceptInvite", connectionId); } Map<String, String> parameters = new HashMap<String, String>(); parameters.put(ProfileRequestParams.CONNECTIONID, connectionId); String url = resolveProfileUrl( ProfileEntity.NONADMIN.getProfileEntityType(), ProfileType.CONNECTION.getProfileType()); XMLProfilesPayloadBuilder builder = XMLProfilesPayloadBuilder.INSTANCE; Object payload = builder.generateAcceptInvitePayload(connectionId, title, content); boolean result = executePut(url, parameters, null, payload, null); if (logger.isLoggable(Level.FINEST)) { logger.exiting(sourceClass, "acceptInvite"); } return result; }
/** * Wrapper method to get check if two users are colleagues * * @param sourceId userid or email of first user * @param targetId userid or email of second user * @param parameters list of query string parameters to pass to API * @return ConnectionEntry * @throws ProfileServiceException */ private ConnectionEntry checkColleague( String sourceId, String targetId, Map<String, String> parameters) throws ProfileServiceException { if (logger.isLoggable(Level.FINEST)) { logger.entering(sourceClass, "checkColleague"); } if (StringUtil.isEmpty(sourceId)) { throw new IllegalArgumentException(Messages.InvalidArgument_4); } if (StringUtil.isEmpty(targetId)) { throw new IllegalArgumentException(Messages.InvalidArgument_5); } Document data = null; if (parameters == null) { parameters = new HashMap<String, String>(); } String url = resolveProfileUrl( ProfileEntity.NONADMIN.getProfileEntityType(), ProfileType.CONNECTION.getProfileType()); if (isEmail(sourceId)) { parameters.put(ProfileRequestParams.SOURCEEMAIL, sourceId); } else { parameters.put(ProfileRequestParams.SOURCEUSERID, sourceId); } if (isEmail(targetId)) { parameters.put(ProfileRequestParams.TARGETEMAIL, targetId); } else { parameters.put(ProfileRequestParams.TARGETUSERID, targetId); } parameters.put("connectionType", "colleague"); data = executeGet(url, parameters, ClientService.FORMAT_XML); ConnectionEntry connection = Converter.returnConnectionEntries(data, "connectionEntry").iterator().next(); if (logger.isLoggable(Level.FINEST)) { logger.exiting(sourceClass, "getColleagues"); } return connection; }