Set Organization statusId to provisional-member in Liferay - liferay

How do I set the organization's status to provisional-member for the type com.liferay.portal.model.Organization.status ?
When I do
GetterUtil.getInteger(PropsUtil.get("sql.data.com.liferay.portal.model.ListType.organization.status"));
it sets organization status to full-member.

This sql.data.com.liferay.portal.model.ListType.organization.status is a property in portal.properties which you can override in your portal-ext.properties.
So you can give the property in your portal-ext.properties for provisional-member as:
#
# Set the default SQL IDs for common objects.
#
sql.data.com.liferay.portal.model.ListType.organization.status=12018
The IDs in the ListType table more or less remain constant through out versions, atleast I have seen this to be constant from Liferay CE 6.0 to 6.1 EE GA2.
Another method
Or else another way would be to have a new property in your portal-ext.properties something like:
sql.data.com.liferay.portal.model.ListType.organization.status.provisional=12018
And then you can get it in your code anywhere by using:
GetterUtil.getInteger(PropsUtil.get("sql.data.com.liferay.portal.model.ListType.organization.status.provisional"));
But this second would work only for your custom code in your custom-portlet or hook and not in liferay's code.
Hope this gives some help in solving the issue.

Related

How to populate an edit field with the computer host name?

I have an edit field that is set to a property.
Now I want that property initially populated with the host name.
Things I've tried so far:
[%ComputerName]
[ComputerName]
{ComputerName}
None of which are working
It's unclear where you put that, but I'm assuming you mean the Property setting for the edit control. That won't work. Instead you need to associate the edit control with a regular property (so it can be updated), and set the value of that property with a Set Property custom action before this is shown.
Note that in order to support supplying the value from a command-line install (especially a silent one) you may wish to condition the Set Property action not to fire when the property already has a value.
To set a default value for this control, make sure the property is a public property by giving it a name that contains only uppercase letters, use the Property Manager view to add the public property, and then assign to it the value of the default selection.
Before accessing this property first you need to set that property. You need to call either SetProperty CustomAction or you need to add that property in Property Manager.
And [COMPUTER_NAME] is the correct way to access it.

Coded ui- How to update properties of object in UImap.uitest file which has changed in application?

Coded ui- How to update properties of object in UImap.uitest file which has changed in application? for example a window which has version of software changes with every build. The issue is if I try to record anything on new version of software it creates new objects in UImap and the whole object tree again. This makes UImap too huge adding duplicates of objects with slightly different property.
You don't want to update the properties to latest, but make the property values dynamic. Just updating the properties will mean more work the next time your code changes.
Also, try to only use properties to search on that do not change between application runs/versions. Example, a class property will likely remain static between runs, while the title of your parent window may change based on the version number. Check out this article to see how to modify the recording's search properties to fit your needs, specifically the section on modifying UI action properties.
Another method to look into would be to create the objects and methods yourself using C#. By adding controls yourself to the uimap.cs partial class of the .uitest, you have can specify at design time what properties and values that Coded UI uses to execute your tests.

how can I access endpoint properties set in faces-config.xml programmatically?

I am using the IBM Social Business Toolkit. I have defined a connection for my Notes app via endpoints in the faces-config xml file. I wonder how I can access this file pro grammatically since I could not find a service that returns me the base url of IBM Connections.
It's useful to remember that an endpoint definition is really just creating a managed bean. The managed bean has a variable name you refer to it - the managed-bean-name property. You can access this directly from SSJS or via ExtLibUtil.resolveVariable() in Java. The definition also tells you the Java class that's being used, e.g. com.ibm.sbt.services.endpoints.ConnectionsBasicEndpoint. That really gives you all the information you need to get or set the properties.
So from SSJS you can just cast it to the class name, e.g.
var myService:com.ibm.sbt.services.endpoints.ConnectionsBasicEndpoint = connections
So the bit after the colon will be the managed-bean-class value and the bit after the equals sign will be the managed-bean-name. In Java, you can use
ConnectionsBasicEndpoint myService = (ConnectionsBasicEndpoint) ExtLibUtil.resolveVariable(ExtLibUtil.getXspContext().getFacesContext(), "connections");
You'll then have access to all the methods of the class, so you should be able to retrieve what you need.
The properties are part of the Java class, who are referred to in the Faces-Config.xml. So get the class by his fully qualified name or by bean name and set or get the properties
I think the best route will most likely be what Paul is suggesting: resolve the variable by its name and use the getters to get the effective properties that way.
Sven's suggestion is a good one to keep in mind for other situations. By accessing the faces-config.xml file as a resource, you could load it into an XML parser and find the values using XPath. I'm doing much that sort of technique in the next version of the OpenNTF Domino API, which will have a set of methods for manipulating the Faces config. However, one key aspect there is that reading the XML file directly will just get you the string values, which may be EL expressions, whereas going the resolveVariable route will get you the real current properties.

Siebel read only field problem

I'm trying to make a field read only when a given value is selected from a PickList.
I'm using a flag that is set to Y when the list has that value, and N otherwise.
I created a Business Component User Prop with the name Field Read Only Field: MyField set to the flag.
Thing is, this works with the vanilla component but it wont work on my custom component.
I can't figure out what is going on, the properties of the fields and flag are exactly the same. It should work...
Thanks for any help you can give me.
That user property is only supported on the business component class CSSBCBase and its subclasses. My guess is that you probably used CSSBusComp as the class of your business component. CSSBusComp is actually a superclass of CSSBCBase, and is very minimal and does not support Field Read Only Field. If that's the case, change it to CSSBCBase and you should be good to go.
Other option is that- if the record become read-only when the picklist value is being selected- that you'll need to make the picklist field Immediate Post Changes to be sure the user property is triggered.

Store per user data in sharepoint webpart

I got to store some user specific data (string) in my Sharepoint webpart.I guess hidden webpart properties should do the trick. Tried with the following attributes on webpart property:
[WebBrowsable(false)]
[Bindable(true)]
[WebPartStorage(Storage.Personal)]
[Personalizable(PersonalizationScope.User)]
But I observe in the webpart that data stored is not user specific. Any help?
How are you reading your data ? You can use the WebPart.PartCacheRead method to retrieve per use values.
web.config can be modified to signal how you want your WebPartCache to be stored. To support caching in database then you must include the [Serializable()] attribute to you custom classes
The WebPart.EffectiveStorage property can also help in determining how the data is stored:
if (EffectiveStorage == Storage.Shared)
{
output.Write("<b>You are now in shared mode.</b>");
}
Just wondering why you have WebBrowsable attribute set as false. Are the users not able to configure the web part ? When and how is the property value set ?

Resources