com.poscoict.glueframework.biz.activity.mongodb
Class GlueMongoSave
java.lang.Object
com.poscoict.glueframework.biz.activity.GlueActivity<GlueContext>
com.poscoict.glueframework.biz.activity.mongodb.GlueMongoSave
public class GlueMongoSave
- extends GlueActivity<GlueContext>
MongoRepository를 이용한 Document 저장.
Activity Property
- repository : (필수) applicationContext.xml의 repository id.
- 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
예제
사용 예# 1
사용 예# 2
사용 예# 3
참고 : applicationContext.xml
참고 : MongoRepository 확장
package sample.repository;
import org.springframework.data.mongodb.repository.MongoRepository;
import sample.vo.Customer;
public interface CustomerRepository extends MongoRepository {
}
참고 : 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 firstName;
private String lastName;
public Customer( String firstName, String lastName ) {
this.firstName = firstName;
this.lastName = lastName;
}
}
참고 : Java Code (Custom)
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( "dataList", dataList );
ctx.put( "fName", "glue" );
ctx.put( "lName", "f/w" );
- Author:
- 황유진
| Methods inherited from class com.poscoict.glueframework.biz.activity.GlueActivity |
commitTransaction, commitTransaction, getDao, getEventList, getName, getProperty, getPropertyNames, getTransition, rollbackTransaction, rollbackTransaction, setEventList, setName, setProperty, setTransition |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
GlueMongoSave
public GlueMongoSave()
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 한다.
예)
==> return "success"이면 BizLogic Activity 를 실행함.
Copyright © 2013–2018 POSCO ICT. All rights reserved.