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.