sorting checkboxes on property edit pages
This commit is contained in:
parent
c201e7389f
commit
7e20ef9e6e
2 changed files with 48 additions and 71 deletions
|
@ -6,7 +6,6 @@ import java.io.UnsupportedEncodingException;
|
|||
import java.net.URLEncoder;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
import javax.servlet.RequestDispatcher;
|
||||
|
@ -143,43 +142,20 @@ public class DatapropEditController extends BaseEditController {
|
|||
|
||||
DataPropertyDao assertionsDpDao = vreq.getUnfilteredAssertionsWebappDaoFactory().getDataPropertyDao();
|
||||
|
||||
List superURIs = assertionsDpDao.getSuperPropertyURIs(dp.getURI(),false);
|
||||
List superProperties = new ArrayList();
|
||||
Iterator superURIit = superURIs.iterator();
|
||||
while (superURIit.hasNext()) {
|
||||
String superURI = (String) superURIit.next();
|
||||
if (superURI != null) {
|
||||
DataProperty superProperty = assertionsDpDao.getDataPropertyByURI(superURI);
|
||||
if (superProperty != null) {
|
||||
superProperties.add(superProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
request.setAttribute("superproperties",superProperties);
|
||||
List<DataProperty> superProps = getDataPropertiesForURIList(
|
||||
assertionsDpDao.getSuperPropertyURIs(dp.getURI(), false), assertionsDpDao);
|
||||
sortForPickList(superProps, vreq);
|
||||
request.setAttribute("superproperties", superProps);
|
||||
|
||||
List subURIs = assertionsDpDao.getSubPropertyURIs(dp.getURI());
|
||||
List subProperties = new ArrayList();
|
||||
Iterator subURIit = subURIs.iterator();
|
||||
while (subURIit.hasNext()) {
|
||||
String subURI = (String) subURIit.next();
|
||||
DataProperty subProperty = dpDao.getDataPropertyByURI(subURI);
|
||||
if (subProperty != null) {
|
||||
subProperties.add(subProperty);
|
||||
}
|
||||
}
|
||||
request.setAttribute("subproperties",subProperties);
|
||||
List<DataProperty> subProps = getDataPropertiesForURIList(
|
||||
assertionsDpDao.getSubPropertyURIs(dp.getURI()), assertionsDpDao);
|
||||
sortForPickList(subProps, vreq);
|
||||
request.setAttribute("subproperties", subProps);
|
||||
|
||||
List eqURIs = assertionsDpDao.getEquivalentPropertyURIs(dp.getURI());
|
||||
List eqProperties = new ArrayList();
|
||||
Iterator eqURIit = eqURIs.iterator();
|
||||
while (eqURIit.hasNext()) {
|
||||
String eqURI = (String) eqURIit.next();
|
||||
DataProperty eqProperty = dpDao.getDataPropertyByURI(eqURI);
|
||||
if (eqProperty != null) {
|
||||
eqProperties.add(eqProperty);
|
||||
}
|
||||
}
|
||||
request.setAttribute("equivalentProperties", eqProperties);
|
||||
List<DataProperty> eqProps = getDataPropertiesForURIList(
|
||||
assertionsDpDao.getEquivalentPropertyURIs(dp.getURI()), assertionsDpDao);
|
||||
sortForPickList(eqProps, vreq);
|
||||
request.setAttribute("equivalentProperties", eqProps);
|
||||
|
||||
ApplicationBean appBean = vreq.getAppBean();
|
||||
|
||||
|
@ -202,5 +178,17 @@ public class DatapropEditController extends BaseEditController {
|
|||
public void doGet (HttpServletRequest request, HttpServletResponse response) {
|
||||
doPost(request,response);
|
||||
}
|
||||
|
||||
private List<DataProperty> getDataPropertiesForURIList(List<String> propertyURIs,
|
||||
DataPropertyDao dpDao) {
|
||||
List<DataProperty> properties = new ArrayList<DataProperty>();
|
||||
for (String propertyURI : propertyURIs) {
|
||||
DataProperty property = dpDao.getDataPropertyByURI(propertyURI);
|
||||
if (property != null) {
|
||||
properties.add(property);
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
|
@ -194,43 +194,20 @@ public class PropertyEditController extends BaseEditController {
|
|||
// superproperties and subproperties
|
||||
|
||||
ObjectPropertyDao opDao = vreq.getUnfilteredAssertionsWebappDaoFactory().getObjectPropertyDao();
|
||||
List superURIs = opDao.getSuperPropertyURIs(p.getURI(),false);
|
||||
List superProperties = new ArrayList();
|
||||
Iterator superURIit = superURIs.iterator();
|
||||
while (superURIit.hasNext()) {
|
||||
String superURI = (String) superURIit.next();
|
||||
if (superURI != null) {
|
||||
ObjectProperty superProperty = opDao.getObjectPropertyByURI(superURI);
|
||||
if (superProperty != null) {
|
||||
superProperties.add(superProperty);
|
||||
}
|
||||
}
|
||||
}
|
||||
request.setAttribute("superproperties",superProperties);
|
||||
List<ObjectProperty> superProps = getObjectPropertiesForURIList(
|
||||
opDao.getSuperPropertyURIs(p.getURI(), false), opDao);
|
||||
sortForPickList(superProps, vreq);
|
||||
request.setAttribute("superproperties", superProps);
|
||||
|
||||
List subURIs = opDao.getSubPropertyURIs(p.getURI());
|
||||
List subProperties = new ArrayList();
|
||||
Iterator subURIit = subURIs.iterator();
|
||||
while (subURIit.hasNext()) {
|
||||
String subURI = (String) subURIit.next();
|
||||
ObjectProperty subProperty = opDao.getObjectPropertyByURI(subURI);
|
||||
if (subProperty != null) {
|
||||
subProperties.add(subProperty);
|
||||
}
|
||||
}
|
||||
request.setAttribute("subproperties",subProperties);
|
||||
List<ObjectProperty> subProps = getObjectPropertiesForURIList(
|
||||
opDao.getSubPropertyURIs(p.getURI()), opDao);
|
||||
sortForPickList(subProps, vreq);
|
||||
request.setAttribute("subproperties", subProps);
|
||||
|
||||
List eqURIs = opDao.getEquivalentPropertyURIs(p.getURI());
|
||||
List eqProperties = new ArrayList();
|
||||
Iterator eqURIit = eqURIs.iterator();
|
||||
while (eqURIit.hasNext()) {
|
||||
String eqURI = (String) eqURIit.next();
|
||||
ObjectProperty eqProperty = opDao.getObjectPropertyByURI(eqURI);
|
||||
if (eqProperty != null) {
|
||||
eqProperties.add(eqProperty);
|
||||
}
|
||||
}
|
||||
request.setAttribute("equivalentProperties", eqProperties);
|
||||
List<ObjectProperty> eqProps = getObjectPropertiesForURIList(
|
||||
opDao.getEquivalentPropertyURIs(p.getURI()), opDao);
|
||||
sortForPickList(eqProps, vreq);
|
||||
request.setAttribute("equivalentProperties", eqProps);
|
||||
|
||||
RequestDispatcher rd = request.getRequestDispatcher(Controllers.BASIC_JSP);
|
||||
request.setAttribute("epoKey",epo.getKey());
|
||||
|
@ -252,5 +229,17 @@ public class PropertyEditController extends BaseEditController {
|
|||
public void doGet (HttpServletRequest request, HttpServletResponse response) {
|
||||
doPost(request,response);
|
||||
}
|
||||
|
||||
private List<ObjectProperty> getObjectPropertiesForURIList(List<String> propertyURIs,
|
||||
ObjectPropertyDao opDao) {
|
||||
List<ObjectProperty> properties = new ArrayList<ObjectProperty>();
|
||||
for (String propertyURI : propertyURIs) {
|
||||
ObjectProperty property = opDao.getObjectPropertyByURI(propertyURI);
|
||||
if (property != null) {
|
||||
properties.add(property);
|
||||
}
|
||||
}
|
||||
return properties;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue