diff --git a/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/exceptions/ErrorCodeRegistry.java b/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/exceptions/ErrorCodeRegistry.java index e1d06ff..4cead1c 100644 --- a/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/exceptions/ErrorCodeRegistry.java +++ b/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/exceptions/ErrorCodeRegistry.java @@ -118,47 +118,12 @@ public interface ErrorCodeRegistry /** The site could not be found. */ int SITE_NOTFOUND = 402; - /** - * Failed to add favorite site. - * - * @since 1.1.0 - */ - int SITE_NOT_FAVORITED = 403; - - /** - * Failed to remove favorite site. - * - * @since 1.1.0 - */ - int SITE_NOT_UNFAVORITED = 404; - /** * User is already a member or requested to be a member of the site. * * @since 1.1.0 */ - int SITE_ALREADY_MEMBER = 405; - - /** - * Failed to join site. - * - * @since 1.1.0 - */ - int SITE_NOT_JOINED = 406; - - /** - * Failed to cancel request to join site. - * - * @since 1.1.0 - */ - int SITE_CANCEL_JOINED = 407; - - /** - * Failed to leave site. - * - * @since 1.1.0 - */ - int SITE_NOT_LEFT = 408; + int SITE_ALREADY_MEMBER = 403; // /////////////////////////////////// // ACTIVITI STREAM ERRORS diff --git a/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractSiteServiceImpl.java b/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractSiteServiceImpl.java index 2da5df2..20b9c65 100644 --- a/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractSiteServiceImpl.java +++ b/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/AbstractSiteServiceImpl.java @@ -254,7 +254,7 @@ public void cancelJoinSiteRequest(JoinSiteRequestImpl joinSiteRequest) try { String link = getCancelJoinSiteRequestUrl(joinSiteRequest); - delete(new UrlBuilder(link), ErrorCodeRegistry.SITE_CANCEL_JOINED); + delete(new UrlBuilder(link), ErrorCodeRegistry.SITE_GENERIC); } catch (Exception e) { @@ -284,13 +284,13 @@ public Site cancelRequestToJoinSite(Site site) } if (isObjectNull(joinSiteRequest)) { throw new AlfrescoServiceException( - ErrorCodeRegistry.SITE_CANCEL_JOINED, + ErrorCodeRegistry.SITE_GENERIC, Messagesl18n.getString("ErrorCodeRegistry.SITE_NOT_JOINED.parsing")); } String link = getCancelJoinSiteRequestUrl(joinSiteRequest); - delete(new UrlBuilder(link), ErrorCodeRegistry.SITE_CANCEL_JOINED); + delete(new UrlBuilder(link), ErrorCodeRegistry.SITE_GENERIC); updatedSite = new SiteImpl(site, false, false, site.isFavorite()); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_CANCEL_JOINED); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); } catch (Exception e) { @@ -319,10 +319,10 @@ public Site leaveSite(Site site) try { String link = getLeaveSiteUrl(site); - delete(new UrlBuilder(link), ErrorCodeRegistry.SITE_NOT_LEFT); + delete(new UrlBuilder(link), ErrorCodeRegistry.SITE_GENERIC); updateExtraPropertyCache(site.getShortName(), false, false, site.isFavorite()); updatedSite = new SiteImpl(site, false, false, site.isFavorite()); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_NOT_LEFT); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); } catch (Exception e) { diff --git a/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/cloud/CloudSiteServiceImpl.java b/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/cloud/CloudSiteServiceImpl.java index 2dd7980..7310e4c 100644 --- a/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/cloud/CloudSiteServiceImpl.java +++ b/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/cloud/CloudSiteServiceImpl.java @@ -185,10 +185,10 @@ public void write(OutputStream out) throws IOException { formDataM.write(out); } - }, ErrorCodeRegistry.SITE_NOT_FAVORITED); + }, ErrorCodeRegistry.SITE_GENERIC); updateExtraPropertyCache(site.getIdentifier(), site.isPendingMember(), site.isMember(), true); updatedSite = new SiteImpl(site, site.isPendingMember(), site.isMember(), true); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_NOT_FAVORITED); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); } catch (Exception e) { @@ -210,10 +210,10 @@ public Site removeFavoriteSite(Site site) { String link = CloudUrlRegistry.getRemoveUserPreferenceUrl((CloudSession) session, session.getPersonIdentifier(), site.getGUID()); - delete(new UrlBuilder(link), ErrorCodeRegistry.SITE_NOT_UNFAVORITED); + delete(new UrlBuilder(link), ErrorCodeRegistry.SITE_GENERIC); updateExtraPropertyCache(site.getIdentifier(), site.isPendingMember(), site.isMember(), false); updatedSite = new SiteImpl(site, site.isPendingMember(), site.isMember(), false); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_NOT_UNFAVORITED); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); } catch (Exception e) { @@ -268,7 +268,7 @@ public void write(OutputStream out) throws IOException updateExtraPropertyCache(site.getIdentifier(), false, true, site.isFavorite()); updatedSite = new SiteImpl(site, false, true, site.isFavorite()); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_NOT_JOINED); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); break; case MODERATED: @@ -285,22 +285,22 @@ public void write(OutputStream out) throws IOException { updateExtraPropertyCache(site.getIdentifier(), true, false, site.isFavorite()); updatedSite = new SiteImpl(site, true, false, site.isFavorite()); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_NOT_JOINED); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); } else { - throw new AlfrescoServiceException(ErrorCodeRegistry.SITE_NOT_JOINED, + throw new AlfrescoServiceException(ErrorCodeRegistry.SITE_GENERIC, Messagesl18n.getString("ErrorCodeRegistry.SITE_NOT_JOINED.parsing")); } break; case PRIVATE: - throw new AlfrescoServiceException(ErrorCodeRegistry.SITE_NOT_JOINED, + throw new AlfrescoServiceException(ErrorCodeRegistry.SITE_GENERIC, Messagesl18n.getString("ErrorCodeRegistry.SITE_NOT_JOINED.private")); default: if (resp.getResponseCode() != HttpStatus.SC_OK && resp.getResponseCode() != HttpStatus.SC_CREATED) { - convertStatusCode(resp, ErrorCodeRegistry.SITE_NOT_JOINED); + convertStatusCode(resp, ErrorCodeRegistry.SITE_GENERIC); } throw new IllegalArgumentException(String.format( Messagesl18n.getString("ErrorCodeRegistry.GENERAL_INVALID_ARG_NULL"), "visibility")); diff --git a/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/onpremise/OnPremiseSiteServiceImpl.java b/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/onpremise/OnPremiseSiteServiceImpl.java index d55a8d7..90fdab3 100644 --- a/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/onpremise/OnPremiseSiteServiceImpl.java +++ b/alfresco-mobile-android-client-api/src/main/java/org/alfresco/mobile/android/api/services/impl/onpremise/OnPremiseSiteServiceImpl.java @@ -243,10 +243,10 @@ public void write(OutputStream out) throws IOException { formDataM.write(out); } - }, ErrorCodeRegistry.SITE_NOT_FAVORITED); + }, ErrorCodeRegistry.SITE_GENERIC); updateExtraPropertyCache(site.getIdentifier(), site.isPendingMember(), site.isMember(), addSite); updatedSite = new SiteImpl(site, site.isPendingMember(), site.isMember(), addSite); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_NOT_FAVORITED); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); } catch (Exception e) { @@ -364,7 +364,7 @@ public void write(OutputStream out) throws IOException { formData.write(out); } - }, ErrorCodeRegistry.SITE_NOT_JOINED); + }, ErrorCodeRegistry.SITE_GENERIC); // By default Contains informations about authority & // membership @@ -372,7 +372,7 @@ public void write(OutputStream out) throws IOException updateExtraPropertyCache(site.getIdentifier(), false, true, site.isFavorite()); updatedSite = new SiteImpl(site, false, true, site.isFavorite()); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_NOT_JOINED); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); break; case MODERATED: @@ -400,23 +400,23 @@ public void write(OutputStream out) throws IOException { formDataM.write(out); } - }, ErrorCodeRegistry.SITE_NOT_JOINED); + }, ErrorCodeRegistry.SITE_GENERIC); json = JsonUtils.parseObject(resp.getStream(), resp.getCharset()); Map jmo = (Map) json.get(OnPremiseConstant.DATA_VALUE); if (jmo != null) { updateExtraPropertyCache(site.getIdentifier(), true, false, site.isFavorite()); updatedSite = new SiteImpl(site, true, false, site.isFavorite()); - validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_NOT_JOINED); + validateUpdateSite(updatedSite, ErrorCodeRegistry.SITE_GENERIC); } else { - throw new AlfrescoServiceException(ErrorCodeRegistry.SITE_NOT_JOINED, + throw new AlfrescoServiceException(ErrorCodeRegistry.SITE_GENERIC, Messagesl18n.getString("ErrorCodeRegistry.SITE_NOT_JOINED.parsing")); } break; case PRIVATE: - throw new AlfrescoServiceException(ErrorCodeRegistry.SITE_NOT_JOINED, + throw new AlfrescoServiceException(ErrorCodeRegistry.SITE_GENERIC, Messagesl18n.getString("ErrorCodeRegistry.SITE_NOT_JOINED.private")); default: throw new IllegalArgumentException(String.format( diff --git a/tests/alfresco-mobile-android-unit-test-api-cloud/src/org/alfresco/mobile/android/test/api/cloud/services/CloudDocumentFolderServiceTest.java b/tests/alfresco-mobile-android-unit-test-api-cloud/src/org/alfresco/mobile/android/test/api/cloud/services/CloudDocumentFolderServiceTest.java index 17c40f8..aabb23c 100644 --- a/tests/alfresco-mobile-android-unit-test-api-cloud/src/org/alfresco/mobile/android/test/api/cloud/services/CloudDocumentFolderServiceTest.java +++ b/tests/alfresco-mobile-android-unit-test-api-cloud/src/org/alfresco/mobile/android/test/api/cloud/services/CloudDocumentFolderServiceTest.java @@ -125,4 +125,11 @@ public void checkRendition(Document doc, boolean validateRendition, boolean vali } } } + + @Override + public void testCRUDNode() + { + super.testCRUDNode(); + } + } diff --git a/tests/alfresco-mobile-android-unit-test-api/src/org/alfresco/mobile/android/test/api/services/SiteServicesTest.java b/tests/alfresco-mobile-android-unit-test-api/src/org/alfresco/mobile/android/test/api/services/SiteServicesTest.java index 274b13c..0b91f59 100644 --- a/tests/alfresco-mobile-android-unit-test-api/src/org/alfresco/mobile/android/test/api/services/SiteServicesTest.java +++ b/tests/alfresco-mobile-android-unit-test-api/src/org/alfresco/mobile/android/test/api/services/SiteServicesTest.java @@ -771,7 +771,7 @@ public void testSiteMembership() } catch (AlfrescoServiceException e) { - Assert.assertTrue(e.getErrorCode() == ErrorCodeRegistry.SITE_NOT_JOINED); + Assert.assertTrue(e.getErrorCode() == ErrorCodeRegistry.SITE_GENERIC); } // It's not possible to join a moderated site where user has already a @@ -810,7 +810,7 @@ public void testSiteMembership() } catch (AlfrescoServiceException e) { - Assert.assertTrue(e.getErrorCode() == ErrorCodeRegistry.SITE_CANCEL_JOINED); + Assert.assertTrue(e.getErrorCode() == ErrorCodeRegistry.SITE_GENERIC); } // It's not possible to leave a fake site @@ -832,7 +832,7 @@ public void testSiteMembership() } catch (AlfrescoServiceException e) { - Assert.assertTrue(e.getErrorCode() == ErrorCodeRegistry.SITE_NOT_LEFT); + Assert.assertTrue(e.getErrorCode() == ErrorCodeRegistry.SITE_GENERIC); } // It's not possible to leave a private site where you are not member @@ -843,7 +843,7 @@ public void testSiteMembership() } catch (AlfrescoServiceException e) { - Assert.assertTrue(e.getErrorCode() == ErrorCodeRegistry.SITE_NOT_LEFT); + Assert.assertTrue(e.getErrorCode() == ErrorCodeRegistry.SITE_GENERIC); } }