Wednesday, November 18, 2009

What is the difference between a Role and a Responsibility?

Responsibilities can now be considered a special type of role that represents the set of navigation menus contained within an application. Therefore, responsibilities loosely represent an application itself, whereas roles can be used to determine what parts of that application (and data therein) a user has access. This represents a shift in the definition of a responsibility in Oracle Applications. Previously, a responsibility has been used not only to define the application navigation menus, but also to confer privileges and permissions within that application. Using this definition of responsibility, it was often necessary to create several similar responsibilities in order to effectively carve out data and functional security access for a group of users. This has increased the overall cost of ownership as the number of responsibilities has grown.
Oracle Applications follows the Role Based Access Control (RBAC) Reference Model (ANSI INCITS 359-2004) definition of a role as "a job function within the context of an organization with some associated semantics regarding the authority and responsibility conferred on the user assigned to the role." Roles can now be defined to determine what applications (responsibilities) as well as what data and functions within those applications a user has access to.
By leveraging the RBAC model, users will no longer need to be directly assigned the lower level permissions and responsibilities, as these can be implicitly inherited based upon the roles assigned to the user. Roles can now be defined to consolidate responsibilities and other roles through role inheritance, as well as lower level permissions (functions) and data security policies. This is accomplished through a one-time setup, where all the permissions are assigned to the role. In order to make a mass update in a production system a client only needs to change the permissions or role inheritance hierarchies defined for a role, then all of the users assigned to that role will instantly inherit the new permissions.

Tuesday, November 17, 2009

Creating USER MANAGEMENT ROLE in ORACLE through API

Role Creation API

UMX_ACCESS_ROLES_PVT.insert_role(p_role_name in varchar2,
p_orig_system in varchar2,
p_orig_system_id in number,
p_start_date in date,
p_expiration_date in date,
p_display_name in varchar2,
p_owner_tag in varchar2,
p_description in varchar2);

Example;


begin
UMX_ACCESS_ROLES_PVT.insert_role('UMXRAJEEVCODE2',
'UMX',
0,
to_date('18/11/2009','DD/MM/YYYY'),
null,
'rajeev role name2',
'NCRX',
'rajeev desc2');
commit;
end;

Assigement of Roles to Users


Begin
wf_local_synch.PropagateUserRole(
p_user_name => '&USER_NAME',
p_role_name => '&ROLE_KEY');
commit;
end;

We can create or Assign Role from SYSADMIN user though USER MANAGEMENT RESPONSIBILITY.

Wednesday, November 4, 2009

DBMS SCHEDULAR

Creating Schedule:-
begin

dbms_scheduler.create_schedule( schedule_name => 'INTERVAL_EVERY_1_MINUTES', start_date => trunc(sysdate)+18/24, repeat_interval => 'freq=MINUTELY;interval=1', comments => 'Runtime: Every day all 1 minutes');

dbms_scheduler.create_schedule( schedule_name => 'INTERVAL_EVERY_1_SECONDLY', start_date => sysdate, repeat_interval => 'freq=SECONDLY;interval=1', comments => 'Runtime: Every day all 1 SECOND');
dbms_scheduler.create_schedule( schedule_name => 'INTERVAL_EVERY_0_SECONDLY', start_date => sysdate, repeat_interval => 'freq=SECONDLY;interval=0', comments => 'Runtime: Every day all 0 SECOND');
commit;
end;

Creating Program :-

begin -- Call a procedure of a database package

dbms_scheduler.create_program (program_name=> 'REPLAY_STANDARD_ORDER_JOB1', program_type=> 'PLSQL_BLOCK', program_action=> 'begin OE_REPLAY_PUB_PKG.replay_all(0,1); end;', enabled=>true, comments=>'Procedure to Replay Standard Orders for 0,1' );

-- Call a procedure of a database package

dbms_scheduler.create_program (program_name=> 'REPLAY_STANDARD_ORDER_JOB2', program_type=> 'PLSQL_BLOCK', program_action=> 'begin OE_REPLAY_PUB_PKG.replay_all(2,3); end;', enabled=>true, comments=>'Procedure to Replay Standard Orders 2,3' );

