Hello Francisco,

This work for me in DSPACE 6.1:

public int doProcessing(Context context, HttpServletRequest request,
            HttpServletResponse response, SubmissionInfo subInfo)
            throws ServletException, IOException, SQLException,
            AuthorizeException
    {
            EPerson submitter = context.getCurrentUser();
            String name = submitter.getLastName() + ", " + 
submitter.getFirstName();
            Item item = subInfo.getSubmissionItem().getItem();
            
            itemService.addMetadata(context, item, "dc", "contributor", 
"responsable", null, name);
            // commit all changes to DB
            
ContentServiceFactory.getInstance().getInProgressSubmissionService(subInfo.getSubmissionItem()).update(context,
 
subInfo.getSubmissionItem());
            context.dispatchEvents();
            return STATUS_COMPLETE;
    }


Em quinta-feira, 10 de agosto de 2017 19:35:07 UTC-3, Francisco escreveu:
>
> ​Hi Andrea
> thank you for help me
>
> trying to solve that error, but need more information how to do it 
> Apparently is a sintax error of addMetadata() method
> i can´t find the source code of this method to see what kind of parameters 
> it takes
>
> send you a screen picture with the source and de error, any idea ?
>
> thanks
>
> 2017-08-09 3:24 GMT-03:00 Andrea Schweer <sch...@waikato.ac.nz 
> <javascript:>>:
>
>> actually looking at the doProcessing method in InitialQuestionsStep, you 
>> probably need 
>>
>> context.commit();return STATUS_COMPLETE; // no errors!
>>
>>
>> at the end of the doProcessing method too
>>
>>
>> On 08/09/2017 06:22 PM, Andrea Schweer wrote:
>>
>> Hi,
>>
>> I think it's as easy as this (5.x code, you may need to adjust for 6.x):
>>
>> public class SubmitterAsAuthor extends AbstractProcessingStep {
>>     @Override    public int doProcessing(Context context, HttpServletRequest 
>> request, HttpServletResponse response, SubmissionInfo subInfo) throws 
>> ServletException, IOException, SQLException, AuthorizeException {
>>         EPerson submitter = context.getCurrentUser();        String name = 
>> submitter.getLastName() + ", " + submitter.getFirstName();        Item item 
>> = subInfo.getSubmissionItem().getItem();        item.addMetadata("dc", 
>> "contributor", "author", null, name);        item.update();    }
>>
>>     @Override    public int getNumberOfPages(HttpServletRequest request, 
>> SubmissionInfo subInfo) throws ServletException {
>>         return 1;    }
>> }
>>
>>
>> But no promises that will work!
>>
>> cheers,
>> Andrea
>>
>> On 08/09/2017 02:53 AM, Francisco wrote:
>>
>> sorry 
>>
>> im working with dspace6 xmlui mirage2 
>>
>> El martes, 8 de agosto de 2017, 11:33:03 (UTC-3), Francisco escribió: 
>>>
>>> Thanks Andrea for responding (and fast)
>>>
>>> I would need some example of how to reference the current user within 
>>> java code to make assignments to the dc.author or dc.publisher element
>>>
>>> THANK YOU VERY MUCH AGAIN  ;)
>>>
>>>
>>>
>>> El martes, 8 de agosto de 2017, 0:06:32 (UTC-3), Andrea Schweer 
>>> escribió: 
>>>>
>>>> Hi, 
>>>>
>>>> On 08/08/2017 01:55 PM, Francisco wrote: 
>>>> > want to automatic assign in current submission step 
>>>> > dc.autor take the value of current user (eperson.lastname + 
>>>> > eperson.firstname) 
>>>> > without ask 
>>>>
>>>> I'd recommend creating a custom non-interactive submission step that 
>>>> does this work. You don't say what version of DSpace you're working 
>>>> with; here's the documentation for version 6.x: 
>>>>
>>>> https://wiki.duraspace.org/display/DSDOC6x/Submission+User+Interface#SubmissionUserInterface-CreatingaNon-InteractiveStep
>>>>  
>>>>
>>>>
>>>> https://wiki.duraspace.org/display/DSDOC6x/Submission+User+Interface#SubmissionUserInterface-UnderstandingtheSubmissionConfigurationFile
>>>>  
>>>> and 
>>>>
>>>> https://wiki.duraspace.org/display/DSDOC6x/Submission+User+Interface#SubmissionUserInterface-Reordering/Removing/AddingSubmissionSteps
>>>>  
>>>> tell you how to activate your custom step. You'd presumably want yours 
>>>> right after the initial questions step. 
>>>>
>>>> cheers, 
>>>> Andrea 
>>>>
>>>> -- 
>>>> Dr Andrea Schweer 
>>>> Lead Software Developer, ITS Information Systems 
>>>> The University of Waikato, Hamilton, New Zealand 
>>>> +64-7-837 9120 
>>>>
>>>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "DSpace Technical Support" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to dspace-tech...@googlegroups.com <javascript:>.
>> To post to this group, send email to dspac...@googlegroups.com 
>> <javascript:>.
>> Visit this group at https://groups.google.com/group/dspace-tech.
>> For more options, visit https://groups.google.com/d/optout.
>>
>>
>> -- 
>> Dr Andrea Schweer
>> Lead Software Developer, ITS Information Systems
>> The University of Waikato, Hamilton, New Zealand
>> +64-7-837 9120
>>
>>
>> -- 
>> Dr Andrea Schweer
>> Lead Software Developer, ITS Information Systems
>> The University of Waikato, Hamilton, New Zealand
>> +64-7-837 9120
>>
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"DSpace Technical Support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to dspace-tech+unsubscr...@googlegroups.com.
To post to this group, send email to dspace-tech@googlegroups.com.
Visit this group at https://groups.google.com/group/dspace-tech.
For more options, visit https://groups.google.com/d/optout.

Reply via email to