sexta-feira, 30 de maio de 2014

Use Stringbuffer

2.12 Use Stringbuffer Instead of String Concatenation

The String class is the most commonly used class in Java. Especially in Web applications, it is used extensively to generate and format HTML content.
String is designed to be immutable; in order to modify a String, you have to create a new String object. Therefore, string concatenation can result in creating many intermediate String objects before the final String can be constructed. StringBuffer is the mutable companion class of String; it allows you to modify the String. Therefore, StringBuffer is generally more efficient than String when concatenation is needed.
This section also features the following practices:

2.12.1 Use StringBuffer Instead of String Concatenation If You Repeatedly Append to a String In Multiple Statements

Using the "+=" operation on a String repeatedly is expensive.
For example:
String s = new
String();
     [do some work ...]
s += s1;
     [do some more work...]
s += s2;

Replace the above string concatenation with a StringBuffer:
StringBuffer strbuf = new StringBuffer();
     [do some work ...]
strbuf.append(s1);
     [so some more work ...]
strbuf.append(s2);
String s = strbuf.toString();

2.12.2 Use Either String or StringBuffer If the Concatenation Is Within One Statement

String and StringBuffer perform the same in some cases; so you do not need to use StringBuffer directly.
    String s = "a" + "b" + "c";
to
    String s = "abc";
 
Optimization is done automatically by the compiler.
  • The Java2 compiler will automatically collapse the above.
  • The Java2 compiler will also automatically convert the following:
             String s = s1 + s2;
        to
             String s = (new StringBuffer()).append(s1).append(s2).toString();
    
    
    
    
    In these cases, there is no need to use StringBuffer directly.

2.12.3 Use StringBuffer Instead of String Concatenation If You Know the Size of the String

The default character buffer for StringBuffer is 16. When the buffer is full, a new one has to be re-allocated (usually at twice the size of the original one). The old buffer will be released after the content is copied to the new one. This constant reallocation can be avoided if the StringBuffer is created with a buffer size that is big enough to hold the String.
The following will be more efficient than using a String concatenation.
    String s = (new StringBuffer(1024)).
append(s1).append(s2). toString();

will be faster than
    String s = s1 + s2;

The-Dining-Philosophers-Problem

http://adit.io/posts/2013-05-11-The-Dining-Philosophers-Problem-With-Ron-Swanson.html


terça-feira, 27 de maio de 2014

Cascade

