Search in sources :

Example 6 with Date

use of org.orcid.pojo.ajaxForm.Date in project ORCID-Source by ORCID.

the class AffiliationsController method getEmptyDate.

private Date getEmptyDate() {
    Date date = new Date();
    date.setDay(new String());
    date.setMonth(new String());
    date.setYear(new String());
    return date;
}
Also used : Date(org.orcid.pojo.ajaxForm.Date)

Example 7 with Date

use of org.orcid.pojo.ajaxForm.Date in project ORCID-Source by ORCID.

the class FundingsController method getFunding.

/**
     * Returns a blank funding form
     * */
@RequestMapping(value = "/funding.json", method = RequestMethod.GET)
@ResponseBody
public FundingForm getFunding() {
    FundingForm result = new FundingForm();
    result.setAmount(new Text());
    result.setCurrencyCode(Text.valueOf(""));
    result.setDescription(new Text());
    result.setFundingName(new Text());
    result.setFundingType(Text.valueOf(""));
    result.setSourceName(new String());
    OrgDefinedFundingSubType subtype = new OrgDefinedFundingSubType();
    subtype.setAlreadyIndexed(false);
    subtype.setSubtype(Text.valueOf(""));
    result.setOrganizationDefinedFundingSubType(subtype);
    FundingTitleForm title = new FundingTitleForm();
    title.setTitle(new Text());
    TranslatedTitleForm tt = new TranslatedTitleForm();
    tt.setContent(new String());
    tt.setLanguageCode(new String());
    tt.setLanguageName(new String());
    title.setTranslatedTitle(tt);
    result.setFundingTitle(title);
    result.setUrl(new Text());
    ProfileEntity profile = profileEntityCacheManager.retrieve(getEffectiveUserOrcid());
    Visibility v = Visibility.valueOf(profile.getActivitiesVisibilityDefault() == null ? org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.FUNDING_DEFAULT.getVisibility().value()) : profile.getActivitiesVisibilityDefault());
    result.setVisibility(v);
    Date startDate = new Date();
    result.setStartDate(startDate);
    startDate.setDay("");
    startDate.setMonth("");
    startDate.setYear("");
    Date endDate = new Date();
    result.setEndDate(endDate);
    endDate.setDay("");
    endDate.setMonth("");
    endDate.setYear("");
    // Set empty contributor
    Contributor contr = new Contributor();
    List<Contributor> contrList = new ArrayList<Contributor>();
    Text rText = new Text();
    rText.setValue("");
    contr.setContributorRole(rText);
    Text sText = new Text();
    sText.setValue("");
    contr.setContributorSequence(sText);
    contrList.add(contr);
    result.setContributors(contrList);
    // Set empty external identifier
    List<FundingExternalIdentifierForm> emptyExternalIdentifiers = new ArrayList<FundingExternalIdentifierForm>();
    FundingExternalIdentifierForm f = new FundingExternalIdentifierForm();
    f.setType(Text.valueOf(DEFAULT_FUNDING_EXTERNAL_IDENTIFIER_TYPE));
    f.setUrl(new Text());
    f.setValue(new Text());
    f.setRelationship(Text.valueOf(Relationship.SELF.value()));
    emptyExternalIdentifiers.add(f);
    result.setExternalIdentifiers(emptyExternalIdentifiers);
    result.setCity(new Text());
    result.setCountry(Text.valueOf(""));
    result.setRegion(new Text());
    return result;
}
Also used : FundingForm(org.orcid.pojo.ajaxForm.FundingForm) ArrayList(java.util.ArrayList) Contributor(org.orcid.pojo.ajaxForm.Contributor) Text(org.orcid.pojo.ajaxForm.Text) FundingTitleForm(org.orcid.pojo.ajaxForm.FundingTitleForm) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Date(org.orcid.pojo.ajaxForm.Date) Visibility(org.orcid.pojo.ajaxForm.Visibility) FundingExternalIdentifierForm(org.orcid.pojo.ajaxForm.FundingExternalIdentifierForm) TranslatedTitleForm(org.orcid.pojo.ajaxForm.TranslatedTitleForm) OrgDefinedFundingSubType(org.orcid.pojo.ajaxForm.OrgDefinedFundingSubType) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 8 with Date

