Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Arcgis sink. Wrong objectid in UpdateFeatures #2313

Closed
danielvillalbamota opened this issue Oct 13, 2023 · 4 comments
Closed

Arcgis sink. Wrong objectid in UpdateFeatures #2313

danielvillalbamota opened this issue Oct 13, 2023 · 4 comments

Comments

@danielvillalbamota
Copy link
Collaborator

Context

When the sink check that a feature already exist by finding the uniquefield in the Feature Layer, it prepares the request to updateFeatures on that objectId, but instead of using the received objectId is using -1:

---BODY: features=%5B%7B%22geometry%22%3A%7B%22x%22%3A0.0%2C%22y%22%3A0.0%2C%22spatialReference%22%3A%7B%22wkid%22%3A4326%7D%7D%2C%22attributes%22%3A%7B%22OBJECTID%22%3A-1%2C%22...%7D%7D%5D&f=json

Problem

I guess the following code block is not finding any key as "OBJECTID_FIELDNAME" as long as the key is in fact "objectid" and "OBJECTID_FIELDNAME" is defined as private static final String OBJECTID_FIELDNAME = "OBJECTID";

public Integer getObjectId() throws ArcgisException {
Integer objectId = -1;
for (Map.Entry<String, Object> attribute : attributes.entrySet()) {
if (OBJECTID_FIELDNAME.equals(attribute.getKey())) {
objectId = (Integer) attribute.getValue();
break;
}
}
if ("".equals(objectId)) {
throw new ArcgisException("Cant find " + GisAttributeType.OID + " in Feature Object.");
} else {
return objectId;
}
}

So, one possible solution is to check the key using equalsIgnoreCase method.

@AlvaroVega
Copy link
Member

AlvaroVega commented Oct 16, 2023

another similar usage of setObjectId (

)

@fgalan
Copy link
Member

fgalan commented Oct 16, 2023

PR #2315

@fgalan
Copy link
Member

fgalan commented Oct 16, 2023

PR merged. Let's keep this issue opened, while @danielvillalbamota can confirm it is solved.

@danielvillalbamota
Copy link
Collaborator Author

It works, now is able to update features. I close the issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants