NIHVIVO-1333 Handle property group for unassigned properties, and case where no property groups are defined
This commit is contained in:
parent
61bc9486fb
commit
f6ff54120d
15 changed files with 155 additions and 109 deletions
|
@ -13,7 +13,7 @@ public class KeywordProperty extends Property implements Comparable<KeywordPrope
|
|||
public KeywordProperty(String displayText,String editText,int rank, String groupUri) {
|
||||
super();
|
||||
this.setDisplayLabel(displayText);
|
||||
this.setEditLabel(editText);
|
||||
this.setLabel(editText);
|
||||
this.setDisplayRank(rank);
|
||||
this.setGroupURI(groupUri);
|
||||
this.setLocalName("keywords");
|
||||
|
|
|
@ -13,12 +13,12 @@ public class Property extends BaseResourceBean {
|
|||
|
||||
private String customEntryForm = null;
|
||||
private String groupURI = null;
|
||||
private String editLabel = null; // keep so can set in a context-specific way
|
||||
private String label = null; // keep so can set in a context-specific way
|
||||
private final boolean subjectSide = true; // only relevant to ObjectProperty
|
||||
|
||||
public Property() {
|
||||
this.groupURI = null;
|
||||
this.editLabel = null;
|
||||
this.groupURI = null;
|
||||
this.label = null;
|
||||
}
|
||||
|
||||
public String getCustomEntryForm() {
|
||||
|
@ -36,11 +36,11 @@ public class Property extends BaseResourceBean {
|
|||
this.groupURI = in;
|
||||
}
|
||||
|
||||
public String getEditLabel() {
|
||||
return editLabel;
|
||||
public String getLabel() {
|
||||
return label;
|
||||
}
|
||||
public void setEditLabel(String label) {
|
||||
this.editLabel = label;
|
||||
public void setLabel(String label) {
|
||||
this.label = label;
|
||||
}
|
||||
|
||||
public boolean isSubjectSide() {
|
||||
|
@ -64,12 +64,12 @@ public class Property extends BaseResourceBean {
|
|||
//log.warn("comparing property "+p1.getLocalName()+" (rank "+determineDisplayRank(p1)+") to property "+p2.getLocalName()+" (rank "+determineDisplayRank(p2)+") ...");
|
||||
int diff = determineDisplayRank(p1) - determineDisplayRank(p2);
|
||||
if (diff==0) {
|
||||
String p1Str = p1.getEditLabel() == null ? p1.getURI() : p1.getEditLabel();
|
||||
if (p1.getEditLabel()==null) {
|
||||
String p1Str = p1.getLabel() == null ? p1.getURI() : p1.getLabel();
|
||||
if (p1.getLabel()==null) {
|
||||
log.warn("null edit label for property "+p1.getURI());
|
||||
}
|
||||
String p2Str = p2.getEditLabel() == null ? p2.getURI() : p2.getEditLabel();
|
||||
if (p2.getEditLabel() == null) {
|
||||
String p2Str = p2.getLabel() == null ? p2.getURI() : p2.getLabel();
|
||||
if (p2.getLabel() == null) {
|
||||
log.warn("null edit label for property "+p2.getURI());
|
||||
}
|
||||
return p1Str.compareTo(p2Str);
|
||||
|
|
|
@ -112,7 +112,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
// now first get the properties this entity actually has, presumably populated with statements
|
||||
List<ObjectProperty> objectPropertyList = subject.getObjectPropertyList();
|
||||
for (ObjectProperty op : objectPropertyList) {
|
||||
op.setEditLabel(op.getDomainPublic());
|
||||
op.setLabel(op.getDomainPublic());
|
||||
mergedPropertyList.add(op);
|
||||
}
|
||||
} else {
|
||||
|
@ -122,7 +122,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
for (PropertyInstance pi : allPropInstColl) {
|
||||
if (pi!=null) {
|
||||
ObjectProperty op = opDao.getObjectPropertyByURI(pi.getPropertyURI());
|
||||
op.setEditLabel(op.getDomainPublic()); // no longer relevant: pi.getSubjectSide() ? op.getDomainPublic() : op.getRangePublic());
|
||||
op.setLabel(op.getDomainPublic()); // no longer relevant: pi.getSubjectSide() ? op.getDomainPublic() : op.getRangePublic());
|
||||
mergedPropertyList.add(op);
|
||||
} else {
|
||||
log.error("a property instance in the Collection created by PropertyInstanceDao.getAllPossiblePropInstForIndividual() is unexpectedly null");
|
||||
|
@ -138,7 +138,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
// now do much the same with data properties: get the list of populated data properties, then add in placeholders for missing ones
|
||||
List<DataProperty> dataPropertyList = subject.getDataPropertyList();
|
||||
for (DataProperty dp : dataPropertyList) {
|
||||
dp.setEditLabel(dp.getPublicName());
|
||||
dp.setLabel(dp.getPublicName());
|
||||
mergedPropertyList.add(dp);
|
||||
}
|
||||
} else {
|
||||
|
@ -147,7 +147,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
if (allDatapropColl != null) {
|
||||
for (DataProperty dp : allDatapropColl ) {
|
||||
if (dp!=null) {
|
||||
dp.setEditLabel(dp.getPublicName());
|
||||
dp.setLabel(dp.getPublicName());
|
||||
mergedPropertyList.add(dp);
|
||||
} else {
|
||||
log.error("a data property in the Collection created in DataPropertyDao.getAllPossibleDatapropsForIndividual() is unexpectedly null)");
|
||||
|
@ -243,7 +243,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
int count = groupsList.size();
|
||||
PropertyGroup tempGroup = null;
|
||||
if (unassignedGroupName!=null) {
|
||||
tempGroup = pgDao.createTempPropertyGroup(unassignedGroupName,MAX_GROUP_DISPLAY_RANK);
|
||||
tempGroup = pgDao.createDummyPropertyGroup(unassignedGroupName,MAX_GROUP_DISPLAY_RANK);
|
||||
log.debug("creating temp property group "+unassignedGroupName+" for any unassigned properties");
|
||||
}
|
||||
switch (count) {
|
||||
|
@ -270,7 +270,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
if (tempGroup!=null) { // not assigned any group yet and are creating a group for unassigned properties
|
||||
if (!alreadyOnPropertyList(tempGroup.getPropertyList(),p)) {
|
||||
tempGroup.getPropertyList().add(p);
|
||||
log.debug("adding property "+p.getEditLabel()+" to members of temp group "+unassignedGroupName);
|
||||
log.debug("adding property "+p.getLabel()+" to members of temp group "+unassignedGroupName);
|
||||
}
|
||||
} // otherwise don't put that property on the list
|
||||
} else if (p.getGroupURI().equals(pg.getURI())) {
|
||||
|
@ -350,7 +350,7 @@ public class DashboardPropertyListController extends VitroHttpServlet {
|
|||
if (diff==0) {
|
||||
diff = determineDisplayRank(p1) - determineDisplayRank(p2);
|
||||
if (diff==0) {
|
||||
return p1.getEditLabel().compareTo(p2.getEditLabel());
|
||||
return p1.getLabel().compareTo(p2.getLabel());
|
||||
} else {
|
||||
return diff;
|
||||
}
|
||||
|
|
|
@ -120,7 +120,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
|
||||
for (ObjectProperty op : objectPropertyList) {
|
||||
if (!SUPPRESSED_OBJECT_PROPERTIES.contains(op)) {
|
||||
op.setEditLabel(op.getDomainPublic());
|
||||
op.setLabel(op.getDomainPublic());
|
||||
mergedPropertyList.add(op);
|
||||
}else{
|
||||
log.debug("suppressed " + op.getURI());
|
||||
|
@ -142,7 +142,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
} else if (op.getURI() == null) {
|
||||
log.error("ObjectProperty op returned with null propertyURI from opDao.getObjectPropertyByURI()");
|
||||
} else if (!alreadyOnPropertyList(mergedPropertyList,op)) {
|
||||
op.setEditLabel(op.getDomainPublic());
|
||||
op.setLabel(op.getDomainPublic());
|
||||
mergedPropertyList.add(op);
|
||||
}
|
||||
}
|
||||
|
@ -158,7 +158,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
// now do much the same with data properties: get the list of populated data properties, then add in placeholders for missing ones
|
||||
List<DataProperty> dataPropertyList = subject.getDataPropertyList();
|
||||
for (DataProperty dp : dataPropertyList) {
|
||||
dp.setEditLabel(dp.getPublicName());
|
||||
dp.setLabel(dp.getPublicName());
|
||||
mergedPropertyList.add(dp);
|
||||
}
|
||||
|
||||
|
@ -171,7 +171,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
if (dp.getURI() == null) {
|
||||
log.error("DataProperty dp returned with null propertyURI from dpDao.getAllPossibleDatapropsForIndividual()");
|
||||
} else if (!alreadyOnPropertyList(mergedPropertyList,dp)) {
|
||||
dp.setEditLabel(dp.getPublicName());
|
||||
dp.setLabel(dp.getPublicName());
|
||||
mergedPropertyList.add(dp);
|
||||
}
|
||||
} else {
|
||||
|
@ -309,7 +309,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
int count = groupsList.size();
|
||||
PropertyGroup tempGroup = null;
|
||||
if (unassignedGroupName!=null) {
|
||||
tempGroup = pgDao.createTempPropertyGroup(unassignedGroupName,MAX_GROUP_DISPLAY_RANK);
|
||||
tempGroup = pgDao.createDummyPropertyGroup(unassignedGroupName,MAX_GROUP_DISPLAY_RANK);
|
||||
log.debug("creating temp property group "+unassignedGroupName+" for any unassigned properties");
|
||||
}
|
||||
switch (count) {
|
||||
|
@ -336,7 +336,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
if (tempGroup!=null) { // not assigned any group yet and are creating a group for unassigned properties
|
||||
if (!alreadyOnPropertyList(tempGroup.getPropertyList(),p)) {
|
||||
tempGroup.getPropertyList().add(p);
|
||||
log.debug("adding property "+p.getEditLabel()+" to members of temp group "+unassignedGroupName);
|
||||
log.debug("adding property "+p.getLabel()+" to members of temp group "+unassignedGroupName);
|
||||
}
|
||||
} // otherwise don't put that property on the list
|
||||
} else if (p.getGroupURI().equals(pg.getURI())) {
|
||||
|
@ -405,7 +405,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("Cannot retrieve p1GroupRank for group "+p1.getEditLabel());
|
||||
log.error("Cannot retrieve p1GroupRank for group "+p1.getLabel());
|
||||
}
|
||||
|
||||
int p2GroupRank=MAX_GROUP_RANK;
|
||||
|
@ -417,7 +417,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("Cannot retrieve p2GroupRank for group "+p2.getEditLabel());
|
||||
log.error("Cannot retrieve p2GroupRank for group "+p2.getLabel());
|
||||
}
|
||||
|
||||
// int diff = pgDao.getGroupByURI(p1.getGroupURI()).getDisplayRank() - pgDao.getGroupByURI(p2.getGroupURI()).getDisplayRank();
|
||||
|
@ -425,7 +425,7 @@ public class EntityMergedPropertyListController extends VitroHttpServlet {
|
|||
if (diff==0) {
|
||||
diff = determineDisplayRank(p1) - determineDisplayRank(p2);
|
||||
if (diff==0) {
|
||||
return p1.getEditLabel().compareTo(p2.getEditLabel());
|
||||
return p1.getLabel().compareTo(p2.getLabel());
|
||||
} else {
|
||||
return diff;
|
||||
}
|
||||
|
|
|
@ -15,7 +15,7 @@ public interface PropertyGroupDao {
|
|||
|
||||
public abstract int removeUnpopulatedGroups(List<PropertyGroup> groups);
|
||||
|
||||
public PropertyGroup createTempPropertyGroup(String name, int rank);
|
||||
public PropertyGroup createDummyPropertyGroup(String name, int rank);
|
||||
|
||||
public String insertNewPropertyGroup(PropertyGroup group);
|
||||
|
||||
|
|
|
@ -79,8 +79,8 @@ public class DataPropertyFiltering extends DataProperty {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getEditLabel() {
|
||||
return innerDataProperty.getEditLabel();
|
||||
public String getLabel() {
|
||||
return innerDataProperty.getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -164,8 +164,8 @@ public class DataPropertyFiltering extends DataProperty {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setEditLabel(String label) {
|
||||
innerDataProperty.setEditLabel(label);
|
||||
public void setLabel(String label) {
|
||||
innerDataProperty.setLabel(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -116,8 +116,8 @@ public class ObjectPropertyFiltering extends ObjectProperty {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getEditLabel() {
|
||||
return innerObjectProperty.getEditLabel();
|
||||
public String getLabel() {
|
||||
return innerObjectProperty.getLabel();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -354,8 +354,8 @@ public class ObjectPropertyFiltering extends ObjectProperty {
|
|||
}
|
||||
|
||||
@Override
|
||||
public void setEditLabel(String label) {
|
||||
innerObjectProperty.setEditLabel(label);
|
||||
public void setLabel(String label) {
|
||||
innerObjectProperty.setLabel(label);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -81,8 +81,8 @@ public class PropertyGroupDaoFiltering implements PropertyGroupDao {
|
|||
return groups;
|
||||
}
|
||||
|
||||
public PropertyGroup createTempPropertyGroup(String name, int rank) {
|
||||
return innerDao.createTempPropertyGroup(name, rank);
|
||||
public PropertyGroup createDummyPropertyGroup(String name, int rank) {
|
||||
return innerDao.createDummyPropertyGroup(name, rank);
|
||||
}
|
||||
|
||||
public String insertNewPropertyGroup(PropertyGroup group) {
|
||||
|
|
|
@ -206,7 +206,7 @@ public class PropertyGroupDaoJena extends JenaBaseDao implements PropertyGroupDa
|
|||
}
|
||||
}
|
||||
|
||||
public PropertyGroup createTempPropertyGroup(String name, int rank) {
|
||||
public PropertyGroup createDummyPropertyGroup(String name, int rank) {
|
||||
PropertyGroup newGroup = new PropertyGroup();
|
||||
newGroup.setName(name);
|
||||
newGroup.setDisplayRank(rank);
|
||||
|
|
|
@ -170,7 +170,7 @@ public class PropertyList extends BaseTemplateModel {
|
|||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("Cannot retrieve p1GroupRank for group "+p1.getEditLabel());
|
||||
log.error("Cannot retrieve p1GroupRank for group "+p1.getLabel());
|
||||
}
|
||||
|
||||
int p2GroupRank=MAX_GROUP_RANK;
|
||||
|
@ -182,7 +182,7 @@ public class PropertyList extends BaseTemplateModel {
|
|||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("Cannot retrieve p2GroupRank for group "+p2.getEditLabel());
|
||||
log.error("Cannot retrieve p2GroupRank for group "+p2.getLabel());
|
||||
}
|
||||
|
||||
// int diff = pgDao.getGroupByURI(p1.getGroupURI()).getDisplayRank() - pgDao.getGroupByURI(p2.getGroupURI()).getDisplayRank();
|
||||
|
@ -190,7 +190,7 @@ public class PropertyList extends BaseTemplateModel {
|
|||
if (diff==0) {
|
||||
diff = determineDisplayRank(p1) - determineDisplayRank(p2);
|
||||
if (diff==0) {
|
||||
return p1.getEditLabel().compareTo(p2.getEditLabel());
|
||||
return p1.getLabel().compareTo(p2.getLabel());
|
||||
} else {
|
||||
return diff;
|
||||
}
|
||||
|
|
|
@ -67,7 +67,7 @@ public class PropertyListBuilder {
|
|||
// don't need to set editLabel, can just do this:
|
||||
//propertyList.addAll(objectPropertyList);
|
||||
for (ObjectProperty op : objectPropertyList) {
|
||||
op.setEditLabel(op.getDomainPublic());
|
||||
op.setLabel(op.getDomainPublic());
|
||||
propertyList.add(op);
|
||||
}
|
||||
|
||||
|
@ -84,7 +84,7 @@ public class PropertyListBuilder {
|
|||
//propertyList.addAll(subject.getPopulatedDataPropertyList());
|
||||
List<DataProperty> dataPropertyList = subject.getPopulatedDataPropertyList();
|
||||
for (DataProperty dp : dataPropertyList) {
|
||||
dp.setEditLabel(dp.getPublicName());
|
||||
dp.setLabel(dp.getPublicName());
|
||||
propertyList.add(dp);
|
||||
}
|
||||
|
||||
|
@ -197,55 +197,75 @@ public class PropertyListBuilder {
|
|||
log.error("a null Collection is returned from DataPropertyDao.getAllPossibleDatapropsForIndividual())");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private List<PropertyGroup> addPropertiesToGroups(List<Property> propertyList) {
|
||||
|
||||
|
||||
// Get the property groups
|
||||
PropertyGroupDao pgDao = wdf.getPropertyGroupDao();
|
||||
List<PropertyGroup> groupList = pgDao.getPublicGroups(false); // may be returned empty but not null
|
||||
// To test no property groups defined, use:
|
||||
// List<PropertyGroup> groupList = new ArrayList<PropertyGroup>();
|
||||
|
||||
int groupCount = groupList.size();
|
||||
|
||||
/*
|
||||
* If no property groups are defined, create a dummy group with a null name to signal to the template that it's
|
||||
* not a real group. This allows the looping structure in the template to be the same whether there are groups or not.
|
||||
*/
|
||||
if (groupCount == 0) {
|
||||
log.warn("groupList has no groups on entering addPropertiesToGroups(); will create a new group");
|
||||
PropertyGroup dummyGroup = pgDao.createDummyPropertyGroup(null, 1);
|
||||
dummyGroup.getPropertyList().addAll(propertyList);
|
||||
sortGroupPropertyList(dummyGroup.getName(), propertyList);
|
||||
groupList.add(dummyGroup);
|
||||
return groupList;
|
||||
}
|
||||
|
||||
/*
|
||||
* This group will hold properties that are not assigned to any groups. In case no real property groups are
|
||||
* populated, we end up with the dummy group case above, and we will change the name to null to signal to the
|
||||
* template that it shouldn't be treated like a group.
|
||||
*/
|
||||
PropertyGroup groupForUnassignedProperties = pgDao.createDummyPropertyGroup("", MAX_GROUP_DISPLAY_RANK);
|
||||
|
||||
int groupsCount=0;
|
||||
try {
|
||||
groupsCount = populateGroupsListWithProperties(pgDao, groupList, propertyList);
|
||||
} catch (Exception ex) {
|
||||
log.error("Exception on trying to populate groups list with properties: "+ex.getMessage());
|
||||
ex.printStackTrace();
|
||||
if (groupCount > 1) {
|
||||
try {
|
||||
Collections.sort(groupList);
|
||||
} catch (Exception ex) {
|
||||
log.error("Exception on sorting groupList in addPropertiesToGroups()");
|
||||
}
|
||||
}
|
||||
|
||||
populateGroupListWithProperties(groupList, groupForUnassignedProperties, propertyList);
|
||||
|
||||
// Remove unpopulated groups
|
||||
try {
|
||||
int removedCount = pgDao.removeUnpopulatedGroups(groupList);
|
||||
if (removedCount == 0) {
|
||||
log.warn("Of "+groupsCount+" groups, none removed by removeUnpopulatedGroups");
|
||||
/* } else {
|
||||
log.warn("Of "+groupsCount+" groups, "+removedCount+" removed by removeUnpopulatedGroups"); */
|
||||
log.warn("Of "+groupCount+" groups, none removed by removeUnpopulatedGroups");
|
||||
}
|
||||
groupsCount -= removedCount;
|
||||
groupCount -= removedCount;
|
||||
} catch (Exception ex) {
|
||||
log.error("Exception on trying to prune groups list with properties: "+ex.getMessage());
|
||||
}
|
||||
return null;
|
||||
|
||||
// If the group for unassigned properties is populated, add it to the group list.
|
||||
if (groupForUnassignedProperties.getPropertyList().size() > 0) {
|
||||
groupList.add(groupForUnassignedProperties);
|
||||
// If no real property groups are populated, the groupForUnassignedProperties moves from case 2 to case 1 above, so change
|
||||
// the name to null to signal to the templates that there are no real groups.
|
||||
if (groupCount == 0) {
|
||||
groupForUnassignedProperties.setName(null);
|
||||
}
|
||||
}
|
||||
|
||||
return groupList;
|
||||
}
|
||||
|
||||
private int populateGroupsListWithProperties(PropertyGroupDao pgDao, List<PropertyGroup> groupList, List<Property> propertyList) {
|
||||
int count = groupList.size();
|
||||
PropertyGroup tempGroup = null;
|
||||
String unassignedGroupName = ""; // temp, for compilation
|
||||
if (unassignedGroupName!=null) {
|
||||
tempGroup = pgDao.createTempPropertyGroup(unassignedGroupName,MAX_GROUP_DISPLAY_RANK);
|
||||
log.debug("creating temp property group "+unassignedGroupName+" for any unassigned properties");
|
||||
}
|
||||
switch (count) {
|
||||
case 0: log.warn("groupsList has no groups on entering populateGroupsListWithProperties(); will create a new group \"other\"");
|
||||
break;
|
||||
case 1: break;
|
||||
default: try {
|
||||
Collections.sort(groupList);
|
||||
} catch (Exception ex) {
|
||||
log.error("Exception on sorting groupsList in populateGroupsListWithProperties()");
|
||||
}
|
||||
}
|
||||
if (count==0 && unassignedGroupName!=null) {
|
||||
groupList.add(tempGroup);
|
||||
}
|
||||
|
||||
private void populateGroupListWithProperties(List<PropertyGroup> groupList,
|
||||
PropertyGroup groupForUnassignedProperties, List<Property> propertyList) {
|
||||
|
||||
// Assign the properties to the groups
|
||||
for (PropertyGroup pg : groupList) {
|
||||
if (pg.getPropertyList().size()>0) {
|
||||
pg.getPropertyList().clear();
|
||||
|
@ -253,33 +273,35 @@ public class PropertyListBuilder {
|
|||
for (Property p : propertyList) {
|
||||
if (p.getURI() == null) {
|
||||
log.error("Property p has null URI in populateGroupsListWithProperties()");
|
||||
// If the property is not assigned to any group, add it to the group for unassigned properties
|
||||
} else if (p.getGroupURI()==null) {
|
||||
if (tempGroup!=null) { // not assigned any group yet and are creating a group for unassigned properties
|
||||
if (!alreadyOnPropertyList(tempGroup.getPropertyList(),p)) {
|
||||
|
||||
tempGroup.getPropertyList().add(p);
|
||||
log.debug("adding property "+p.getEditLabel()+" to members of temp group "+unassignedGroupName);
|
||||
if (groupForUnassignedProperties!=null) {
|
||||
// RY How could it happen that it's already in the group? Maybe we can remove this case.
|
||||
if (!alreadyOnPropertyList(groupForUnassignedProperties.getPropertyList(),p)) {
|
||||
groupForUnassignedProperties.getPropertyList().add(p);
|
||||
log.debug("adding property "+p.getLabel()+" to group for unassigned propertiues");
|
||||
}
|
||||
} // otherwise don't put that property on the list
|
||||
}
|
||||
// Otherwise, if the property is assigned to this group, add it to the group if it's not already there
|
||||
} else if (p.getGroupURI().equals(pg.getURI())) {
|
||||
// RY How could it happen that it's already in the group? Maybe we can remove this case.
|
||||
if (!alreadyOnPropertyList(pg.getPropertyList(),p)) {
|
||||
pg.getPropertyList().add(p);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (pg.getPropertyList().size()>1) {
|
||||
try {
|
||||
Collections.sort(pg.getPropertyList(),new Property.DisplayComparatorIgnoringPropertyGroup());
|
||||
} catch (Exception ex) {
|
||||
log.error("Exception sorting property group "+pg.getName()+" property list: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
sortGroupPropertyList(pg.getName(), pg.getPropertyList());
|
||||
}
|
||||
if (count>0 && tempGroup!=null && tempGroup.getPropertyList().size()>0) {
|
||||
groupList.add(tempGroup);
|
||||
}
|
||||
count = groupList.size();
|
||||
return count;
|
||||
}
|
||||
|
||||
private void sortGroupPropertyList(String groupName, List<Property> propertyList) {
|
||||
if (propertyList.size()>1) {
|
||||
try {
|
||||
Collections.sort(propertyList,new Property.DisplayComparatorIgnoringPropertyGroup());
|
||||
} catch (Exception ex) {
|
||||
log.error("Exception sorting property group "+ groupName + " property list: "+ex.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private class PropertyRanker implements Comparator {
|
||||
|
@ -308,7 +330,7 @@ public class PropertyListBuilder {
|
|||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("Cannot retrieve p1GroupRank for group "+p1.getEditLabel());
|
||||
log.error("Cannot retrieve p1GroupRank for group "+p1.getLabel());
|
||||
}
|
||||
|
||||
int p2GroupRank=MAX_GROUP_RANK;
|
||||
|
@ -320,7 +342,7 @@ public class PropertyListBuilder {
|
|||
}
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
log.error("Cannot retrieve p2GroupRank for group "+p2.getEditLabel());
|
||||
log.error("Cannot retrieve p2GroupRank for group "+p2.getLabel());
|
||||
}
|
||||
|
||||
// int diff = pgDao.getGroupByURI(p1.getGroupURI()).getDisplayRank() - pgDao.getGroupByURI(p2.getGroupURI()).getDisplayRank();
|
||||
|
@ -328,7 +350,7 @@ public class PropertyListBuilder {
|
|||
if (diff==0) {
|
||||
diff = determineDisplayRank(p1) - determineDisplayRank(p2);
|
||||
if (diff==0) {
|
||||
return p1.getEditLabel().compareTo(p2.getEditLabel());
|
||||
return p1.getLabel().compareTo(p2.getLabel());
|
||||
} else {
|
||||
return diff;
|
||||
}
|
||||
|
|
|
@ -147,7 +147,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
|||
<c:set var="first" value=""/><c:if test="${counter == 0}"><c:set var="first" value=" first"/></c:if>
|
||||
<c:set var="last" value=""/><c:if test="${(counter+1) == propTotal}"><c:set var="last" value=" last"/></c:if>
|
||||
<div class="propsItem${first}${last}" id="${objProp.localName}">
|
||||
<h4>${objProp.editLabel}</h4>
|
||||
<h4>${objProp.label}</h4>
|
||||
<c:if test="${showSelfEdits || showCuratorEdits}"><edLnk:editLinks item="${objProp}" icons="false" /></c:if>
|
||||
<%-- Verbose property display additions for object properties, using context variable verbosePropertyListing --%>
|
||||
<c:if test="${showCuratorEdits && verbosePropertyListing}">
|
||||
|
@ -272,7 +272,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
|||
<c:set var="addable" value=""/><c:if test="${dataRows >= 1 && displayLimit > 1}"><c:set var="addable" value=" addable"/></c:if>
|
||||
|
||||
<div id="${dataProp.localName}" class="propsItem dataItem${first}${last}${multiItem}${addable}" style="${dataStyle}">
|
||||
<h4>${dataProp.editLabel}</h4>
|
||||
<h4>${dataProp.label}</h4>
|
||||
<c:if test="${showSelfEdits || showCuratorEdits}">
|
||||
<c:choose>
|
||||
<c:when test="${dataRows == 1 && displayLimit==1 }">
|
||||
|
|
|
@ -96,7 +96,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
|||
<c:if test="${showSelfEdits || showCuratorEdits}"><c:set var="classForEditControls" value=" editing"/></c:if>
|
||||
<c:set var="uniqueOpropDivName" value="${fn:replace(objProp.localNameWithPrefix,':','-')}"/>
|
||||
<div class="propsItem ${classForEditControls}" id="${'oprop-'}${uniqueOpropDivName}">
|
||||
<h3 class="propertyName">${objProp.editLabel}</h3>
|
||||
<h3 class="propertyName">${objProp.label}</h3>
|
||||
<c:if test="${showSelfEdits || showCuratorEdits}"><edLnk:editLinks item="${objProp}" icons="false" /></c:if>
|
||||
|
||||
<%-- Verbose property display additions for object properties, using context variable verbosePropertyListing --%>
|
||||
|
@ -227,7 +227,7 @@ public static Log log = LogFactory.getLog("edu.cornell.mannlib.vitro.webapp.jsp.
|
|||
<c:if test="${showSelfEdits || showCuratorEdits}"><c:set var="classForEditControls" value=" editing"/></c:if>
|
||||
<c:set var="uniqueDpropDivName" value="${fn:replace(dataProp.localNameWithPrefix,':','-')}"/>
|
||||
<div id="${'dprop-'}${uniqueDpropDivName}" class="propsItem ${classForEditControls}" style="${dataStyle}">
|
||||
<h3 class="propertyName">${dataProp.editLabel}</h3>
|
||||
<h3 class="propertyName">${dataProp.label}</h3>
|
||||
<c:if test="${showSelfEdits || showCuratorEdits}"><edLnk:editLinks item="${dataProp}" icons="false"/></c:if>
|
||||
<%-- Verbose property display additions for data properties, using context variable verbosePropertyListing --%>
|
||||
<c:if test="${showCuratorEdits && verbosePropertyListing}">
|
||||
|
|
|
@ -2,4 +2,28 @@
|
|||
|
||||
<#-- Template for property listing on individual profile page -->
|
||||
|
||||
<#assign properties = individual.propertyList>
|
||||
<#assign propertyGroups = individual.propertyList>
|
||||
|
||||
<#list propertyGroups as group>
|
||||
|
||||
<#-- Display the group heading -->
|
||||
<#-- If there are no groups, a dummy group has been created with a null name. -->
|
||||
<#if ! group.name??>
|
||||
<#-- Here you might just do nothing and proceed to list the properties as in the grouped case,
|
||||
or you might choose different markup for the groupless case. -->
|
||||
<#-- This is the group for properties not assigned to any group. It has an empty name. -->
|
||||
<#elseif group.name?length == 0>
|
||||
<h3>other</h3>
|
||||
<#else>
|
||||
<h3>${group.name}</h3>
|
||||
</#if>
|
||||
|
||||
<#-- Now list the properties in the group -->
|
||||
<p>Number of properties in group: ${group.propertyList?size}</p> <#-- testing -->
|
||||
<#--
|
||||
<#list group.properties as property>
|
||||
|
||||
</#list>
|
||||
-->
|
||||
|
||||
</#list>
|
|
@ -72,7 +72,8 @@
|
|||
</div>
|
||||
</#if>
|
||||
|
||||
<#-- <#include "individual-properties.ftl"> -->
|
||||
<#-- Ontology properties -->
|
||||
<#include "individual-properties.ftl">
|
||||
|
||||
<#-- Keywords -->
|
||||
<#if individual.keywords?has_content>
|
||||
|
@ -187,8 +188,7 @@
|
|||
${stylesheets.addFromTheme("/css/entity.css")}
|
||||
|
||||
<#-- RY Figure out which of these scripts really need to go into the head, and which are needed at all (e.g., tinyMCE??) -->
|
||||
${headScripts.add("/js/jquery.js",
|
||||
"/js/jquery_plugins/getUrlParam.js",
|
||||
${headScripts.add("/js/jquery_plugins/getUrlParam.js",
|
||||
"/js/jquery_plugins/colorAnimations.js",
|
||||
"/js/propertyGroupSwitcher.js",
|
||||
"/js/jquery_plugins/jquery.form.js",
|
||||
|
|
Loading…
Add table
Reference in a new issue