"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/main/java/com/openkm/util/FormUtils.java" between
OpenKM-document-management-system-6.3.10.tar.gz and OpenKM-document-management-system-6.3.11.tar.gz

About: OpenKM (Knowledge Management) is a document management system that allows easy management of documents, users, roles and finding your enterprise documents and records. Community version (source code).

FormUtils.java  (OpenKM-document-management-system-6.3.10):FormUtils.java  (OpenKM-document-management-system-6.3.11)
skipping to change at line 246 skipping to change at line 246
* Force PropertyGroups.xml re-read in the next petition. * Force PropertyGroups.xml re-read in the next petition.
*/ */
public static synchronized void resetPropertyGroupsForms() { public static synchronized void resetPropertyGroupsForms() {
pGroups = null; pGroups = null;
} }
/** /**
* Retrieve the form elements from a PropertyGroup definition. * Retrieve the form elements from a PropertyGroup definition.
*/ */
public static List<FormElement> getPropertyGroupForms(Map<PropertyGroup, List<FormElement>> formsElements, public static List<FormElement> getPropertyGroupForms(Map<PropertyGroup, List<FormElement>> formsElements,
String groupName) { String groupName) {
// long begin = System.currentTimeMillis(); // long begin = System.currentTimeMillis();
for (Entry<PropertyGroup, List<FormElement>> entry : formsElement s.entrySet()) { for (Entry<PropertyGroup, List<FormElement>> entry : formsElement s.entrySet()) {
if (entry.getKey().getName().equals(groupName)) { if (entry.getKey().getName().equals(groupName)) {
// log.info("getPropertyGroupForms.Time: {}", Sys tem.currentTimeMillis() - begin); // log.info("getPropertyGroupForms.Time: {}", Sys tem.currentTimeMillis() - begin);
return entry.getValue(); return entry.getValue();
} }
} }
// log.info("getPropertyGroupForms.Time: {}", System.currentTimeM illis() - begin); // log.info("getPropertyGroupForms.Time: {}", System.currentTimeM illis() - begin);
return null; return null;
} }
/** /**
* Retrieve the form elements from a PropertyGroup definition. * Retrieve the form elements from a PropertyGroup definition.
*/ */
public static Map<String, FormElement> getPropertyGroupFormsMap(Map<Prope rtyGroup, List<FormElement>> public static Map<String, FormElement> getPropertyGroupFormsMap(Map<Prope rtyGroup, List<FormElement>>
formsElements, String groupName) { formsElem ents, String groupName) {
// long begin = System.currentTimeMillis(); // long begin = System.currentTimeMillis();
Map<String, FormElement> map = new HashMap<String, FormElement>() ; Map<String, FormElement> map = new HashMap<String, FormElement>() ;
for (Entry<PropertyGroup, List<FormElement>> entry : formsElement s.entrySet()) { for (Entry<PropertyGroup, List<FormElement>> entry : formsElement s.entrySet()) {
if (entry.getKey().getName().equals(groupName)) { if (entry.getKey().getName().equals(groupName)) {
for (FormElement fe : entry.getValue()) { for (FormElement fe : entry.getValue()) {
map.put(fe.getName(), fe); map.put(fe.getName(), fe);
} }
} }
} }
// log.trace("getPropertyGroupFormsMap.Time: {}", System.currentT imeMillis() - begin); // log.trace("getPropertyGroupFormsMap.Time: {}", System.currentT imeMillis() - begin);
return map; return map;
} }
/** /**
* Retrieve the form element from a PropertyGroups definition. * Retrieve the form element from a PropertyGroups definition.
*/ */
public static FormElement getFormElement(Map<PropertyGroup, List<FormElem ent>> formsElements, String propertyName) { public static FormElement getFormElement(Map<PropertyGroup, List<FormElem ent>> formsElements, String propertyName) {
for (Iterator<Entry<PropertyGroup, List<FormElement>>> it1 = form for (Entry<PropertyGroup, List<FormElement>> entry : formsElement
sElements.entrySet().iterator(); it1.hasNext(); ) { s.entrySet()) {
Entry<PropertyGroup, List<FormElement>> entry = it1.next( for (FormElement fe : entry.getValue()) {
);
for (Iterator<FormElement> it2 = entry.getValue().iterato
r(); it2.hasNext(); ) {
FormElement fe = it2.next();
if (fe.getName().equals(propertyName)) { if (fe.getName().equals(propertyName)) {
return fe; return fe;
} }
} }
} }
return null; return null;
} }
/** /**
skipping to change at line 873 skipping to change at line 869
} }
fpi += "//EN"; fpi += "//EN";
registerDTD(fpi, f.getPath()); registerDTD(fpi, f.getPath());
} }
} }
/** /**
* Registers available DTDs. * Registers available DTDs.
* *
* @param String publicId - Public ID of DTD * @param publicId - Public ID of DTD
* @param String dtdFileName - the file name of DTD * @param dtdFileName - the file name of DTD
*/ */
public void registerDTD(String publicId, String dtdFileName) { public void registerDTD(String publicId, String dtdFileName) {
log.info("registerDTD({}, {})", publicId, dtdFileName); log.info("registerDTD({}, {})", publicId, dtdFileName);
dtds.put(publicId, dtdFileName); dtds.put(publicId, dtdFileName);
} }
/** /**
* Returns DTD inputSource. Is DTD was found in the hashtable and inputSource was created * Returns DTD inputSource. Is DTD was found in the hashtable and inputSource was created
* flad hasDTD is ser to true. * flad hasDTD is ser to true.
* *
* @param publicId - Public ID of DTD * @param publicId - Public ID of DTD
* @param systemId - the file name of DTD * @param systemId - the file name of DTD
* @return InputSource of DTD * @return InputSource of DTD
*/ */
@Override @Override
public InputSource resolveEntity(String publicId, String systemId ) { public InputSource resolveEntity(String publicId, String systemId ) {
hasDTD = false; hasDTD = false;
InputSource aInputSource = null; InputSource aInputSource = null;
String dtd = dtds.get(publicId); String dtd = dtds.get(publicId);
log.info("resolveEntity(publicId={}, systemId={}) => {}", new Object[]{publicId, systemId, ((dtd == null) ? "NULL" : dtd)}); log.info("resolveEntity(publicId={}, systemId={}) => {}", publicId, systemId, ((dtd == null) ? "NULL" : dtd));
if (dtd != null) { if (dtd != null) {
hasDTD = true; hasDTD = true;
try { try {
aInputSource = new InputSource(dtd); aInputSource = new InputSource(dtd);
} catch (Exception e) { } catch (Exception e) {
log.warn(e.getMessage(), e); log.warn(e.getMessage(), e);
} }
} else { } else {
skipping to change at line 939 skipping to change at line 935
* Returns the boolean value to inform id DTD was found in the XM L file or not. * Returns the boolean value to inform id DTD was found in the XM L file or not.
* *
* @return boolean - true if DTD was found in XML * @return boolean - true if DTD was found in XML
*/ */
public boolean hasDTD() { public boolean hasDTD() {
return hasDTD; return hasDTD;
} }
} }
/** /**
* Get form elements from map
*/
public static void fillFormElements(Map<String, String> properties, List<
FormElement> formElements) {
for (FormElement fe : formElements) {
String value = properties.get(fe.getName());
if (value != null) {
if (fe instanceof Input) {
((Input) fe).setValue(value);
} else if (fe instanceof SuggestBox) {
((SuggestBox) fe).setValue(value);
} else if (fe instanceof TextArea) {
((TextArea) fe).setValue(value);
} else if (fe instanceof CheckBox) {
((CheckBox) fe).setValue(Boolean.parseBoo
lean(value));
} else if (fe instanceof Select) {
Select sel = (Select) fe;
for (Option opt : sel.getOptions()) {
StringTokenizer st = new StringTo
kenizer(value, Config.LIST_SEPARATOR);
while (st.hasMoreTokens()) {
String optVal = st.nextTo
ken().trim();
if (opt.getValue().equals
(optVal)) {
opt.setSelected(t
rue);
break;
} else {
opt.setSelected(f
alse);
}
}
}
} else {
// throw new ParseException("Unknown prop
erty definition: " + fe.getName());
}
}
}
}
/**
* Get map from form elements * Get map from form elements
*/ */
public static void fillMap(List<FormElement> formElements, Map<String, St ring> properties) { public static void fillMap(List<FormElement> formElements, Map<String, St ring> properties) {
for (FormElement fe : formElements) { for (FormElement fe : formElements) {
String value = null; String value = null;
if (fe instanceof Input) { if (fe instanceof Input) {
value = ((Input) fe).getValue(); value = ((Input) fe).getValue();
} else if (fe instanceof SuggestBox) { } else if (fe instanceof SuggestBox) {
value = ((SuggestBox) fe).getValue(); value = ((SuggestBox) fe).getValue();
 End of changes. 7 change blocks. 
15 lines changed or deleted 57 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)