com.poscoict.glueframework.biz.activity.mongodb
Class GlueMongoSave

java.lang.Object
  extended by com.poscoict.glueframework.biz.activity.GlueActivity<GlueContext>
      extended by com.poscoict.glueframework.biz.activity.mongodb.GlueMongoSave

public class GlueMongoSave
extends GlueActivity<GlueContext>

MongoRepository를 이용한 Document 저장.

 사용 예
 
 
 - case 1
 
 <activity name="Save" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoSave">
     <transition name="success" value="NextActivity" />
     <property name="repository" value="customerRepository" />
     <property name="entity-id" value="data" />
 </activity>
 ==> 이전 Activity에서 다음과 같이 저장하고자 하는 document 정보(1개, n개 가능) 가 ctx에 담겨 있어야 한다.  
  ctx.put( "data", new Customer("glue", "f/w") );
  
  List dataList = new ArrayList();
  dataList.add(new Customer("glue", "f/w"));
  dataList.add(new Customer("spring", "f/w"));
  ctx.put( "data", dataList );
 
 
 
 - case 2
 
 <activity name="SaveEntity" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoSave">
     <transition name="success" value="NextActivity" />
     <property name="repository" value="customerRepository" />
     <property name="entity-name" value="sample.vo.Customer" />
     <property name="entity-bindings" value="firstName=fName|lastName=lName" />
 </activity>
 ==> 이전 Activity에서 다음과 같이 저장하고자 하는 document 생성 정보(1개) 가 ctx에 담겨 있어야 한다.  
  ctx.put( "fName", "glue" );
  ctx.put( "lName", "f/w" );
 
 
 
 
 Property 설정
 - repository : (필수) applicationContext.xml의 repository id.
   ex)
       1. applicationContext.xml 일부
           <mongo:repositories base-package="sample.repository" />
       2. reposotory 일부
           package sample.repository;
           import org.springframework.data.mongodb.repository.MongoRepository;
           import sample.vo.Customer;
           public interface CustomerRepository extends MongoRepository<Customer, String>
           {
           }
       3. entity 일부
           package sample.vo;
           import org.springframework.data.annotation.Id;
           import org.springframework.data.mongodb.core.mapping.Document;
           @ Document
           public class Customer
           {
               @ Id
               private String id;
               private String firstName;
               private String lastName;
               public Customer( String firstName, String lastName )
               {
                   this.firstName = firstName;
                   this.lastName = lastName;
               }
           }
  
 
 - entity-id / entity-name : (필수) 둘 중 하나만 항상 있어야 함.  
       entity-id :  ctx에 담긴 entity를 나타내는 key
       entity-name : 생성하고자 하는 entity class명
   
 - entity-bindings : (선택) entity-name이 사용될 경우 필요함.
               binding에 사용되는 값과 Mapping 되는 Key( fieldName=ctxKey[|fieldName=ctxKey] ).
   
 - result-key : (선택) Context에 담기는 mongodb 저장결과
          [ default ] : < repository >_result
 

Author:
황유진

Field Summary
 
Fields inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
dynamicProperties, logger
 
Constructor Summary
GlueMongoSave()
           
 
Method Summary
 String runActivity(GlueContext ctx)
          Sub Class에서 반드시 구현하여야 하는 Abstract Method 이며 이 Method는 F/W에서 호출한다.
 
Methods inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
commitTransaction, getDao, getEventList, getName, getProperty, getPropertyNames, getTransition, rollbackTransaction, setEventList, setName, setProperty, setTransition
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

GlueMongoSave

public GlueMongoSave()
Method Detail

runActivity

public String runActivity(GlueContext ctx)
Description copied from class: GlueActivity
Sub Class에서 반드시 구현하여야 하는 Abstract Method 이며 이 Method는 F/W에서 호출한다. 결과 값은 GlueContext에 담아서 다음 Activity 또는 F/W에 전달하게 된다. 필요한 모든 Data는 GlueContext에서 호출하여 사용하게 된다.

Specified by:
runActivity in class GlueActivity<GlueContext>
Parameters:
ctx - GlueContext
Returns:
String 정상적이면 "success"를 Return 하고 비정상 처리를 원하면 "failure"를 Return 한다.
 예) 
 <transition name="success" value="BizLogic"/>
 <transition name="failure" value="ErrorHandle"/>
 ==> return "success"이면 BizLogic Activity 를 실행함.
 


Copyright © 2013–2014 POSCO ICT SW제품기술팀. All rights reserved.