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

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

public class GlueMongoFind
extends GlueActivity<GlueContext>

MongoRepository¸¦ ÀÌ¿ëÇÑ Document Á¶È¸.

 »ç¿ë ¿¹
 
 
 - case 1
 
 <activity name="FindAll" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoFind">
     <transition name="success" value="NextActivity" />
     <property name="repository" value="customerRepository" />
     <property name="result-key" value="customerList" />
 </activity>
 
 
 
 - case 2
 
 <activity name="FindById" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoFind">
     <transition name="success" value="NextActivity" />
     <property name="repository" value="customerRepository" />
     <property name="mongo-ids" value="ids" />
     <property name="result-key" value="customerList" />
 </activity>
 ==> ÀÌÀü Activity¿¡¼­ ´ÙÀ½°ú °°ÀÌ ÀúÀåÇÏ°íÀÚ ÇÏ´Â document id Á¤º¸(1°³, n°³ °¡´É) °¡ ctx¿¡ ´ã°Ü ÀÖ¾î¾ß ÇÑ´Ù.  
  ctx.put( "ids", ID );
 
 
 
 - case 3
 
 <activity name="FindOnSort" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoFind">
     <transition name="success" value="NextActivity" />
     <property name="repository" value="customerRepository" />
     <property name="sort-names" value="firstName=asc|lastName=desc" />
     <property name="result-key" value="customerList" />
 </activity>
 
 
 
 - case 4
 
 <activity name="FindByMethod" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoFind">
     <transition name="success" value="NextActivity" />
     <property name="repository" value="customerRepository" />
     <property name="method-name" value="findByFirstName" />
     <property name="method-bindings" value="firstName" />
     <property name="result-key" value="customerList" />
 </activity>
 
 
 
 
 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>
           {
               public Customer findByFirstName(String firstName);
               public List<Customer> findByLastName(String lastName);
           }
       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;
               }
           }
  
 
 - result-key : (¼±ÅÃ) Context¿¡ ´ã±â´Â mongodb Á¶È¸°á°ú
          [ default ] : < repository >_resultList
 
 - method-name : Repository¿¡¼­ Á¦°øÇÏ´Â ´ÙÀ½ method¸¦ Á¦¿ÜÇÑ Á¶È¸¿ë method ¸í.
          [ default ] : »ý·«½Ã mongo-ids¿Í sort-namesÀÇ À¯¹«¿¡ µû¶ó ´ÙÀ½ÀÌ »ç¿ëµÊ
          List findAll()
          List findAll(Sort sort)
          Iterable findAll(Iterable ids)
          T findOne(ID id)
   
 - method-bindings : (¼±ÅÃ) method-name »ç¿ë½Ã ÇØ´ç methodÀÇ ¸Å°³º¯¼ö °ª Á¤º¸.
         ctxName=dataType|ctxName=dataType ÇüÅÂÀÓ.
         ctx.get(ctxName)ÀÇ dataType Á¤º¸·Î ¾øÀ» °æ¿ì StringÀ¸·Î. 
         dataTypeÀº String, int, boolean, ctx.get(ctxName).getClass() À¸·Î ó¸®ÇÔ.
 
 - mongo-ids : (¼±ÅÃ) ctxÀÇ key·Î ±× °ªÀº £À Id¿¡ ÇØ´çÇÑ´Ù.
 
 - sort-names : (¼±ÅÃ) entityÀÇ field name°ú Á¤·Ä Á¤º¸.
         fieldName=asc|fieldName=desc ÇüÅÂÀÓ
 

Author:
ȲÀ¯Áø

Field Summary
 
Fields inherited from class com.poscoict.glueframework.biz.activity.GlueActivity
dynamicProperties, logger
 
Constructor Summary
GlueMongoFind()
           
 
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

GlueMongoFind

public GlueMongoFind()
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.