Skip to content

Commit

Permalink
Revert EntityList<> with generics to ConcreteList (ProfileList)
Browse files Browse the repository at this point in the history
Revert EntityList<> with generics to ConcreteList (ProfileList)
Carlos Manias committed Apr 18, 2014
1 parent c5874ff commit 566e491
Showing 9 changed files with 143 additions and 105 deletions.
Original file line number Diff line number Diff line change
@@ -20,7 +20,6 @@
import com.ibm.commons.util.StringUtil;
import com.ibm.commons.util.io.json.JsonJavaObject;
import com.ibm.sbt.automation.core.test.BaseApiTest;
import com.ibm.sbt.services.client.ClientServicesException;
import com.ibm.sbt.services.client.connections.profiles.Profile;
import com.ibm.sbt.services.client.connections.profiles.ProfileService;
import com.ibm.sbt.services.client.connections.profiles.ProfileServiceException;
@@ -49,9 +48,6 @@ public Profile getProfile(String userId) {
} catch (ProfileServiceException pse) {
Assert.fail("Error get profile: " + pse.getMessage());
pse.printStackTrace();
} catch (ClientServicesException e) {
Assert.fail("Error get profile: " + e.getMessage());
e.printStackTrace();
}
return profile;
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,19 @@
/*
* © Copyright IBM Corp. 2013
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at:
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
* implied. See the License for the specific language governing
* permissions and limitations under the License.
*/

package com.ibm.sbt;

import org.junit.runner.RunWith;
@@ -11,12 +27,17 @@
import com.ibm.sbt.services.client.connections.bookmarks.BookmarkServiceTest;
import com.ibm.sbt.services.client.connections.cmisfiles.CMISFileServiceTest;
import com.ibm.sbt.services.client.connections.communities.CommunityServiceTestSuite;
import com.ibm.sbt.services.client.connections.files.FileServiceTest;
import com.ibm.sbt.services.client.connections.files.FileServiceTestSuite;
import com.ibm.sbt.services.client.connections.follow.FollowServiceTest;
import com.ibm.sbt.services.client.connections.forums.ForumServiceTestSuite;
import com.ibm.sbt.services.client.connections.profiles.ProfileServiceTestSuite;
import com.ibm.sbt.services.client.connections.wikis.WikiServiceTestSuite;

