Adding user in specific Space in Webcenter

Small tip – To add user in space with some specified or custom role

Solution -If you are using PS6, this code will help you doing that.

    public void addMemberInSpace(String SpaceName, String userid) throws GroupSpaceWSException {
        
      
        logger.fine("Entering AddMember");
        try {
            GroupSpaceWSClient Gsclient = new GroupSpaceWSClient(contextData);

            String userRole = "CustomRole"; // You can define default role as admin, viewer, Moderator or some custom role as well
            GroupSpaceWSMembers memberData = new GroupSpaceWSMembers(userid, userRole);
            
            //Approval code will be added
            List<GroupSpaceWSMembers> addMem = new ArrayList<GroupSpaceWSMembers>();
            addMem.add(memberData);
            Gsclient.addMember(SpaceName, addMem);
            
        } catch (oracle.webcenter.spaces.ws.client.GroupSpaceWSException gsException) {
          
            throw gsException;
        } catch (Exception exception) {
          
            throw new GroupSpaceWSException("Exception caught during addMembership ", null, null, exception, null);
        }
       
    }

 

Happy Coding with techartifact….

Sorting of Programmatic or transient view object in Oracle ADF

Tip- to sort a transient view object

When we use transient View Object to store data to represent in UI or manipulate business logic.
We may need to sort these Transient ViewObjects based on certain attribute.Add this below code to represent sort data.

transVo.setSortBy("AttributeName");
transVo.setQueryMode(ViewObject.QUERY_MODE_SCAN_VIEW_ROWS);
transVo.executeQuery();

Happy coding with Vinay in Techartifact …..

Programmatic Navigation in JSF/ADF | Techartifact

Requirement-How to programmatically navigate to next jsf page in taskflow.

Solution-

Following code show the sample code for navigating one jsf to another using code.

FacesContext context = FacesContext.getCurrentInstance();
context.getApplication().getNavigationHandler().handleNavigation(context,null,"controlflowcase");

Package: javax.faces.application.NavigationHandler

public abstract void handleNavigation(FacesContext context, String fromAction, String outcome)

Perform navigation processing based on the state information in the specified FacesContext,plus the outcome string returned by an executed application action.
Parameters:
context – The FacesContext for the current request.
fromAction – The action binding expression that was evaluated to retrieve the specified outcome,or null if the outcome was acquired by some other means.
outcome – The logical outcome returned by a previous invoked application action (which may be null)

happy coding with techartifact . 🙂