dbms_scheduler.create_program (program_name=> 'REPLAY_STANDARD_ORDER_JOB3', program_type=> 'PLSQL_BLOCK', program_action=> 'begin OE_REPLAY_PUB_PKG.replay_all(4,5); end;', enabled=>true, comments=>'Procedure to Replay Standard Orders 4,5' );

dbms_scheduler.create_program (program_name=> 'REPLAY_STANDARD_ORDER_JOB4', program_type=> 'PLSQL_BLOCK', program_action=> 'begin OE_REPLAY_PUB_PKG.replay_all(6,7); end;', enabled=>true, comments=>'Procedure to Replay Standard Orders for 6,7' );

dbms_scheduler.create_program (program_name=> 'REPLAY_STANDARD_ORDER_JOB5', program_type=> 'PLSQL_BLOCK', program_action=> 'begin OE_REPLAY_PUB_PKG.replay_all(8,9); end;', enabled=>true, comments=>'Procedure to Replay Standard Orders for 8,9' ); commit;
end;


Creating Jobs :--

begin -- Connect both dbms_scheduler parts by creating the final job

dbms_scheduler.create_job (job_name => 'REPLAY_JOB_FOR_0_AND_1', program_name=> 'REPLAY_STANDARD_ORDER_JOB1', schedule_name=>'INTERVAL_EVERY_0_SECONDLY', enabled=>true, auto_drop=>false, comments=>'Job to collect data about session values every 0 minutes');

dbms_scheduler.create_job (job_name => 'REPLAY_JOB_FOR_2_AND_3', program_name=> 'REPLAY_STANDARD_ORDER_JOB2', schedule_name=>'INTERVAL_EVERY_0_SECONDLY', enabled=>true, auto_drop=>false, comments=>'Job to collect data about session values every 0 minutes');

dbms_scheduler.create_job (job_name => 'REPLAY_JOB_FOR_4_AND_5', program_name=> 'REPLAY_STANDARD_ORDER_JOB3', schedule_name=>'INTERVAL_EVERY_0_SECONDLY', enabled=>true, auto_drop=>false, comments=>'Job to collect data about session values every 0 minutes');

dbms_scheduler.create_job (job_name => 'REPLAY_JOB_FOR_6_AND_7', program_name=> 'REPLAY_STANDARD_ORDER_JOB4', schedule_name=>'INTERVAL_EVERY_0_SECONDLY', enabled=>true, auto_drop=>false, comments=>'Job to collect data about session values every 0 minutes');

dbms_scheduler.create_job (job_name => 'REPLAY_JOB_FOR_8_AND_9', program_name=> 'REPLAY_STANDARD_ORDER_JOB5', schedule_name=>'INTERVAL_EVERY_0_SECONDLY', enabled=>true, auto_drop=>false, comments=>'Job to collect data about session values every 5 minutes');
end;

Run Jobs:-

begin dbms_scheduler.run_job('REPLAY_JOB_FOR_0_AND_1',TRUE); end;begindbms_scheduler.run_job('REPLAY_JOB_FOR_2_AND_3',TRUE); end;begindbms_scheduler.run_job('REPLAY_JOB_FOR_4_AND_5',TRUE); end;begindbms_scheduler.run_job('REPLAY_JOB_FOR_6_AND_7',TRUE); end;begindbms_scheduler.run_job('REPLAY_JOB_FOR_8_AND_9',TRUE);

end;

