AgileApps Support Wiki Pre Release

Difference between revisions of "Classes"

From AgileApps Support Wiki
imported>Aeric
imported>Aeric
Line 24: Line 24:
#Click '''Designer > Logic > Classes'''
#Click '''Designer > Logic > Classes'''
#Optionally, choose a View; In addition to the ''All Records'' view, the following views are available:
#Optionally, choose a View; In addition to the ''All Records'' view, the following views are available:
#:[[file:classviews.gif|right|thumb]]
#*Platform Generated Classes - Displays a list of [[Classes]] generated by the {{enterprisebrand}}
#*Platform Generated Classes - Displays a list of [[Classes]] generated by the {{enterprisebrand}}
#*User Created Classes - Displays a list of [[Classes]] created by Users
#*User Created Classes - Displays a list of [[Classes]] created by Users
Line 30: Line 29:
#*'''[New Class]''' - [[Add a Class]]
#*'''[New Class]''' - [[Add a Class]]
#*'''[Run All Tests]''' - Run all [[Unit Test Framework|Unit Tests]] defined in the classes
#*'''[Run All Tests]''' - Run all [[Unit Test Framework|Unit Tests]] defined in the classes
<!--
#*[[#Download Classes|Download Classes]]
#*[[#Generate Classes|Generate Classes]]
-->
<!--
===Download Classes===
The purpose of downloading classes is to extract object information from the {{enterprisebrand}} and use [http://www.eclipse.org Eclipse] for further customization and development.
To Download Classes:
#Click '''Designer > Logic > Classes'''
#Click the [Download Classes] button
#Choose one of the following options:
#:*All
#:*User Created
#:*Platform Generated
===Generate Classes===
The purpose of generating classes is to create Java classes of all objects that exist in the {{enterprisebrand}}.
To Generate Classes:
#Click '''Designer > Logic > Classes'''
#Click the [Generate Classes] button
;Considerations:
*When β€œGenerate Classes” button is pressed, classes and interface based on object are generated
*Any previously generated classes are deleted automatically
:*''All generated classes and interfaces are Read Only''
:*Object inheritance is taken into account during this code generation
:*All Classes fields are private
:::''[http://en.wikipedia.org/wiki/CamelCase CamelCase notation] is used on getters/setters''
;Syntax Examples:
"product_manager" becomes ''productManager'' and ''getProductManager''
"onload" becomes ''onload'' and ''getOnload''
-->


=== Add a Class ===
=== Add a Class ===

Revision as of 19:58, 28 July 2011

Designer > Logic > Classes

A class is a standard Java class. Consider writing classes to create business logic that is not provided by the basic building blocks of the platform.

Learn more: Classes in the Developer Suite

About Classes

You can make Java API calls in the Java code in a class, and you can create instances of classes in Java code.

There are some restrictions on the things you can do in a Java class, as described in Governors on Java Code .

In most cases, a page communicates with a class through a controller class. (You can instantiate a class directly in a page, but that is considered a bad practice.)

Learn more: Working with Pages and Classes


Manage Classes

From the Classes page, a number of features are provided to view, create and manage classes.

To view Classes:

  1. Click Designer > Logic > Classes
  2. Optionally, choose a View; In addition to the All Records view, the following views are available:
    • Platform Generated Classes - Displays a list of Classes generated by the AgileApps Cloud platform
    • User Created Classes - Displays a list of Classes created by Users
  3. Use the action buttons:

Add a Class

Prerequisite Before you create a class, you need to decide what package to put it in. Here are a few notes to help you make that decision:

  • Packages let you organize classes into different directories according to their functionality, their usability, or any other category that makes sense. (The only rule is that classes in one package have a qualitatively different kind of functionality compared with those in another package.)
  • Packages help to avoid class name collision. (The same class name can be used in different packages.)
  • Classes in the same package can access each others package-protected fields and methods, as well as their public members, without doing an import. So classes that cooperate with each other extensively generally belong in the same package.
  • Classes that are part of a different package can be accessed with an import declaration.

To add a class:

  1. Click GearIcon.png > Customization > Developer Resources > Classes
  2. Click [New Class]
  3. Fill in the class properties.
  4. Click [Next]
    A class template appears.
  5. Provide the code for the class.
  6. Click [Save]

Class properties

Package
The package name
  • The platform supplies this part: com.platform.{namespace},
    where {namespace} is defined in the Developer Configuration settings of the current tenancy.
  • You supply this part: {packagename}
The result is the fully-qualified package path for the class: com.platform.{namespace}.{packagename}
Class Name
The name of the class. Must consist of alphanumeric characters (a-z,A-Z,0-9) or underscores (_). Must start with an alphabetic character (a-z,A-Z) or underscore (_).
Java code
Enter Java code in the text area.

Edit a Class

To edit a class:

  1. Click Designer > Logic > Classes
  2. Click the name of the class to edit
  3. Click [Edit]
  4. Edit the Java code in the text area
  5. When done, click [Save]

Delete a Class

To delete a class:

  1. Click Designer > Logic > Classes
  2. Click the name of the class to delete
  3. Click [Delete]

Editing Classes in Eclipse

Use the Eclipse Plug-In to add, edit or delete classes.