Package overit.geocall.platform
Class CustomPackage
java.lang.Object
overit.geocall.platform.Package
overit.geocall.platform.CustomPackage
- All Implemented Interfaces:
Serializable
This class defines a custom package, i.e. a package that extends or overwrites the defined functionality in a package
belonging to a overlayer.
Customizations allow you to redefine the components contained in a package of another layer by adapting them
to the customer's needs. For example, you can change the graphical interface of a page defined in another layer,
rather than overwriting the behavior of a
It is possible to define a custom package by creating a
Or you can define a custom package programmatically by creating a new instance of
BusinessTask or DAO.
It is possible to define a custom package by creating a
CustomPackage extension by defining the position of the
original package (those whose will be customized) and eventually the position of the customizing package.
Remember to annotate the class with the @Package annotation.
package overit.geocallapp.wfm.managing;
{@literal @}Package
public class ManagingPackage extends CustomPackage {
public ManagingPackage() {
super("overit/geocall/basic/managing/");
}
}
The above example shows how to make the components contained in the package overit.geocallapp.wfm.managing
customize the same name components declared in the package overit/geocall/basic/managing/.
Or you can define a custom package programmatically by creating a new instance of
CustomPackage and registering
it by calling the Layer.addCustomization(CustomPackage) method.
CustomPackage customPackage = new CustomPackage("overit/geocallapp/wfm/managing/", "overit/geocall/basic/managing/");
layer.addCustomization(customPackage);
The association between CustomPackage and Layer occurs automatically as long as the class that defines its implementation:
- is positioned within the domain defined by the Layer
- contains the annotation
@Package
- See Also:
-
Field Summary
Fields -
Constructor Summary
ConstructorsModifierConstructorDescriptionprotectedCustomPackage(String original) Create a new custom package by specifying the path of the original package to be customize.CustomPackage(String custom, String original) Create a new custom package by specifying the current customizing path and the path of the original package to be customize. -
Method Summary
Modifier and TypeMethodDescriptionprotected final CustomPackagecomposeDown(CustomPackage other) protected final CustomPackagecomposeUp(CustomPackage other) final booleancontainsCustom(JavaResource resource) Checks if the resource, passed as a parameter, belongs to the custom packagefinal booleancontainsOrigin(JavaResource resource) Checks if the resource, passed as a parameter, belongs to the original packagebooleangetOwner()inthashCode()protected voidprotected voidSet the layer that this package belongs to.final JavaResourcetoCustom(JavaResource resource) Transforms a resource from the original package, passed as a parameter, into the equivalent of the custom package.final JavaResourcetoOrigin(JavaResource resource) Transforms a resource from the custom package, passed as a parameter, into the equivalent of the original package.toString()Methods inherited from class overit.geocall.platform.Package
getAlias, getName, setAlias, setPosition, validatePosition
-
Field Details
-
original
-
owner
-
-
Constructor Details
-
CustomPackage
Create a new custom package by specifying the path of the original package to be customize. The path directories must be separated with the/character, the domain must start without the/character and must end with. This constructor can be called from class extensions, instead ofCustomPackage(String, String), because it is easier to use since the package containing the customizations is automatically calculated according to the subclass package.- Parameters:
original- path that identifies the position of the original package, i.e. the package that will be customized. Null value is not allowed.
-
CustomPackage
Create a new custom package by specifying the current customizing path and the path of the original package to be customize. The paths directories must be separated with the/character, they must start without the/character and must end with.
The following example shows the definition of a new custom package, positioned underoverit.geocallapp.wfm.managing, that customize theoverit.geocall.basic.managingpackage.CustomPackage customPackage = new CustomPackage("overit/geocallapp/wfm/managing/", "overit/geocall/basic/managing/");- Parameters:
custom- path that identifies the position of the custom package, i.e. the package that contains the customizations. Null value is not allowed.original- path that identifies the position of the original package, i.e. the package that will be customized. Null value is not allowed.
-
-
Method Details
-
getPosition
- Overrides:
getPositionin classPackage- Returns:
- the position of the custom package, i.e. the package that contains the customizations.
-
getOriginal
- Returns:
- the position of the original package, i.e. the package that will be customized.
-
getOwner
- Returns:
- the layer that this package belongs to or null if the package has not yet been registered to any layer
-
setOwner
Set the layer that this package belongs to.- Parameters:
owner- the owner layer
-
containsCustom
Checks if the resource, passed as a parameter, belongs to the custom package- Parameters:
resource- resource's instance. Null value is not allowed.- Returns:
trueif the resource's package is contained within the current custom package,falseotherwise.
-
containsOrigin
Checks if the resource, passed as a parameter, belongs to the original package- Parameters:
resource- resource's instance. Null value is not allowed.- Returns:
trueif the resource's package is contained within the original package,falseotherwise.
-
toCustom
Transforms a resource from the original package, passed as a parameter, into the equivalent of the custom package. A null value returns if the resource does not belong to the original package.- Parameters:
resource- the instance to transform. Null value is not allowed.- Returns:
- the converted resource or null if it doesn't belongs to the original package
-
toOrigin
Transforms a resource from the custom package, passed as a parameter, into the equivalent of the original package. A null value returns if the resource does not belong to the custom package.- Parameters:
resource- the instance to transform. Null value is not allowed.- Returns:
- the converted resource or null if it doesn't belongs to the custom package
-
composeUp
-
composeDown
-
invariant
protected void invariant() -
toString
-
equals
-
hashCode
public int hashCode()
-