/**
*
* @author Carlos Manias
*
*/
@RunWith(Suite.class)
@SuiteClasses({
// Errors/Failures/Ignored
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* ?? Copyright IBM Corp. 2013
* © Copyright IBM Corp. 2013
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ibm.sbt.services.client.connections.profiles;

import com.ibm.sbt.services.client.Response;
import com.ibm.sbt.services.client.base.IFeedHandler;
import com.ibm.sbt.services.client.base.datahandlers.AtomEntityList;


public class ColleagueConnectionList extends AtomEntityList<ColleagueConnection> {

public ColleagueConnectionList(Response requestData, IFeedHandler<ColleagueConnection> feedHandler) {
super(requestData, feedHandler);
}

}
Original file line number Diff line number Diff line change
@@ -28,7 +28,6 @@
import com.ibm.sbt.services.client.ClientServicesException;
import com.ibm.sbt.services.client.base.AtomEntity;
import com.ibm.sbt.services.client.base.BaseService;
import com.ibm.sbt.services.client.base.datahandlers.EntityList;
import com.ibm.sbt.services.client.base.datahandlers.XmlDataHandler;
import com.ibm.sbt.services.client.connections.profiles.model.ProfileXPath;

@@ -99,7 +98,7 @@ public void update() throws ProfileServiceException {
* @throws ProfileServiceException
* @throws ClientServicesException
*/
public EntityList<Profile> getColleagues() throws ProfileServiceException, ClientServicesException {
public ProfileList getColleagues() throws ProfileServiceException, ClientServicesException {
return getService().getColleagues(getUserid());
}

Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
package com.ibm.sbt.services.client.connections.profiles;

import static com.ibm.sbt.services.client.connections.profiles.utils.ProfilesConstants.FORMAT;
import static com.ibm.sbt.services.client.connections.profiles.utils.ProfilesConstants.FULL;
import static com.ibm.sbt.services.client.connections.profiles.utils.ProfilesConstants.OUTPUT;
import static com.ibm.sbt.services.client.connections.profiles.utils.ProfilesConstants.VCARD;

import java.io.IOException;
import java.util.HashMap;
import java.util.Map;

import com.ibm.commons.util.StringUtil;
import com.ibm.sbt.services.client.ClientService;
import com.ibm.sbt.services.client.ClientServicesException;
import com.ibm.sbt.services.client.base.datahandlers.EntityList;
import com.ibm.sbt.services.client.base.transformers.TransformerException;
import com.ibm.sbt.services.client.connections.profiles.utils.Messages;
import com.ibm.sbt.services.client.connections.profiles.utils.ProfilesConstants;
import com.ibm.sbt.services.endpoints.Endpoint;

/**
@@ -96,7 +98,6 @@ public void deleteProfile(String id) throws ProfileServiceException
} catch (IOException e) {
throw new ProfileServiceException(e, Messages.DeleteProfileException, id);
}

}

/**
@@ -107,8 +108,7 @@ public void deleteProfile(String id) throws ProfileServiceException
* @param Profile
* @throws ProfileServiceException
*/
public void createProfile(Profile profile) throws ProfileServiceException
{
public void createProfile(Profile profile) throws ProfileServiceException {
if (profile == null) {
throw new ProfileServiceException(null, Messages.InvalidArgument_3);
}
@@ -123,8 +123,6 @@ public void createProfile(Profile profile) throws ProfileServiceException

}catch(ClientServicesException e) {
throw new ProfileServiceException(e, Messages.CreateProfileException, profile.getUserid());
}catch (TransformerException e) {
throw new ProfileServiceException(e, Messages.CreateProfilePayloadException);
} catch (IOException e) {
throw new ProfileServiceException(e, Messages.CreateProfileException, profile.getUserid());
}
@@ -143,7 +141,7 @@ public void createProfile(Profile profile) throws ProfileServiceException
* @throws ClientServicesException
*/
@Override
public EntityList<Profile> searchProfiles(Map<String,String> parameters) throws ClientServicesException {
public ProfileList searchProfiles(Map<String,String> parameters) throws ProfileServiceException {

String url = ProfileUrls.ADMIN_PROFILES.format(this);

@@ -157,23 +155,18 @@ public EntityList<Profile> searchProfiles(Map<String,String> parameters) throws
* @throws ProfileServiceException
*/
@Override
public void updateProfile(Profile profile) throws ProfileServiceException{
public void updateProfile(Profile profile) throws ProfileServiceException {

if (profile == null) {
throw new ProfileServiceException(null, Messages.InvalidArgument_3);
}
try {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put(ProfilesConstants.OUTPUT, "vcard");
parameters.put(ProfilesConstants.FORMAT, "full");
parameters.put(OUTPUT, VCARD);
parameters.put(FORMAT, FULL);
String id = profile.getUserid();
parameters.put(getIdParameter(id), id);
Object updateProfilePayload;
try {
updateProfilePayload = constructUpdateRequestBody(profile);
} catch (TransformerException e) {
throw new ProfileServiceException(e);
}
Object updateProfilePayload = constructUpdateRequestBody(profile);
String updateUrl = ProfileUrls.ADMIN_PROFILE_ENTRY.format(this);
super.updateData(updateUrl, parameters,updateProfilePayload, getIdParameter(profile.getAsString("uid")));
profile.clearFieldsMap();
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ibm.sbt.services.client.connections.profiles;

import com.ibm.sbt.services.client.Response;
import com.ibm.sbt.services.client.base.IFeedHandler;
import com.ibm.sbt.services.client.base.datahandlers.AtomEntityList;


public class ProfileList extends AtomEntityList<Profile> {

public ProfileList(Response requestData, IFeedHandler<Profile> feedHandler) {
super(requestData, feedHandler);
}

}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
package com.ibm.sbt.services.client.connections.profiles;

import com.ibm.sbt.services.client.Response;
import com.ibm.sbt.services.client.base.IFeedHandler;
import com.ibm.sbt.services.client.base.datahandlers.AtomEntityList;


public class TagList extends AtomEntityList<Tag> {

public TagList(Response requestData, IFeedHandler<Tag> feedHandler) {
super(requestData, feedHandler);
}

}

0 comments on commit 566e491

Please sign in to comment.