本文整理汇总了Java中org.apache.chemistry.opencmis.client.api.Property类的典型用法代码示例。如果您正苦于以下问题:Java Property类的具体用法?Java Property怎么用?Java Property使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Property类属于org.apache.chemistry.opencmis.client.api包,在下文中一共展示了Property类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: assertIsPwcProperty
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
private void assertIsPwcProperty(CmisObject pwc, boolean nullExpected)
{
boolean isPwcFound = false;
Boolean isPwcValueTrue = null;
for (Property<?> property : pwc.getProperties())
{
if ((null != property) && PropertyIds.IS_PRIVATE_WORKING_COPY.equals(property.getId()))
{
isPwcFound = true;
isPwcValueTrue = property.getValue();
break;
}
}
if (nullExpected)
{
assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property is not null!"), !isPwcFound || (null == isPwcValueTrue));
return;
}
assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property has not been found!"), isPwcFound);
assertNotNull(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property value must not be null!"), isPwcValueTrue);
assertTrue(("'" + PropertyIds.IS_PRIVATE_WORKING_COPY + "' property value must be equal to 'true'!"), isPwcValueTrue);
}
示例2: serialize
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
@Override
public void serialize(Property<?> value, JsonGenerator jgen, SerializerProvider provider)
throws IOException, JsonGenerationException {
jgen.writeStartObject();
jgen.writeStringField("queryName", value.getQueryName());
jgen.writeStringField("displayName", value.getDisplayName());
jgen.writeStringField("propertyType", value.getType().toString());
jgen.writeFieldName("value");
jgen.writeObject(value.getValue());
jgen.writeObjectField("definition", value.getDefinition());
jgen.writeEndObject();
}
示例3: doInBackground
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
@Override
protected CmisResult<List<Map<String, ?>>> doInBackground(Void... arg0) {
List<Map<String, ?>> list = null;
Exception exception = null;
// Find the cmisobject associated to the id and returns the list of
// properties.
try {
cmisObject = session.getObject(objectId);
list = new ArrayList<Map<String, ?>>();
List<Property<?>> props = cmisObject.getProperties();
for (Property<?> prop : props) {
list.add(ListUtils.createPair(prop.getDisplayName(), (prop.isMultiValued()) ? prop.getValuesAsString()
.replace("[", "").replace("]", "") : prop.getValueAsString()));
}
} catch (Exception e) {
exception = e;
}
return new CmisResult<List<Map<String, ?>>>(exception, list);
}
示例4: getProperties
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
public static Map<String, Serializable> getProperties(List<Property<?>> properties)
{
Map<String, Serializable> propertiesMap = new HashMap<String, Serializable>();
for(Property<?> p : properties)
{
propertiesMap.put(p.getId(), p.getValueAsString());
}
return propertiesMap;
}
示例5: generatePropertiesXml
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
private org.jdom.Document generatePropertiesXml(final CmisObject cmisObject) {
final Element root = new Element(CmisImporterConstants.CMIS_IMPORT);
final Element rChild = new Element(CmisImporterConstants.PROPERTIES);
final List<Property<?>> propList = cmisObject.getProperties();
for (int i = 0; i < propList.size(); i++) {
rChild.addContent(createProperty(propList.get(i).getDisplayName(), propList.get(i).getValueAsString()));
}
root.addContent(rChild);
return new org.jdom.Document(root);
}
示例6: buildListOfNameValueMaps
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
/**
* Creates a list of maps. It allows the creation of properties listAdapter.
*/
public static List<Map<String, ?>> buildListOfNameValueMaps(CmisObject object) {
List<Map<String, ?>> list = new ArrayList<Map<String, ?>>();
for (Property<?> cmisProperty : object.getProperties()) {
list.add(createPair(cmisProperty.getDisplayName(), cmisProperty.getValueAsString()));
}
return list;
}
示例7: testMNT_10161
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
@Test
public void testMNT_10161() throws Exception
{
final TestNetwork network1 = getTestFixture().getRandomNetwork();
String username = "user" + System.currentTimeMillis();
PersonInfo personInfo = new PersonInfo(username, username, username, TEST_PASSWORD, null, null, null, null, null, null, null);
TestPerson person1 = network1.createUser(personInfo);
String person1Id = person1.getId();
final String siteName = "site" + System.currentTimeMillis();
final String nodeDescription = "Test description";
final String nodeName = GUID.generate();
TenantUtil.runAsUserTenant(new TenantRunAsWork<NodeRef>()
{
@Override
public NodeRef doWork() throws Exception
{
SiteInformation siteInfo = new SiteInformation(siteName, siteName, siteName, SiteVisibility.PRIVATE);
TestSite site = repoService.createSite(null, siteInfo);
NodeRef folderNodeRef = repoService.createFolder(site.getContainerNodeRef(DOCUMENT_LIBRARY_CONTAINER_NAME), nodeName);
/* create node with property description */
return repoService.createDocument(folderNodeRef, nodeName, "title", nodeDescription, "content");
}
}, person1Id, network1.getId());
publicApiClient.setRequestContext(new RequestContext(network1.getId(), person1Id));
CmisSession cmisSession = publicApiClient.createPublicApiCMISSession(Binding.atom, CMIS_VERSION_11);
Document doc =
(Document)cmisSession.getObjectByPath("/Sites/" + siteName + "/documentLibrary/" + nodeName + "/" + nodeName);
/* ensure we got the node */
assertNotNull(doc);
/* get mapped cmis:description */
Property<?> descrProperty = doc.getProperty(PropertyIds.DESCRIPTION);
/* ensure that cmis:description is set properly */
assertTrue(nodeDescription.equals(descrProperty.getValue()));
}
示例8: PropertySerializer
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
public PropertySerializer() {
super(Property.class, true);
}
示例9: serialize
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
@Override
public void serialize(Document value, JsonGenerator gen, SerializerProvider serializers)
throws IOException, JsonProcessingException {
gen.writeStartObject();
gen.writeStringField("id", value.getId());
gen.writeStringField("name", value.getName());
gen.writeStringField("description", value.getDescription());
gen.writeStringField("type", value.getType().getId());
gen.writeStringField("typeName", value.getType().getDisplayName());
gen.writeStringField("baseType", value.getBaseType().getId());
gen.writeStringField("baseTypeName", value.getBaseType().getDisplayName());
gen.writeStringField("version", value.getVersionLabel());
gen.writeObjectField("isLatestVersion", (Boolean) value.getPropertyValue(PropertyIds.IS_LATEST_VERSION));
gen.writeObjectField("isMajorVersion", (Boolean) value.getPropertyValue(PropertyIds.IS_MAJOR_VERSION));
gen.writeObjectField("created", value.getCreationDate());
gen.writeStringField("createdBy", value.getCreatedBy());
gen.writeObjectField("lastModificationDate", value.getPropertyValue(PropertyIds.LAST_MODIFICATION_DATE));
gen.writeStringField("lastModifiedBy", (String) value.getPropertyValue(PropertyIds.LAST_MODIFIED_BY));
// Aspetti
gen.writeObjectField("secondaryObjectTypeIds", value.getPropertyValue(PropertyIds.SECONDARY_OBJECT_TYPE_IDS));
// Proprietà
Map<String, Property<?>> lMapProps = new LinkedHashMap<String, Property<?>>();
for (Property<?> prop : value.getProperties()) {
if (DEFAULT_PROPERTIES.contains(prop.getId())) {
// Inutile rimettere le proprietà predefinite nell'elenco delle proprietà
continue;
}
lMapProps.put(prop.getQueryName(), prop);
}
gen.writeObjectField("properties", lMapProps);
gen.writeFieldName("relationships");
gen.writeStartArray();
List<Relationship> lRelationships = value.getRelationships();
if (lRelationships != null) {
for (Relationship lRelationship : lRelationships) {
gen.writeObject(lRelationship);
}
}
gen.writeEndArray();
gen.writeEndObject();
}
示例10: objectProperties
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
public static Map<String, Object> objectProperties(CmisObject cmisObject) {
List<Property<?>> propertyList = cmisObject.getProperties();
return propertyDataToMap(propertyList);
}
示例11: processCMISEvent
import org.apache.chemistry.opencmis.client.api.Property; //导入依赖的package包/类
/**
* Iterates the document properties
*/
@Override
protected EventResult processCMISEvent(Event event) throws Exception
{
if (logger.isDebugEnabled())
{
logger.debug("Entering 'IterateDocumentProperties' event processor.");
}
// timer control
super.suspendTimer();
// get event data
CMISEventData data = (CMISEventData) event.getData();
if (data == null)
{
logger.warn("Unable to iterate CMIS properties: no session provided");
return new EventResult("Unable to iterate CMIS properties: no session provided.", false);
}
// get document
Document document = data.getDocument();
if (null == document)
{
logger.warn("Unable to iterate CMIS properties: no document provided.");
return new EventResult("Unable to iterate CMIS properties: no document provided.", false);
}
// Timer control
super.resumeTimer();
// iterate properties
List<Property<?>> l = document.getProperties();
Iterator<Property<?>> i = l.iterator();
int totalProps = 0;
String docMSg = "";
if (logger.isDebugEnabled())
{
docMSg = "Document '" + document.getName() + " (" + document.getId() + ")' found property '";
}
while (i.hasNext())
{
Property<?> p = i.next();
String name = p.getLocalName();
PropertyType t = p.getType();
totalProps++;
if (logger.isDebugEnabled())
{
logger.debug(docMSg + name + "', type '" + t.toString() + "'");
}
}
// Timer control
super.stopTimer();
// Done
Event doneEvent = new Event(this.eventNameIterateCompleted, data);
EventResult result = new EventResult(BasicDBObjectBuilder.start()
.append("msg", "Successfully iterated document properties.").append("totalProperties", totalProps)
.push("document").append("id", document.getId()).append("name", document.getName()).push("properties")
.pop().get(), doneEvent);
return result;
}