Form
select USR_LOGIN as lkv_encoded from USR where UPPER(USR_LOGIN)!=(UPPER(NVL('$Form
data.UD_HQ_SMBOB_PRIMARY_OWNER_CII$','0'))) and (USR_UDF_RESOURCE_TYPE = 'INT' or USR_UDF_RESOURCE_TYPE = 'CON')


<PrePopulationAdapter name="Prepop" classname="ca.qc.hydro.gia.adapters.PrePopulatePrimaryOwner"/>
</AttributeReference>
<AttributeReference available-in-bulk="true" length="100" widget="lookup-query" type="String" required="true" attr-ref="Secondary OwnerCII" name="CII du responsable suppléant">
<lookupQuery lookup-query="select USR_LOGIN as CII_du_responsable_suppléant from USR where UPPER(USR_LOGIN)!=(UPPER('$Form data.Primary OwnerCII''')) and (UPPER(USR_EMP_TYPE)='EMPLOYEE' or UPPER(USR_EMP_TYPE)='CONSULTANT')" display-field="CII_du_responsable_suppléant" save-field="CII_du_responsable_suppléant"/>
</AttributeReference>
</request-data-set>

segunda-feira, 10 de março de 2014

SAP connector


Transforma EMP type do idoc.


----

Employee Type

import java.util.HashMap;
import oracle.iam.connectors.common.transform.Transformation;

import common.utils.CustLogger;
import common.utils.Constants11g;

public class EmployeeTypeTransform implements Transformation {
 
    private CustLogger logger = new CustLogger("OIMCP.SAPH");
    private String sClassName = getClass().getName();
         
    public Object transform(HashMap hmUserDetails, HashMap hmEntitlementDetails,String sField) {

     String sMethodName = "transform";
     logger.setMethodStartLog(sClassName, sMethodName);
     String sEmpType = Constants11g.EMP_TYPE_FULL_TIME;
   
     if(null != hmUserDetails) {
  
        //Declare and initialize user details from recon
        String sResourceType = (String)hmUserDetails.get("Resource Type");
          
        logger.info(sClassName, sMethodName, "Resource Type: " + sResourceType);
             
        //Verifies user Resource Type and sets Employee Type
            if (sResourceType.equalsIgnoreCase(Constants11g.RES_TYPE_INT) ) {
                sEmpType = Constants11g.EMP_TYPE_EMPLOYEE;
            } else if(sResourceType.equals(Constants11g.RES_TYPE_CON)) {
                sEmpType = Constants11g.EMP_TYPE_CONSULTANT;
            } else if(sResourceType.equals(Constants11g.RES_TYPE_PAR)) {
                sEmpType = Constants11g.EMP_TYPE_PARTNER;
            }
        
        logger.info(sClassName, sMethodName, "Setting Employee Type to : " + sEmpType);
     }
   
    return sEmpType;
  
 }

Configurei 2 Lookups para ativar a transformacao:
- Lookup.SAP.HRMS.ReconTransformation

Employee Type package.classEmployeeTypeTransform
 
- Lookup.SAP.HRMS.Configuration

Use Transformation For Recon: Yes
 
Sao

quarta-feira, 20 de novembro de 2013

Hierarquia de versoes de forms

select level, lpad(sdl_label,Length(sdl_label) + LEVEL  -1,'-') VERSION , sdl_create
  from (select * from sdl
where sdk_key = 41 and sdl_current_version is not null ) a
  start with a.sdl_parent_version is null
  connect by prior a.sdl_current_version=a.sdl_parent_version;

Forms Hierarchy

terça-feira, 20 de agosto de 2013

Deleting Application Instances

Deleting Application Instances

OIM 11g R2

An application instance can be deleted in any one of the following ways:
  • Deleting the application instance from the Application Instances section of the Oracle Identity System Administration.
  • Deleting the IT resource, which is a constituent of the application instance.
When you delete an application instance by using any one these methods, the application instance is not hard-deleted from Oracle Identity Manager. The application instance is soft-deleted. This is because accounts provisioned as a result of the application instance might exist in the target system. Therefore, after deleting an application instance, you must run a scheduled job to achieve the following:
  • Unpublish the application instance from the entity publication
  • Unpublish the associated entitlements from the entity publication
  • Revoke, or hard-delete, or mark as deleted all the accounts for the application instance
To delete an application instance:
  1. In Oracle Identity System Administration, under Configuration, click Application Instances. The Application Instances page is displayed with a list of application instances that are published to your organization.
  2. Search and select the application instance that you want to delete.
  3. From the Actions menu, select Delete. Alternatively, click Delete on the toolbar. A message box is displayed asking for confirmation.
  4. Click Delete to confirm. The application instance is soft-deleted in Oracle Identity Manager.
    You can also delete an application instance by deleting the IT resource of the application instance. For information about deleting IT resources, see "Managing IT Resources" in the Oracle Fusion Middleware Developer's Guide for Oracle Identity Manager.
  5. Run the Application Instance Post Delete Processing Job scheduled job. This scheduled job can be run in any one of the following modes:
    • Revoke: This mode is used when the application instance is deleted, but the provisioned accounts in the target system still exist. Using the Revoke mode deletes the accounts from the target system.
    • Delete: This mode is used when the target system no longer exists, and there are no traces of the accounts in Oracle Identity Manager. Using the Delete mode hard-deletes the accounts from all provisioning tasks and targets, and subsequently from Oracle Identity Manager.
    • Decommission: This mode is used when the target system no longer exists and the provisioned accounts cannot be revoked from the target system. Using the Decommission mode changes the account status to Revoke without keeping the accounts in Oracle Identity Manager in provisioned state.
     
  6. Run the Catalog Synchronization Job scheduled job. This scheduled job identifies the soft-deleted application instances, and removes them from the catalog.