You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@usergrid.apache.org by GERey <gi...@git.apache.org> on 2016/02/22 19:11:27 UTC
[GitHub] usergrid pull request: Default collections and application delete
GitHub user GERey opened a pull request:
https://github.com/apache/usergrid/pull/488
Default collections and application delete
You can merge this pull request into a Git repository by running:
$ git pull https://github.com/GERey/usergrid defaultCollections_AndApplicationDelete
Alternatively you can review and apply these changes as the patch at:
https://github.com/apache/usergrid/pull/488.patch
To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:
This closes #488
----
----
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] usergrid pull request: Default collections and application delete
Posted by asfgit <gi...@git.apache.org>.
Github user asfgit closed the pull request at:
https://github.com/apache/usergrid/pull/488
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] usergrid pull request: Default collections and application delete
Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:
https://github.com/apache/usergrid/pull/488#discussion_r55393601
--- Diff: stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java ---
@@ -745,7 +745,32 @@ public RelationManager getRelationManager( EntityRef entityRef ) {
@Override
public Set<String> getApplicationCollections() throws Exception {
- return getRelationManager( getApplication() ).getCollections();
+ Set<String> existingCollections = getRelationManager( getApplication() ).getCollections();
+
+ //Handles reading custom collections.
+// Set<String> dynamic_collections = cast( getDictionaryAsSet( getApplicationRef(), Schema.DICTIONARY_COLLECTIONS ) );
--- End diff --
This was left here as a way to see how custom collections used to be queried but probably should be deleted and replaced with a jira ticket.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] usergrid pull request: Default collections and application delete
Posted by michaelarusso <gi...@git.apache.org>.
Github user michaelarusso commented on a diff in the pull request:
https://github.com/apache/usergrid/pull/488#discussion_r54054170
--- Diff: stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java ---
@@ -482,20 +482,27 @@ public ApiResponse executePut( @Context UriInfo ui, String body,
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public ApiResponse executeDelete( @Context UriInfo ui,
@QueryParam("callback") @DefaultValue("callback") String callback,
- @QueryParam("app_delete_confirm") String confirmDelete) throws Exception {
+ @QueryParam("application_identifier") String applicationConfirmedDelete) throws Exception {
- if (!"confirm_delete_of_application_and_data".equals( confirmDelete ) ) {
+ //If the path uses name then expect name, otherwise if they use uuid then expect uuid.
+ if(application==null){
+ if(!applicationId.toString().equals( applicationConfirmedDelete )){
+ throw new IllegalArgumentException(
+ "Cannot delete application without supplying correct application id.");
+ }
+ }
+ else if (!application.getName().equals( applicationConfirmedDelete ) ) {
throw new IllegalArgumentException(
- "Cannot delete application without app_delete_confirm parameter");
+ "Cannot delete application without supplying correct application name");
}
- Properties props = management.getProperties();
-
- // for now, only works in test mode
- String testProp = ( String ) props.get( "usergrid.test" );
- if ( testProp == null || !Boolean.parseBoolean( testProp ) ) {
- throw new UnsupportedRestOperationException("Test props not not functioning correctly.");
- }
+// Properties props = management.getProperties();
+//
--- End diff --
Can we remove the commented code?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] usergrid pull request: Default collections and application delete
Posted by michaelarusso <gi...@git.apache.org>.
Github user michaelarusso commented on a diff in the pull request:
https://github.com/apache/usergrid/pull/488#discussion_r54054137
--- Diff: stack/core/src/main/java/org/apache/usergrid/corepersistence/CpEntityManager.java ---
@@ -745,7 +745,32 @@ public RelationManager getRelationManager( EntityRef entityRef ) {
@Override
public Set<String> getApplicationCollections() throws Exception {
- return getRelationManager( getApplication() ).getCollections();
+ Set<String> existingCollections = getRelationManager( getApplication() ).getCollections();
+
+ //Handles reading custom collections.
+// Set<String> dynamic_collections = cast( getDictionaryAsSet( getApplicationRef(), Schema.DICTIONARY_COLLECTIONS ) );
--- End diff --
is this left here as a TODO?
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
[GitHub] usergrid pull request: Default collections and application delete
Posted by GERey <gi...@git.apache.org>.
Github user GERey commented on a diff in the pull request:
https://github.com/apache/usergrid/pull/488#discussion_r55393687
--- Diff: stack/rest/src/main/java/org/apache/usergrid/rest/management/organizations/applications/ApplicationResource.java ---
@@ -482,20 +482,27 @@ public ApiResponse executePut( @Context UriInfo ui, String body,
@Produces({MediaType.APPLICATION_JSON, "application/javascript"})
public ApiResponse executeDelete( @Context UriInfo ui,
@QueryParam("callback") @DefaultValue("callback") String callback,
- @QueryParam("app_delete_confirm") String confirmDelete) throws Exception {
+ @QueryParam("application_identifier") String applicationConfirmedDelete) throws Exception {
- if (!"confirm_delete_of_application_and_data".equals( confirmDelete ) ) {
+ //If the path uses name then expect name, otherwise if they use uuid then expect uuid.
+ if(application==null){
+ if(!applicationId.toString().equals( applicationConfirmedDelete )){
+ throw new IllegalArgumentException(
+ "Cannot delete application without supplying correct application id.");
+ }
+ }
+ else if (!application.getName().equals( applicationConfirmedDelete ) ) {
throw new IllegalArgumentException(
- "Cannot delete application without app_delete_confirm parameter");
+ "Cannot delete application without supplying correct application name");
}
- Properties props = management.getProperties();
-
- // for now, only works in test mode
- String testProp = ( String ) props.get( "usergrid.test" );
- if ( testProp == null || !Boolean.parseBoolean( testProp ) ) {
- throw new UnsupportedRestOperationException("Test props not not functioning correctly.");
- }
+// Properties props = management.getProperties();
+//
--- End diff --
This one was my bad. The commented out code should be good.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---