Skip to content

Commit

Permalink
Working on unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
amontenegro committed Apr 1, 2024
1 parent 9cd6d05 commit 6e07ffa
Show file tree
Hide file tree
Showing 4 changed files with 330 additions and 12 deletions.
20 changes: 15 additions & 5 deletions orcid-core/src/main/java/org/orcid/pojo/grouping/WorkGroup.java
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
package org.orcid.pojo.grouping;

import org.orcid.core.togglz.Features;
import java.util.ArrayList;
import java.util.List;

import org.orcid.jaxb.model.common.Relationship;
import org.orcid.jaxb.model.common.WorkType;
import org.orcid.jaxb.model.v3.release.common.PublicationDate;
import org.orcid.jaxb.model.v3.release.record.ExternalID;
import org.orcid.jaxb.model.v3.release.record.summary.WorkSummary;
import org.orcid.pojo.WorkGroupExtended;
import org.orcid.pojo.WorkSummaryExtended;
import org.orcid.pojo.ajaxForm.*;

import java.util.ArrayList;
import java.util.List;
import org.orcid.pojo.ajaxForm.ActivityExternalIdentifier;
import org.orcid.pojo.ajaxForm.Date;
import org.orcid.pojo.ajaxForm.PojoUtil;
import org.orcid.pojo.ajaxForm.Text;
import org.orcid.pojo.ajaxForm.WorkForm;

public class WorkGroup extends ActivityGroup {

Expand All @@ -27,6 +30,13 @@ public void setWorks(List<WorkForm> works) {
this.works = works;
}

public void addWork(WorkForm work) {
if(this.works == null) {
this.works = new ArrayList<WorkForm>();
}
this.works.add(work);
}

public static WorkGroup valueOf(org.orcid.jaxb.model.v3.release.record.summary.WorkGroup workGroup, int id, String orcid) {
WorkGroup group = new WorkGroup();
group.setGroupId(id);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@
import org.orcid.pojo.ajaxForm.OtherNamesForm;
import org.orcid.pojo.ajaxForm.PojoUtil;
import org.orcid.pojo.ajaxForm.WebsitesForm;
import org.orcid.pojo.grouping.FundingGroup;
import org.orcid.pojo.grouping.WorkGroup;
import org.orcid.pojo.summary.AffiliationSummary;
import org.orcid.pojo.summary.ExternalIdentifiersSummary;
Expand All @@ -88,7 +89,6 @@
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.orcid.pojo.grouping.FundingGroup;

@Controller
public class PublicRecordController extends BaseWorkspaceController {
Expand Down Expand Up @@ -390,9 +390,7 @@ RecordSummary getSummary(String orcid) {

recordSummary.setProfessionalActivitiesCount(professionalActivities.size());

PersonExternalIdentifiers personExternalIdentifiers;

personExternalIdentifiers = externalIdentifierManagerReadOnly.getPublicExternalIdentifiers(orcid);
PersonExternalIdentifiers personExternalIdentifiers = externalIdentifierManagerReadOnly.getPublicExternalIdentifiers(orcid);

recordSummary.setExternalIdentifiers(ExternalIdentifiersSummary.valueOf(personExternalIdentifiers, orcid));

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.orcid.frontend.web.pagination;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

public class Page<T> implements Serializable {
Expand All @@ -21,6 +22,13 @@ public void setGroups(List<T> workGroups) {
this.groups = workGroups;
}

public void addWorkGroup(T workGroup) {
if(groups == null) {
groups = new ArrayList<T>();
}
groups.add(workGroup);
}

public int getNextOffset() {
return nextOffset;
}
Expand Down
Loading

0 comments on commit 6e07ffa

Please sign in to comment.