use of org.orcid.pojo.ajaxForm.Date in project ORCID-Source by ORCID.

the class AffiliationsController method getAffiliation.

/**
     * Returns a blank affiliation form
     * */
@RequestMapping(value = "/affiliation.json", method = RequestMethod.GET)
@ResponseBody
public AffiliationForm getAffiliation(HttpServletRequest request) {
    AffiliationForm affiliationForm = new AffiliationForm();
    ProfileEntity profile = profileEntityCacheManager.retrieve(getCurrentUserOrcid());
    Visibility v = Visibility.valueOf(profile.getActivitiesVisibilityDefault() == null ? org.orcid.jaxb.model.common_v2.Visibility.fromValue(OrcidVisibilityDefaults.FUNDING_DEFAULT.getVisibility().value()) : profile.getActivitiesVisibilityDefault());
    affiliationForm.setVisibility(v);
    Text affiliationName = new Text();
    affiliationForm.setAffiliationName(affiliationName);
    affiliationName.setRequired(true);
    Text city = new Text();
    affiliationForm.setCity(city);
    Text region = new Text();
    affiliationForm.setRegion(region);
    Text country = new Text();
    affiliationForm.setCountry(country);
    country.setValue("");
    country.setRequired(true);
    Text department = new Text();
    affiliationForm.setDepartmentName(department);
    Text roleTitle = new Text();
    affiliationForm.setRoleTitle(roleTitle);
    Text affiliationType = new Text();
    affiliationForm.setAffiliationType(affiliationType);
    affiliationType.setValue("");
    Date startDate = new Date();
    affiliationForm.setStartDate(startDate);
    startDate.setDay("");
    startDate.setMonth("");
    startDate.setYear("");
    Date endDate = new Date();
    affiliationForm.setEndDate(endDate);
    endDate.setDay("");
    endDate.setMonth("");
    endDate.setYear("");
    affiliationForm.setOrgDisambiguatedId(new Text());
    return affiliationForm;
}
Also used : AffiliationForm(org.orcid.pojo.ajaxForm.AffiliationForm) Visibility(org.orcid.pojo.ajaxForm.Visibility) Text(org.orcid.pojo.ajaxForm.Text) ProfileEntity(org.orcid.persistence.jpa.entities.ProfileEntity) Date(org.orcid.pojo.ajaxForm.Date) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Example 9 with Date

use of org.orcid.pojo.ajaxForm.Date in project ORCID-Source by ORCID.

the class PeerReviewsController method getEmptyPeerReview.

/**
     * Returns a blank peer review form
     * */
