Sorry for the big commit, got a bit carried away.

Added override and deprecated annotations wherever they were missing
Removed the use of any deprecated classes/methods (except OutputFormat in UtilXml)
A few other random generics and misc. cleanups

git-svn-id: https://svn.apache.org/repos/asf/ofbiz/trunk@791212 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
Scott Gray
2009-07-05 10:01:19 +00:00
parent ae3fa014f3
commit dec24b29f2
396 changed files with 1574 additions and 180 deletions
@@ -33,6 +33,7 @@ public abstract class ArtifactInfoBase implements Comparable<ArtifactInfoBase> {
this.aif = aif;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ArtifactInfoBase) {
return this.equals(obj);
@@ -207,7 +207,7 @@ public class ArtifactInfoFactory {
for (File controllerFile: controllerFiles) {
URL controllerUrl = null;
try {
controllerUrl = controllerFile.toURL();
controllerUrl = controllerFile.toURI().toURL();
} catch (MalformedURLException mue) {
throw new GeneralException(mue.getMessage());
}
@@ -129,6 +129,7 @@ public class ControllerRequestArtifactInfo extends ArtifactInfoBase {
return this.requestUri;
}
@Override
public String getDisplayName() {
String location = UtilURL.getOfbizHomeRelativeLocation(this.controllerXmlUrl);
if (location.endsWith("/WEB-INF/controller.xml")) {
@@ -137,22 +138,27 @@ public class ControllerRequestArtifactInfo extends ArtifactInfoBase {
return this.requestUri + " (" + location + ")";
}
@Override
public String getDisplayType() {
return "Controller Request";
}
@Override
public String getType() {
return ArtifactInfoFactory.ControllerRequestInfoTypeId;
}
@Override
public String getUniqueId() {
return this.controllerXmlUrl.toExternalForm() + "#" + this.requestUri;
}
@Override
public URL getLocationURL() throws MalformedURLException {
return this.controllerXmlUrl;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ControllerRequestArtifactInfo) {
ControllerRequestArtifactInfo that = (ControllerRequestArtifactInfo) obj;
@@ -84,6 +84,7 @@ public class ControllerViewArtifactInfo extends ArtifactInfoBase {
return this.viewUri;
}
@Override
public String getDisplayName() {
String location = UtilURL.getOfbizHomeRelativeLocation(this.controllerXmlUrl);
if (location.endsWith("/WEB-INF/controller.xml")) {
@@ -92,22 +93,27 @@ public class ControllerViewArtifactInfo extends ArtifactInfoBase {
return this.viewUri + " (" + location + ")";
}
@Override
public String getDisplayType() {
return "Controller View";
}
@Override
public String getType() {
return ArtifactInfoFactory.ControllerViewInfoTypeId;
}
@Override
public String getUniqueId() {
return this.controllerXmlUrl.toExternalForm() + "#" + this.viewUri;
}
@Override
public URL getLocationURL() throws MalformedURLException {
return this.controllerXmlUrl;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ControllerViewArtifactInfo) {
ControllerViewArtifactInfo that = (ControllerViewArtifactInfo) obj;
@@ -63,26 +63,32 @@ public class EntityArtifactInfo extends ArtifactInfoBase {
return this.modelEntity;
}
@Override
public String getDisplayName() {
return this.getUniqueId();
}
@Override
public String getDisplayType() {
return "Entity";
}
@Override
public String getType() {
return ArtifactInfoFactory.EntityInfoTypeId;
}
@Override
public String getUniqueId() {
return this.modelEntity.getEntityName();
}
@Override
public URL getLocationURL() throws MalformedURLException {
return FlexibleLocation.resolveLocation(this.modelEntity.getLocation(), null);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof EntityArtifactInfo) {
return this.modelEntity.getEntityName().equals(((EntityArtifactInfo) obj).modelEntity.getEntityName());
@@ -182,27 +182,33 @@ public class FormWidgetArtifactInfo extends ArtifactInfoBase {
}
}
@Override
public String getDisplayName() {
// remove the component:// from the location
return this.formName + " (" + this.formLocation.substring(12) + ")";
}
@Override
public String getDisplayType() {
return "Form Widget";
}
@Override
public String getType() {
return ArtifactInfoFactory.FormWidgetInfoTypeId;
}
@Override
public String getUniqueId() {
return this.formLocation + "#" + this.formName;
}
@Override
public URL getLocationURL() throws MalformedURLException {
return FlexibleLocation.resolveLocation(this.formLocation, null);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof FormWidgetArtifactInfo) {
return (this.modelForm.getName().equals(((FormWidgetArtifactInfo) obj).modelForm.getName()) &&
@@ -168,27 +168,33 @@ public class ScreenWidgetArtifactInfo extends ArtifactInfoBase {
}
}
@Override
public String getDisplayName() {
// remove the component:// from the location
return this.screenName + " (" + this.screenLocation.substring(12) + ")";
}
@Override
public String getDisplayType() {
return "Screen Widget";
}
@Override
public String getType() {
return ArtifactInfoFactory.ScreenWidgetInfoTypeId;
}
@Override
public String getUniqueId() {
return this.screenLocation + "#" + this.screenName;
}
@Override
public URL getLocationURL() throws MalformedURLException {
return FlexibleLocation.resolveLocation(this.screenLocation, null);
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ScreenWidgetArtifactInfo) {
return (this.modelScreen.getName().equals(((ScreenWidgetArtifactInfo) obj).modelScreen.getName()) &&
@@ -234,6 +234,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
this.displayPrefix = displayPrefix;
}
@Override
public String getDisplayName() {
return this.getDisplayPrefixedName();
}
@@ -241,18 +242,22 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
return (this.displayPrefix != null ? this.displayPrefix : "") + this.modelService.name;
}
@Override
public String getDisplayType() {
return "Service";
}
@Override
public String getType() {
return ArtifactInfoFactory.ServiceInfoTypeId;
}
@Override
public String getUniqueId() {
return this.modelService.name;
}
@Override
public URL getLocationURL() throws MalformedURLException {
return FlexibleLocation.resolveLocation(this.modelService.definitionLocation, null);
}
@@ -553,6 +558,7 @@ public class ServiceArtifactInfo extends ArtifactInfoBase {
return topLevelMap;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ServiceArtifactInfo) {
return this.modelService.name.equals(((ServiceArtifactInfo) obj).modelService.name);
@@ -64,22 +64,27 @@ public class ServiceEcaArtifactInfo extends ArtifactInfoBase {
}
}
@Override
public String getDisplayName() {
return this.getDisplayPrefixedName();
}
@Override
public String getDisplayType() {
return "Service ECA";
}
@Override
public String getType() {
return ArtifactInfoFactory.ServiceEcaInfoTypeId;
}
@Override
public String getUniqueId() {
return this.serviceEcaRule.toString();
}
@Override
public URL getLocationURL() throws MalformedURLException {
return FlexibleLocation.resolveLocation(this.serviceEcaRule.getDefinitionLocation(), null);
}
@@ -179,6 +184,7 @@ public class ServiceEcaArtifactInfo extends ArtifactInfoBase {
return topLevelMap;
}
@Override
public boolean equals(Object obj) {
if (obj instanceof ServiceEcaArtifactInfo) {
ServiceEcaArtifactInfo that = (ServiceEcaArtifactInfo) obj;
@@ -120,7 +120,7 @@ public class LabelManagerFactory {
if (UtilValidate.isNotEmpty(fileName) && !fileName.equals(fileInfo.getFileName())) {
continue;
}
Document resourceDocument = UtilXml.readXmlDocument(fileInfo.file.toURL(), false);
Document resourceDocument = UtilXml.readXmlDocument(fileInfo.file.toURI().toURL(), false);
Element resourceElem = resourceDocument.getDocumentElement();
String labelKeyComment = "";
for (Node propertyNode : UtilXml.childNodeList(resourceElem.getFirstChild())) {
@@ -245,7 +245,7 @@ public class LabelReferences {
private void getLabelsFromFormWidgets(String inFile, File file) throws MalformedURLException, SAXException, ParserConfigurationException, IOException, GenericServiceException {
Set<String> fieldNames = FastSet.newInstance();
findUiLabelMapInFile(inFile, file.getPath());
Document formDocument = UtilXml.readXmlDocument(file.toURL());
Document formDocument = UtilXml.readXmlDocument(file.toURI().toURL());
Element rootElem = formDocument.getDocumentElement();
for (Element formElement : UtilXml.childElementList(rootElem, "form")) {
for (Element elem : UtilXml.childElementList(formElement, "auto-fields-service")) {
@@ -267,7 +267,7 @@ public class LabelReferences {
List<File> componentsFiles = FileUtil.findXmlFiles(null, null, "ofbiz-component", "http://ofbiz.apache.org/dtds/ofbiz-component.xsd");
for (File componentFile : componentsFiles) {
String filePath = componentFile.getPath();
Document menuDocument = UtilXml.readXmlDocument(componentFile.toURL());
Document menuDocument = UtilXml.readXmlDocument(componentFile.toURI().toURL());
Element rootElem = menuDocument.getDocumentElement();
for (Element elem1 : UtilXml.childElementList(rootElem)) {
checkOfbizComponentTag(elem1, filePath);