drop job:-
begin--DBMS_SCHEDULER.STOP_JOB(job_name=>'REPLAY_JOB_FOR_0_AND_1', force=>TRUE);--DBMS_SCHEDULER.STOP_JOB(job_name=>'REPLAY_JOB_FOR_2_AND_3', force=>TRUE);--DBMS_SCHEDULER.STOP_JOB(job_name=>'REPLAY_JOB_FOR_4_AND_5', force=>TRUE);--DBMS_SCHEDULER.STOP_JOB(job_name=>'REPLAY_JOB_FOR_6_AND_7', force=>TRUE);--DBMS_SCHEDULER.STOP_JOB(job_name=>'REPLAY_JOB_FOR_8_AND_9', force=>TRUE);
dbms_scheduler.drop_job('REPLAY_JOB_FOR_0_AND_1');
dbms_scheduler.drop_job('REPLAY_JOB_FOR_2_AND_3');
dbms_scheduler.drop_job('REPLAY_JOB_FOR_4_AND_5');
dbms_scheduler.drop_job('REPLAY_JOB_FOR_6_AND_7');
dbms_scheduler.drop_job('REPLAY_JOB_FOR_8_AND_9');

end;


Extra Information

DBMS_SCHEDULER.SET_ATTRIBUTE( name => 'INTERVAL_EVERY_MINUTE', attribute => 'repeat_interval', value => 'freq=MINUTELY;interval=2' );
select * from user_scheduler_job_log where job_name='REPLAY_JOB_FOR_0_AND_1';
Select * from DBA_SCHEDULER_JOB_RUN_DETAILS where (job_name = 'REPLAY_JOB_FOR_0_AND_1' OR job_name = 'REPLAY_JOB_FOR_2_AND_3') and run_duration <> '+00 00:00:00.000000' order by actual_start_date desc
Select * from DBA_SCHEDULER_JOB_RUN_DETAILS where job_name = 'REPLAY_JOB_FOR_0_AND_1' order by actual_start_date desc

Friday, August 21, 2009

Agile Project Management

Agile Open Source Project Management Tool

http://collaborate.d2labs.org/projects/saralscrum/

3 Reasons Why I Wouldn't Do Agile Project Management

http://www.agile-software-development.com/2009/03/3-reasons-why-i-wouldnt-do-agile.html

10 Key Principales of Agile Development

http://www.agile-software-development.com/search/label/10%20Key%20Principles

How to put Log lines in OA Framework program

OADBTransactionImpl oadbtransactionimpl = (OADBTransactionImpl)getOADBTransaction();

if(oadbtransactionimpl.isLoggingEnabled(2)) { oadbtransactionimpl.writeDiagnostics(this, "insertRow().BEGIN", 2); }

Through this if we have enabled Diagnostic on then we can see our logs while runtime.

We can put anywhere in our OA Framework program.

There are Diagnostic option Show Log on Screen

Log Level
Unexpected (6)Error (5)Exception (4)Event (3)Procedure (2)Statement (1)

Easy way to install Apache, MySql, PHP etc

Many people know from their own experience that it's not easy to install an Apache web server and it gets harder if you want to add MySQL, PHP and Perl.
XAMPP is an easy to install Apache distribution containing MySQL, PHP and Perl. XAMPP is really very easy to install and to use - just download, extract and start.
http://www.apachefriends.org/en/xampp.html

Wednesday, August 19, 2009

Create Service Request and Task through API

declare
lx_msg_count NUMBER;
lx_msg_data VARCHAR2(2000);
lx_request_id NUMBER;
lx_request_number VARCHAR2(50);
lx_interaction_id NUMBER;
lx_workflow_process_id NUMBER;
lx_msg_index_out NUMBER;
lx_return_status VARCHAR2(1);
l_service_request_rec CS_ServiceRequest_PUB.service_request_rec_type;
l_service_request_rec_out CS_ServiceRequest_PUB.sr_create_out_rec_type ;
l_notes_table CS_SERVICEREQUEST_PUB.notes_table;
l_contacts_tab CS_SERVICEREQUEST_PUB.contacts_table;
j number;
lx_individual_owner NUMBER;
lx_group_owner NUMBER;
lx_individual_type VARCHAR2(100) ;

begin