@RequestMapping(value = "/peer-review.json", method = RequestMethod.GET)
@ResponseBody
public PeerReviewForm getEmptyPeerReview() {
    Date emptyDate = new Date();
    emptyDate.setDay(StringUtils.EMPTY);
    emptyDate.setMonth(StringUtils.EMPTY);
    emptyDate.setYear(StringUtils.EMPTY);
    TranslatedTitleForm emptyTranslatedTitle = new TranslatedTitleForm();
    emptyTranslatedTitle.setErrors(Collections.<String>emptyList());
    emptyTranslatedTitle.setContent(StringUtils.EMPTY);
    emptyTranslatedTitle.setLanguageCode(StringUtils.EMPTY);
    emptyTranslatedTitle.setLanguageName(StringUtils.EMPTY);
    WorkExternalIdentifier emptyExternalId = new WorkExternalIdentifier();
    emptyExternalId.setErrors(new ArrayList<String>());
    emptyExternalId.setWorkExternalIdentifierId(Text.valueOf(StringUtils.EMPTY));
    emptyExternalId.getWorkExternalIdentifierId().setRequired(false);
    emptyExternalId.setWorkExternalIdentifierType(Text.valueOf(StringUtils.EMPTY));
    emptyExternalId.getWorkExternalIdentifierType().setRequired(false);
    emptyExternalId.setRelationship(Text.valueOf(Relationship.SELF.value()));
    emptyExternalId.setUrl(Text.valueOf(StringUtils.EMPTY));
    List<WorkExternalIdentifier> emptyExtIdsList = new ArrayList<WorkExternalIdentifier>();
    emptyExtIdsList.add(emptyExternalId);
    PeerReviewForm form = new PeerReviewForm();
    form.setErrors(Collections.<String>emptyList());
    form.setCompletionDate(emptyDate);
    form.setCreatedDate(emptyDate);
    form.setCity(Text.valueOf(StringUtils.EMPTY));
    form.setRegion(Text.valueOf(StringUtils.EMPTY));
    form.getRegion().setRequired(false);
    form.setCountry(Text.valueOf(StringUtils.EMPTY));
    form.setCountryForDisplay(StringUtils.EMPTY);
    form.setDisambiguationSource(Text.valueOf(StringUtils.EMPTY));
    form.getDisambiguationSource().setRequired(false);
    form.setOrgName(Text.valueOf(StringUtils.EMPTY));
    form.setPutCode(Text.valueOf(StringUtils.EMPTY));
    form.getPutCode().setRequired(false);
    form.setRole(Text.valueOf(Role.REVIEWER.value()));
    form.setType(Text.valueOf(PeerReviewType.REVIEW.value()));
    form.setUrl(Text.valueOf(StringUtils.EMPTY));
    form.getUrl().setRequired(false);
    form.setExternalIdentifiers(emptyExtIdsList);
    form.setGroupId(Text.valueOf(StringUtils.EMPTY));
    form.setSubjectContainerName(Text.valueOf(StringUtils.EMPTY));
    form.setSubjectExternalIdentifier(emptyExternalId);
    form.setSubjectName(Text.valueOf(StringUtils.EMPTY));
    form.setSubjectType(Text.valueOf(StringUtils.EMPTY));
    form.setSubjectUrl(Text.valueOf(StringUtils.EMPTY));
    return form;
}
Also used : ArrayList(java.util.ArrayList) WorkExternalIdentifier(org.orcid.pojo.ajaxForm.WorkExternalIdentifier) PeerReviewForm(org.orcid.pojo.ajaxForm.PeerReviewForm) Date(org.orcid.pojo.ajaxForm.Date) TranslatedTitleForm(org.orcid.pojo.ajaxForm.TranslatedTitleForm) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

Date (org.orcid.pojo.ajaxForm.Date)9 ArrayList (java.util.ArrayList)4 TranslatedTitleForm (org.orcid.pojo.ajaxForm.TranslatedTitleForm)4 Contributor (org.orcid.pojo.ajaxForm.Contributor)3 WorkExternalIdentifier (org.orcid.pojo.ajaxForm.WorkExternalIdentifier)3 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)3 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)3 CreatedDate (org.orcid.jaxb.model.common_v2.CreatedDate)2 FuzzyDate (org.orcid.jaxb.model.common_v2.FuzzyDate)2 LastModifiedDate (org.orcid.jaxb.model.common_v2.LastModifiedDate)2 PublicationDate (org.orcid.jaxb.model.common_v2.PublicationDate)2 ProfileEntity (org.orcid.persistence.jpa.entities.ProfileEntity)2 Citation (org.orcid.pojo.ajaxForm.Citation)2 FundingForm (org.orcid.pojo.ajaxForm.FundingForm)2 PeerReviewForm (org.orcid.pojo.ajaxForm.PeerReviewForm)2 Text (org.orcid.pojo.ajaxForm.Text)2 Visibility (org.orcid.pojo.ajaxForm.Visibility)2 GregorianCalendar (java.util.GregorianCalendar)1 Test (org.junit.Test)1 BaseControllerTest (org.orcid.frontend.web.util.BaseControllerTest)1