on 06-04-2012 12:49 PM
Hi All
We have tried to add a group in collaborator which we are able to get the email, role, type, rule everything except the name of the group. We also are able to get the name of the collaborator Group but not in the section of collaborator.Please help how to pull the group name. Here is the code which we have used and I have also attached the screenshot which we are getting.
import com.sap.eso.api.contracts.AgreementIBeanIfc;
import com.sap.eso.api.contracts.ContractIBeanIfc;
import com.sap.eso.api.projects.ProjectIBeanIfc;
import com.sap.eso.api.rfx.RfxDocIBeanIfc;
import com.sap.eso.odp.runtime.dynenum.DocLinkDirectionTypeEnum;
import com.sap.odp.api.common.exception.ApplicationException;
import com.sap.odp.api.common.log.LogMessageIfc;
import com.sap.odp.api.common.log.Logger;
import com.sap.odp.api.common.platform.IapiSessionContextIfc;
import com.sap.odp.api.common.types.LocalizedObjectReferenceIfc;
import com.sap.odp.api.common.types.ObjectReferenceIfc;
import com.sap.odp.api.doc.DocLinkDefinitionTypeEnumType;
import com.sap.odp.api.doc.DocumentLinkIBeanIfc;
import com.sap.odp.api.doc.collaboration.CollaboratorApprovalRuleType;
import com.sap.odp.api.doc.collaboration.CollaboratorIBeanIfc;
import com.sap.odp.api.doc.collaboration.CollaboratorRoleIBeanHomeIfc;
import com.sap.odp.api.doccommon.masterdata.DocumentLinkDefinitionIBeanIfc;
import com.sap.odp.api.doccommon.masterdata.purchasing.BusinessUnitIBeanHomeIfc;
import com.sap.odp.api.doccommon.masterdata.purchasing.BusinessUnitIBeanIfc;
import com.sap.odp.api.ibean.CollectionIfc;
import com.sap.odp.api.ibean.ExtensionFieldIfc;
import com.sap.odp.api.ibean.IBeanHomeLocator;
import com.sap.odp.api.ibean.IBeanIfc;
import com.sap.odp.api.ibean.OrderedSubordinateCollectionIfc;
InternalCatIBeanHomeIfc IntCatObj = (InternalCatIBeanHomeIfc)IBeanHomeLocator.lookup(session, doc.getInternalCatObjRef());
InternalCatIBeanIfc IntCatBeanObj = (InternalCatIBeanIfc)IntCatObj.find(doc.getInternalCatObjRef());
ExtensionFieldIfc OrgUnit = IntCatBeanObj.getExtensionField("PURCH_SECTOR") ;
ObjectReferenceIfc grpOR=(ObjectReferenceIfc) OrgUnit.get();
//doc.setDocumentDescription( "grpOR.getObjectId() -- " + grpOR.getObjectId() + " --getDisplayName()- " + grpOR.getDisplayName() + " --getClassId()- " + grpOR.getClassId() );
BusinessUnitIBeanHomeIfc orgUnitDBObj = (BusinessUnitIBeanHomeIfc)IBeanHomeLocator.lookup(session, BusinessUnitIBeanHomeIfc.sHOME_NAME);
String whereClause=("OBJECTID= " + grpOR.getObjectId());
if( orgUnitDBObj == null )
{
doc.setDocumentDescription("null");
}
else
{
doc.setDocumentDescription("orgUnitDBObj "+grpOR.getObjectId() ); //returns orgUnitObj object id
}
//chekd till here
List orgUnitLists = orgUnitDBObj.findWhere(whereClause);
BusinessUnitIBeanIfc orgUnitBeanObj = null;
if (orgUnitLists != null)
{
orgUnitBeanObj = (BusinessUnitIBeanIfc)orgUnitLists.get(0);
doc.setDocumentDescription("orgUnitBeanObj"+" "+orgUnitBeanObj.getDisplayName());
}
else
{
doc.setDocumentDescription("orgUnitLists"+" "+"Null");
}
//tested till here
LocalizedObjectReferenceIfc grpType = (LocalizedObjectReferenceIfc)doc.getExtensionField("TYPE_GSB").get();
String grpTypeName = grpType.getDisplayName();
OrderedSubordinateCollectionIfc rColCol=(OrderedSubordinateCollectionIfc) doc.getCollaborators();
CollaboratorIBeanIfc cNM=(CollaboratorIBeanIfc)rColCol.create();
CollaboratorRoleIBeanHomeIfc cRole=(CollaboratorRoleIBeanHomeIfc)IBeanHomeLocator.lookup(session, CollaboratorRoleIBeanHomeIfc.sHOME_NAME);
if (grpTypeName.equals("A"))
{
doc.setDocumentDescription("Type of GSB" + grpTypeName);
ExtensionFieldIfc SectGrpXtn = (ExtensionFieldIfc)orgUnitBeanObj.getExtensionField("SECT_GSB_ADMIN");
String str1= SectGrpXtn.get().toString();
doc.setDocumentDescription("Collaborators" + str1);
cNM.setApprovalRule(new CollaboratorApprovalRuleType(CollaboratorApprovalRuleType.ANY));
cNM.setCollaboratorEmail("lopita.dash@");
cNM.setDisplayName("Group");
//CollaboratorRoleIBeanIfc aCB=(CollaboratorRoleIBeanIfc)cRole.getPrincipal();
//cNM.getCollaboratorRole().set(aCB.getObjectReference());cNM.setLockRole(true);
rColCol.add(cNM);
}
else if(grpTypeName.equals("B"))
{
doc.setDocumentDescription("Type of GSB" + grpTypeName);
ExtensionFieldIfc CorpGrpXtn = (ExtensionFieldIfc)orgUnitBeanObj.getExtensionField("CORP_GSB_ADMIN");
String str2= CorpGrpXtn.get().toString();
doc.setDocumentDescription("Collaborators" + str2);
cNM.setApprovalRule(new CollaboratorApprovalRuleType(CollaboratorApprovalRuleType.ANY));
cNM.setCollaboratorEmail("lopita.dash@");;
cNM.setDisplayName("Group");
//CollaboratorRoleIBeanIfc aCB=(CollaboratorRoleIBeanIfc)cRole.findUniqueByName("Corporate GSB Admin");
//cNM.getCollaboratorRole().set(aCB.getObjectReference());
cNM.setLockRole(true);
rColCol.add(cNM);
}
Resolved!
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.