--- /dev/null
+/*
+ * (C) 2015 EDF
+ */
+package com.edf.gde.dao;
+
+import com.edf.gde.transferables.CommandTO;
+import com.edf.gde.transferables.ProfileAttributeTO;
+import com.edf.gde.transferables.ProfileTO;
+import java.io.IOException;
+import restapi.RestContext;
+
+/**
+ *
+ * @author mordicus
+ */
+public class ProfileDaoClient extends BaseDao {
+
+ public static final String ServiceName = "AttributesService";
+ public static final int CREATEPROFILE = 1;
+ public static final int DELETEPROFILE = 2;
+ public static final int READPROFILE = 3;
+ public static final int UPDATEPROFILE = 4;
+ public static final int CREATEPROFILEATTRIBUTE = 5;
+ public static final int DELETEPROFILEATTRIBUTE = 6;
+ public static final int READPROFILEATTRIBUTE = 7;
+ public static final int UPDATEPROFILEATTRIBUTE = 8;
+
+ public ProfileDaoClient() {
+ getContext().setBaseResource("http://localhost:8080/GDE-war/ProfileService");
+ getContext().setUserName("admin");
+ getContext().setPassword("edf123");
+ }
+
+ public ProfileDaoClient(RestContext context) {
+ super(context);
+ }
+
+ public ProfileTO createProfile(ProfileTO profileTO) throws IOException {
+ CommandTO commandTO = createCommand(CREATEPROFILE);
+ return postCommand(commandTO, profileTO, ProfileTO.class);
+ }
+
+ public void deleteProfile(long profileId) throws IOException {
+ CommandTO commandTO = createCommand(DELETEPROFILE);
+ commandTO.setLong("profileId", profileId);
+ postCommand(commandTO, null);
+ }
+
+ public ProfileTO readProfile(long profileId) throws IOException {
+ CommandTO commandTO = createCommand(READPROFILE);
+ commandTO.setLong("profileId", profileId);
+ return postCommand(commandTO, null, ProfileTO.class);
+ }
+
+ public ProfileTO updateProfile(ProfileTO profileTO) throws IOException {
+ CommandTO commandTO = createCommand(UPDATEPROFILE);
+ return postCommand(commandTO, profileTO, ProfileTO.class);
+ }
+
+ public ProfileAttributeTO createProfileAttribute(ProfileAttributeTO attributeTO) throws IOException {
+ CommandTO commandTO = createCommand(CREATEPROFILEATTRIBUTE);
+ return postCommand(commandTO, attributeTO, ProfileAttributeTO.class);
+ }
+
+ public void deleteProfileAttribute(long profileAttributeId) throws IOException {
+ CommandTO commandTO = createCommand(DELETEPROFILEATTRIBUTE);
+ commandTO.setLong("profileAttributeId", profileAttributeId);
+ postCommand(commandTO, null);
+ }
+
+ public ProfileAttributeTO readProfileAttribute(long profileAttributeId) throws IOException {
+ CommandTO commandTO = createCommand(READPROFILEATTRIBUTE);
+ commandTO.setLong("profileAttributeId", profileAttributeId);
+ return postCommand(commandTO, null, ProfileAttributeTO.class);
+ }
+
+ public ProfileAttributeTO updateProfileAttribute(ProfileAttributeTO attributeTO) throws IOException {
+ CommandTO commandTO = createCommand(UPDATEPROFILEATTRIBUTE);
+ return postCommand(commandTO, attributeTO, ProfileAttributeTO.class);
+ }
+
+}