[Building Sakai] Periods in site_ids and entitybroker?

Matthew Jones jonespm at umich.edu
Sun Jan 16 20:57:20 PST 2011


I tested a site-id with a period in the id and it resolved okay with the
site entity in the 2.7.x nightly2 entitybroker. It looks like that
discussion was about id's with spaces in them which was filed as "
https://jira.sakaiproject.org/browse/SAK-18893"

[image: sites with period.png]

However the way that message center is calling it is failing as Sam
mentioned in the jira. It's not appending a format as most requests to
entitybroker expect and in the call to convert the "locationReference" to
EntityReference, it's removing the last period which it doesn't expect to
exist in the first place.

./utils/src/java/org/sakaiproject/entitybroker/util/devhelper/AbstractDeveloperHelperService.java
246
247     public String getLocationIdFromRef(String locationReference) {
248         String locationId = null;
249         if (locationReference != null) {
250             // assume the form of "/site/siteId" (the Site method is
protected)
251             locationId = new EntityReference(locationReference).getId();
252         }
253         return locationId;
254     }

The locationReference it's passing in is
2011-01-16 04:39:43,459 INFO http-8087-Processor19
org.sakaiproject.tool.messageforums.DiscussionForumTool - context:
/site/test.test

And the EntityReference constructor turns this into "test" because it trims
off the extension and period
./api/src/java/org/sakaiproject/entitybroker/EntityReference.java
304             if (spos2 == -1) {
305                 // trim off the extension from the end
306                 spos2 = reference.lastIndexOf(PERIOD);
307             }

org.sakaiproject.exception.IdUnusedException id=test

There's probably a couple ways to *hack* around this and a way to fix it,
don't know which is better.

Since a normal site won't have a period anyway, msgcntr could probably
append period to every location before it get's processed by
EntityReference. Either in msgcntr getMessageURL(DiscussionForumTool.java)
or in entitybroker
DeveloperHelperServiceImpl.getToolViewURL(DeveloperHelperServiceImpl.java).
This should force this one to get removed. Ideally
"getLocationIdFromRef" probably wouldn't be using the EntityReference
function to parse this location (or the function would be more specific
about picking off extensions for ALL_KNOWN_FORMATS), not sure what's better
to use.

Period should be an acceptable character though.

-Matthew

On Sun, Jan 16, 2011 at 3:29 AM, Kenwrick Chan <kchan at hawaii.edu> wrote:

> Folks,
> We ran into a situation where a faculty wanted to edit student posts and
> kept on generating errors.  As it turns out it's an issue (at least I think)
> with our site_ids having periods in them conflicting with entitybroker.
>
> https://jira.sakaiproject.org/browse/MSGCNTR-334
>
> and
>
> http://old.nabble.com/-Building-Sakai--EntityBroker.-Spaces-in-custom-action-entity-ids-td29327192i20.html
>
> which Sam Ottenhoff writes.
>
> We did it because we found site_ids containing
> > periods.   The period is used as a prefix separator and is
> > inappropriate as a separator
>
> Now clearly showing my lack of entitybroker specifics ...
>
> 1) is this a long term issue?
> 2) is there no other solution allowing for periods in our site_ids [these
> come from our student information system
>
> any suggestions?
>
> Thanks,
> Ken
>
> _______________________________________________
> sakai-dev mailing list
> sakai-dev at collab.sakaiproject.org
> http://collab.sakaiproject.org/mailman/listinfo/sakai-dev
>
> TO UNSUBSCRIBE: send email to
> sakai-dev-unsubscribe at collab.sakaiproject.org with a subject of
> "unsubscribe"
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110116/86a1351e/attachment.html 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: image/png
Size: 11638 bytes
Desc: not available
Url : http://collab.sakaiproject.org/pipermail/sakai-dev/attachments/20110116/86a1351e/attachment.png 


More information about the sakai-dev mailing list