Class GlueMongoDelete

java.lang.Object
com.poscoict.glueframework.biz.activity.GlueActivity<GlueContext>
com.poscoict.glueframework.biz.activity.mongodb.GlueMongoDelete

public class GlueMongoDelete extends GlueActivity<GlueContext>
MongoRepository를 이용한 Document 삭제.
 Activity Property

 - repository : (필수) applicationContext.xml의 repository id.

 - entity-id : (선택) 미입력시 repository의 모든 data 삭제
      삭제하고자 하는 entity 정보로 ctx에 담긴 객체를 나타낸다. 
      ctx에 담긴 객체는 ID일수도 Entity 일수도 있다.



 예제
 
 사용 예# 1

     <activity name="DeleteAll" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoDelete">
         <transition name="success" value="NextActivity" />
         <property name="repository" value="customerRepository" />
     </activity>


 사용 예# 2

     <activity name="Custom" class="...">
         <transition name="success" value="DeleteById" />
     </activity>
     <activity name="DeleteById" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoDelete">
         <transition name="success" value="NextActivity" />
         <property name="repository" value="customerRepository" />
         <property name="entity-id" value="dataId" />
     </activity>



 사용 예# 3

     <activity name="Custom" class="...">
         <transition name="success" value="DeleteByEntity" />
     </activity>
     <activity name="DeleteByEntity" class="com.poscoict.glueframework.biz.activity.mongodb.GlueMongoDelete">
         <transition name="success" value="NextActivity" />
         <property name="repository" value="customerRepository" />
         <property name="entity-id" value="dataEntity" />
     </activity>



 참고 : applicationContext.xml

     <mongo:repositories base-package="sample.repository" />


 참고 : MongoRepository 확장

     package sample.repository;
     import org.springframework.data.mongodb.repository.MongoRepository;
     import sample.vo.Customer;
     public interface CustomerRepository extends MongoRepository<Customer, String> {
     }


 참고 : Document

     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 name;
         public Customer( String name ) {
             this.name = name;
         }
     }


 참고 : Java Code (Custom)

     ctx.put( "dataId", ID );
     ctx.put( "dataEntity", repository.findXXX(...) );
 
Author:
황유진
  • Constructor Details

    • GlueMongoDelete

      public GlueMongoDelete()
  • Method Details

    • runActivity

      public String runActivity(GlueContext ctx)
      Description copied from class: GlueActivity
      Sub Class에서 반드시 구현하여야 하는 Abstract Method 이며 이 Method는 F/W에서 호출한다. 결과 값은 GlueContext에 담아서 다음 Activity 또는 F/W에 전달하게 된다. 필요한 모든 Data는 GlueContext에서 호출하여 사용하게 된다.
      
       예)
       <transition name="success" value="BizLogic"/>
       <transition name="failure" value="ErrorHandle"/>
       ==> return "success"이면 BizLogic Activity 를 실행함.
       
      Specified by:
      runActivity in class GlueActivity<GlueContext>
      Parameters:
      ctx - GlueContext
      Returns:
      String 정상적이면 "success"를 Return 하고 비정상 처리를 원하면 "failure"를 Return 한다.