From 27d3b0206cb63f153c18f108cdffb1f59703c5a4 Mon Sep 17 00:00:00 2001 From: tworrall Date: Fri, 22 Nov 2013 09:56:46 -0500 Subject: [PATCH] VIVO-567 --- .../edit/forms/addMemberRoleToPerson.ftl | 54 ++++---- .../AddMemberRoleToPersonGenerator.java | 131 +++++++++++------- 2 files changed, 109 insertions(+), 76 deletions(-) diff --git a/productMods/templates/freemarker/edit/forms/addMemberRoleToPerson.ftl b/productMods/templates/freemarker/edit/forms/addMemberRoleToPerson.ftl index aaa4c068..5101843c 100644 --- a/productMods/templates/freemarker/edit/forms/addMemberRoleToPerson.ftl +++ b/productMods/templates/freemarker/edit/forms/addMemberRoleToPerson.ftl @@ -1,28 +1,28 @@ -<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> -<#--Two stage form for service provider role--> - -<#-- -Required Values to be set for each form that includes addRoleToPersonTwoStage.ftl are: -roleDescriptor. -The other required values (roleType, optionsType, objectClassUri, and literalOptions are -set in the JAVA class corresponding to the form, e.g. AddMemberRoleToPersonGenerator.java. - -Optional values can be set, but each of these has default values -set in addRoleToPersonTwoStage.ftl: - -buttonText -typeSelectorLabel -numDateFields -showRoleLAbelField -roleExamples--> - - -<#--Variable assignments for Add Clinical Role To Person--> -<#assign roleDescriptor = "${i18n().membership}" /> -<#assign typeSelectorLabel = "${i18n().membership_in}" /> -<#assign roleActivityVClass = "${i18n().organizations}" /> -<#assign genericLabel = "${i18n().organization_capitalized}" /> -<#assign acTypes = "{activity: 'http://xmlns.com/foaf/0.1/Organization'}" /> - -<#--Each of the two stage forms will include the form below--> +<#-- $This file is distributed under the terms of the license in /doc/license.txt$ --> +<#--Two stage form for service provider role--> + +<#-- +Required Values to be set for each form that includes addRoleToPersonTwoStage.ftl are: +roleDescriptor. +The other required values (roleType, optionsType, objectClassUri, and literalOptions are +set in the JAVA class corresponding to the form, e.g. AddMemberRoleToPersonGenerator.java. + +Optional values can be set, but each of these has default values +set in addRoleToPersonTwoStage.ftl: + +buttonText +typeSelectorLabel +numDateFields +showRoleLAbelField +roleExamples--> + + +<#--Variable assignments for Add Clinical Role To Person--> +<#assign roleDescriptor = "${i18n().membership}" /> +<#assign typeSelectorLabel = "${i18n().membership_in}" /> +<#assign roleActivityVClass = "${i18n().organizations}" /> +<#assign genericLabel = "${i18n().organization_capitalized}" /> +<#assign acMultipleTypes = "'true'" /> +<#assign acTypes = "{activity: 'http://xmlns.com/foaf/0.1/Organization,http://xmlns.com/foaf/0.1/Group,http://purl.obolibrary.org/obo/OBI_0000835'}" /> +<#--Each of the two stage forms will include the form below--> <#include "addRoleToPersonTwoStage.ftl"> \ No newline at end of file diff --git a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddMemberRoleToPersonGenerator.java b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddMemberRoleToPersonGenerator.java index 6eb97ae5..e5ba2a95 100644 --- a/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddMemberRoleToPersonGenerator.java +++ b/src/edu/cornell/mannlib/vitro/webapp/edit/n3editing/configuration/generators/AddMemberRoleToPersonGenerator.java @@ -1,49 +1,82 @@ -/* $This file is distributed under the terms of the license in /doc/license.txt$ */ - -package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; - -import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions; -import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ChildVClassesOptions; - -public class AddMemberRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator { - - private static String template = "addMemberRoleToPerson.ftl"; - private static String VCLASS_URI = "http://xmlns.com/foaf/0.1/Organization"; - @Override - String getTemplate() { - return template; - } - - @Override - String getRoleType() { - return "http://vivoweb.org/ontology/core#MemberRole"; - } - - @Override - FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception { - return new ChildVClassesOptions(VCLASS_URI) - .setDefaultOptionLabel( "Select one"); - } - - @Override - boolean isShowRoleLabelField(){return true;} - - /* - * Use the methods below to change the date/time precision in the - * custom form associated with this generator. When not used, the - * precision will be YEAR. The other precisons are MONTH, DAY, HOUR, - * MINUTE, TIME and NONE. - */ -/* - public String getStartDatePrecision() { - String precision = VitroVocabulary.Precision.MONTH.uri(); - return precision; - } - - public String getEndDatePrecision() { - String precision = VitroVocabulary.Precision.DAY.uri(); - return precision; - } -*/ -} +/* $This file is distributed under the terms of the license in /doc/license.txt$ */ + +package edu.cornell.mannlib.vitro.webapp.edit.n3editing.configuration.generators; + +import edu.cornell.mannlib.vitro.webapp.controller.VitroRequest; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.ConstantFieldOptions; +import edu.cornell.mannlib.vitro.webapp.edit.n3editing.VTwo.fields.FieldOptions; + +public class AddMemberRoleToPersonGenerator extends AddRoleToPersonTwoStageGenerator { + + private static String template = "addMemberRoleToPerson.ftl"; + private static String VCLASS_URI = "http://xmlns.com/foaf/0.1/Organization"; + @Override + String getTemplate() { + return template; + } + + @Override + String getRoleType() { + return "http://vivoweb.org/ontology/core#MemberRole"; + } + + @Override + FieldOptions getRoleActivityFieldOptions(VitroRequest vreq) throws Exception { + return new ConstantFieldOptions( + "","Select type", + "http://vivoweb.org/ontology/core#AcademicDepartment","Academic Department", + "http://vivoweb.org/ontology/core#Association","Association", + "http://vivoweb.org/ontology/core#Center","Center", + "http://vivoweb.org/ontology/core#ClinicalOrganization","Clinical Organization", + "http://vivoweb.org/ontology/core#College","College", + "http://vivoweb.org/ontology/core#Committee","Committee", + "http://vivoweb.org/ontology/core#Company","Company", + "http://vivoweb.org/ontology/core#Consortium","Consortium", + "http://vivoweb.org/ontology/core#CoreLaboratory","Core Laboratory", + "http://vivoweb.org/ontology/core#Department","Department", + "http://vivoweb.org/ontology/core#Division","Division", + "http://vivoweb.org/ontology/core#ExtensionUnit","Extension Unit", + "http://vivoweb.org/ontology/core#Foundation","Foundation", + "http://vivoweb.org/ontology/core#FundingOrganization","Funding Organization", + "http://vivoweb.org/ontology/core#GovernmentAgency","Government Agency", + "http://xmlns.com/foaf/0.1/Group","Group", + "http://vivoweb.org/ontology/core#Hospital","Hospital", + "http://vivoweb.org/ontology/core#Institute","Institute", + "http://vivoweb.org/ontology/core#Laboratory","Laboratory", + "http://vivoweb.org/ontology/core#Library","Library", + "http://purl.obolibrary.org/obo/OBI_0000835","Manufacturer", + "http://vivoweb.org/ontology/core#Museum","Museum", + "http://xmlns.com/foaf/0.1/Organization","Organization", + "http://vivoweb.org/ontology/core#PrivateCompany","Private Company", + "http://vivoweb.org/ontology/core#Program","Program", + "http://vivoweb.org/ontology/core#Publisher","Publisher", + "http://vivoweb.org/ontology/core#ResearchOrganization","Research Organization", + "http://vivoweb.org/ontology/core#School","School", + "http://vivoweb.org/ontology/core#Team","Team", + "http://vivoweb.org/ontology/core#ServiceProvidingLaboratory","Service Providing Lab", + "http://vivoweb.org/ontology/core#StudentOrganization","Student Organization", + "http://purl.obolibrary.org/obo/ERO_0000565","Technology Transfer Office", + "http://vivoweb.org/ontology/core#University","University"); + } + + @Override + boolean isShowRoleLabelField(){return true;} + + /* + * Use the methods below to change the date/time precision in the + * custom form associated with this generator. When not used, the + * precision will be YEAR. The other precisons are MONTH, DAY, HOUR, + * MINUTE, TIME and NONE. + */ +/* + public String getStartDatePrecision() { + String precision = VitroVocabulary.Precision.MONTH.uri(); + return precision; + } + + public String getEndDatePrecision() { + String precision = VitroVocabulary.Precision.DAY.uri(); + return precision; + } +*/ +}