FOR J IN 1 .. 10000
LOOP
-- Populate the SR Record type
--l_service_request_rec.incident_country:= 'US';
--l_service_request_rec.incident_postal_code:= '45202';
l_service_request_rec.incident_location_type :='HZ_PARTY_SITE';
l_service_request_rec.INCIDENT_LOCATION_ID := 276016; --262651;
l_service_request_rec.incident_occurred_date := SYSDATE;
l_service_request_rec.INSTALL_SITE_ID := 276016; --262651;
l_service_request_rec.request_date := SYSDATE;
l_service_request_rec.type_id := 10006; ---
l_service_request_rec.status_id := 1; ---
l_service_request_rec.severity_id := 2; ---
l_service_request_rec.urgency_id := 2;---
--l_service_request_rec.owner_id := 100000101;
l_service_request_rec.summary := 'SR API TEST'; ---
l_service_request_rec.caller_type := 'ORGANIZATION';
l_service_request_rec.customer_number := '276421CH'; --'100692CH'; ---
--l_service_request_rec.verify_cp_flag := 'N';
l_service_request_rec.inventory_item_id := 628814; --607498;
l_service_request_rec.inventory_org_id := 45;
l_service_request_rec.category_id := 3346;
l_service_request_rec.category_set_id := 1;
IF ( l_service_request_rec.owner_id IS NULL
OR l_service_request_rec.owner_id = Fnd_Api.g_miss_num
)
THEN
l_service_request_rec.territory_id := NULL;
ELSE
l_service_request_rec.territory_id := 83;
END IF;

l_notes_table(1).note := 'Test Note';
l_notes_table(1).note_detail:= 'Note details entered here'; -- NULL
l_notes_table(1).note_type := 'ACT_HIS';

dbms_output.put_line('Before calling Public SR API');

cs_servicerequest_PUB.Create_ServiceRequest (
p_api_version => 4.0,
p_init_msg_list => FND_API.G_TRUE,
p_commit => FND_API.G_TRUE,
x_return_status => lx_return_status,
x_msg_count => lx_msg_count,
x_msg_data => lx_msg_data,
p_resp_appl_id => 690,
p_resp_id => 21787,
p_user_id => 10780,
p_login_id => 00,
p_org_id => 150,
p_request_id => null,
p_request_number => null,
p_service_request_rec => l_service_request_rec,
p_notes => l_notes_table,
p_contacts => l_contacts_tab,
P_auto_assign => 'Y',
p_auto_generate_tasks => 'Y',
x_sr_create_out_rec => l_service_request_rec_out,
p_default_contract_sla_ind =>'N',
p_default_coverage_template_id => 0);

if l_service_request_rec_out.auto_task_gen_attempted THEN
dbms_output.put_line('auto task gen status : TRUE');
end if;

dbms_output.put_line('Return Status : ' lx_return_status);
dbms_output.put_line('Inserted request id: ' l_service_request_rec_out.request_id );
dbms_output.put_line('Inserted request num : ' l_service_request_rec_out.request_number );
dbms_output.put_line('Interaction ID : ' l_service_request_rec_out.interaction_id );
dbms_output.put_line('auto task gen status 'l_service_request_rec_out.auto_task_gen_status);
--dbms_output.put_line('auto task gen attempted : 'l_service_request_rec_out.auto_task_gen_attempted);

IF (lx_return_status <> FND_API.G_RET_STS_SUCCESS) then
IF (FND_MSG_PUB.Count_Msg > 1) THEN
--Display all the error messages
FOR j in 1..FND_MSG_PUB.Count_Msg LOOP
FND_MSG_PUB.Get( p_msg_index => j,
p_encoded => 'F', p_data => lx_msg_data,
p_msg_index_out => lx_msg_index_out);

DBMS_OUTPUT.PUT_LINE(lx_msg_data);
END LOOP;
ELSE
--Only one error
FND_MSG_PUB.Get( p_msg_index => 1,
p_encoded => 'F',
p_data => lx_msg_data,
p_msg_index_out => lx_msg_index_out);DBMS_OUTPUT.PUT_LINE(lx_msg_data);
DBMS_OUTPUT.PUT_LINE(lx_msg_index_out);
END IF;
END IF;
END LOOP;
exception
when others then dbms_output.put_line('in others main ' sqlerrm);
end;