id
int32 0
165k
| repo
stringlengths 7
58
| path
stringlengths 12
218
| func_name
stringlengths 3
140
| original_string
stringlengths 73
34.1k
| language
stringclasses 1
value | code
stringlengths 73
34.1k
| code_tokens
list | docstring
stringlengths 3
16k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 105
339
|
|---|---|---|---|---|---|---|---|---|---|---|---|
157,300
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
|
MapFileGenerator.addClass
|
private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException
{
String className = jarEntry.getName().replaceAll("\\.class", "").replaceAll("/", ".");
writer.writeStartElement("class");
writer.writeAttribute("name", className);
Set<Method> methodSet = new HashSet<Method>();
Class<?> aClass = loader.loadClass(className);
processProperties(writer, methodSet, aClass);
if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers()))
{
processClassMethods(writer, aClass, methodSet);
}
writer.writeEndElement();
}
|
java
|
private void addClass(URLClassLoader loader, JarEntry jarEntry, XMLStreamWriter writer, boolean mapClassMethods) throws ClassNotFoundException, XMLStreamException, IntrospectionException
{
String className = jarEntry.getName().replaceAll("\\.class", "").replaceAll("/", ".");
writer.writeStartElement("class");
writer.writeAttribute("name", className);
Set<Method> methodSet = new HashSet<Method>();
Class<?> aClass = loader.loadClass(className);
processProperties(writer, methodSet, aClass);
if (mapClassMethods && !Modifier.isInterface(aClass.getModifiers()))
{
processClassMethods(writer, aClass, methodSet);
}
writer.writeEndElement();
}
|
[
"private",
"void",
"addClass",
"(",
"URLClassLoader",
"loader",
",",
"JarEntry",
"jarEntry",
",",
"XMLStreamWriter",
"writer",
",",
"boolean",
"mapClassMethods",
")",
"throws",
"ClassNotFoundException",
",",
"XMLStreamException",
",",
"IntrospectionException",
"{",
"String",
"className",
"=",
"jarEntry",
".",
"getName",
"(",
")",
".",
"replaceAll",
"(",
"\"\\\\.class\"",
",",
"\"\"",
")",
".",
"replaceAll",
"(",
"\"/\"",
",",
"\".\"",
")",
";",
"writer",
".",
"writeStartElement",
"(",
"\"class\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"className",
")",
";",
"Set",
"<",
"Method",
">",
"methodSet",
"=",
"new",
"HashSet",
"<",
"Method",
">",
"(",
")",
";",
"Class",
"<",
"?",
">",
"aClass",
"=",
"loader",
".",
"loadClass",
"(",
"className",
")",
";",
"processProperties",
"(",
"writer",
",",
"methodSet",
",",
"aClass",
")",
";",
"if",
"(",
"mapClassMethods",
"&&",
"!",
"Modifier",
".",
"isInterface",
"(",
"aClass",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"processClassMethods",
"(",
"writer",
",",
"aClass",
",",
"methodSet",
")",
";",
"}",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}"
] |
Add an individual class to the map file.
@param loader jar file class loader
@param jarEntry jar file entry
@param writer XML stream writer
@param mapClassMethods true if we want to produce .Net style class method names
@throws ClassNotFoundException
@throws XMLStreamException
@throws IntrospectionException
|
[
"Add",
"an",
"individual",
"class",
"to",
"the",
"map",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L178-L194
|
157,301
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
|
MapFileGenerator.processProperties
|
private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException
{
BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (int i = 0; i < propertyDescriptors.length; i++)
{
PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
if (propertyDescriptor.getPropertyType() != null)
{
String name = propertyDescriptor.getName();
Method readMethod = propertyDescriptor.getReadMethod();
Method writeMethod = propertyDescriptor.getWriteMethod();
String readMethodName = readMethod == null ? null : readMethod.getName();
String writeMethodName = writeMethod == null ? null : writeMethod.getName();
addProperty(writer, name, propertyDescriptor.getPropertyType(), readMethodName, writeMethodName);
if (readMethod != null)
{
methodSet.add(readMethod);
}
if (writeMethod != null)
{
methodSet.add(writeMethod);
}
}
else
{
processAmbiguousProperty(writer, methodSet, aClass, propertyDescriptor);
}
}
}
|
java
|
private void processProperties(XMLStreamWriter writer, Set<Method> methodSet, Class<?> aClass) throws IntrospectionException, XMLStreamException
{
BeanInfo beanInfo = Introspector.getBeanInfo(aClass, aClass.getSuperclass());
PropertyDescriptor[] propertyDescriptors = beanInfo.getPropertyDescriptors();
for (int i = 0; i < propertyDescriptors.length; i++)
{
PropertyDescriptor propertyDescriptor = propertyDescriptors[i];
if (propertyDescriptor.getPropertyType() != null)
{
String name = propertyDescriptor.getName();
Method readMethod = propertyDescriptor.getReadMethod();
Method writeMethod = propertyDescriptor.getWriteMethod();
String readMethodName = readMethod == null ? null : readMethod.getName();
String writeMethodName = writeMethod == null ? null : writeMethod.getName();
addProperty(writer, name, propertyDescriptor.getPropertyType(), readMethodName, writeMethodName);
if (readMethod != null)
{
methodSet.add(readMethod);
}
if (writeMethod != null)
{
methodSet.add(writeMethod);
}
}
else
{
processAmbiguousProperty(writer, methodSet, aClass, propertyDescriptor);
}
}
}
|
[
"private",
"void",
"processProperties",
"(",
"XMLStreamWriter",
"writer",
",",
"Set",
"<",
"Method",
">",
"methodSet",
",",
"Class",
"<",
"?",
">",
"aClass",
")",
"throws",
"IntrospectionException",
",",
"XMLStreamException",
"{",
"BeanInfo",
"beanInfo",
"=",
"Introspector",
".",
"getBeanInfo",
"(",
"aClass",
",",
"aClass",
".",
"getSuperclass",
"(",
")",
")",
";",
"PropertyDescriptor",
"[",
"]",
"propertyDescriptors",
"=",
"beanInfo",
".",
"getPropertyDescriptors",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"propertyDescriptors",
".",
"length",
";",
"i",
"++",
")",
"{",
"PropertyDescriptor",
"propertyDescriptor",
"=",
"propertyDescriptors",
"[",
"i",
"]",
";",
"if",
"(",
"propertyDescriptor",
".",
"getPropertyType",
"(",
")",
"!=",
"null",
")",
"{",
"String",
"name",
"=",
"propertyDescriptor",
".",
"getName",
"(",
")",
";",
"Method",
"readMethod",
"=",
"propertyDescriptor",
".",
"getReadMethod",
"(",
")",
";",
"Method",
"writeMethod",
"=",
"propertyDescriptor",
".",
"getWriteMethod",
"(",
")",
";",
"String",
"readMethodName",
"=",
"readMethod",
"==",
"null",
"?",
"null",
":",
"readMethod",
".",
"getName",
"(",
")",
";",
"String",
"writeMethodName",
"=",
"writeMethod",
"==",
"null",
"?",
"null",
":",
"writeMethod",
".",
"getName",
"(",
")",
";",
"addProperty",
"(",
"writer",
",",
"name",
",",
"propertyDescriptor",
".",
"getPropertyType",
"(",
")",
",",
"readMethodName",
",",
"writeMethodName",
")",
";",
"if",
"(",
"readMethod",
"!=",
"null",
")",
"{",
"methodSet",
".",
"add",
"(",
"readMethod",
")",
";",
"}",
"if",
"(",
"writeMethod",
"!=",
"null",
")",
"{",
"methodSet",
".",
"add",
"(",
"writeMethod",
")",
";",
"}",
"}",
"else",
"{",
"processAmbiguousProperty",
"(",
"writer",
",",
"methodSet",
",",
"aClass",
",",
"propertyDescriptor",
")",
";",
"}",
"}",
"}"
] |
Process class properties.
@param writer output stream
@param methodSet set of methods processed
@param aClass class being processed
@throws IntrospectionException
@throws XMLStreamException
|
[
"Process",
"class",
"properties",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L205-L238
|
157,302
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
|
MapFileGenerator.addProperty
|
private void addProperty(XMLStreamWriter writer, String name, Class<?> propertyType, String readMethod, String writeMethod) throws XMLStreamException
{
if (name.length() != 0)
{
writer.writeStartElement("property");
// convert property name to .NET style (i.e. first letter uppercase)
String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1);
writer.writeAttribute("name", propertyName);
String type = getTypeString(propertyType);
writer.writeAttribute("sig", "()" + type);
if (readMethod != null)
{
writer.writeStartElement("getter");
writer.writeAttribute("name", readMethod);
writer.writeAttribute("sig", "()" + type);
writer.writeEndElement();
}
if (writeMethod != null)
{
writer.writeStartElement("setter");
writer.writeAttribute("name", writeMethod);
writer.writeAttribute("sig", "(" + type + ")V");
writer.writeEndElement();
}
writer.writeEndElement();
}
}
|
java
|
private void addProperty(XMLStreamWriter writer, String name, Class<?> propertyType, String readMethod, String writeMethod) throws XMLStreamException
{
if (name.length() != 0)
{
writer.writeStartElement("property");
// convert property name to .NET style (i.e. first letter uppercase)
String propertyName = name.substring(0, 1).toUpperCase() + name.substring(1);
writer.writeAttribute("name", propertyName);
String type = getTypeString(propertyType);
writer.writeAttribute("sig", "()" + type);
if (readMethod != null)
{
writer.writeStartElement("getter");
writer.writeAttribute("name", readMethod);
writer.writeAttribute("sig", "()" + type);
writer.writeEndElement();
}
if (writeMethod != null)
{
writer.writeStartElement("setter");
writer.writeAttribute("name", writeMethod);
writer.writeAttribute("sig", "(" + type + ")V");
writer.writeEndElement();
}
writer.writeEndElement();
}
}
|
[
"private",
"void",
"addProperty",
"(",
"XMLStreamWriter",
"writer",
",",
"String",
"name",
",",
"Class",
"<",
"?",
">",
"propertyType",
",",
"String",
"readMethod",
",",
"String",
"writeMethod",
")",
"throws",
"XMLStreamException",
"{",
"if",
"(",
"name",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"writer",
".",
"writeStartElement",
"(",
"\"property\"",
")",
";",
"// convert property name to .NET style (i.e. first letter uppercase)",
"String",
"propertyName",
"=",
"name",
".",
"substring",
"(",
"0",
",",
"1",
")",
".",
"toUpperCase",
"(",
")",
"+",
"name",
".",
"substring",
"(",
"1",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"propertyName",
")",
";",
"String",
"type",
"=",
"getTypeString",
"(",
"propertyType",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"sig\"",
",",
"\"()\"",
"+",
"type",
")",
";",
"if",
"(",
"readMethod",
"!=",
"null",
")",
"{",
"writer",
".",
"writeStartElement",
"(",
"\"getter\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"readMethod",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"sig\"",
",",
"\"()\"",
"+",
"type",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}",
"if",
"(",
"writeMethod",
"!=",
"null",
")",
"{",
"writer",
".",
"writeStartElement",
"(",
"\"setter\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"writeMethod",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"sig\"",
",",
"\"(\"",
"+",
"type",
"+",
"\")V\"",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}",
"}"
] |
Add a simple property to the map file.
@param writer xml stream writer
@param name property name
@param propertyType property type
@param readMethod read method name
@param writeMethod write method name
@throws XMLStreamException
|
[
"Add",
"a",
"simple",
"property",
"to",
"the",
"map",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L250-L280
|
157,303
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
|
MapFileGenerator.getTypeString
|
private String getTypeString(Class<?> c)
{
String result = TYPE_MAP.get(c);
if (result == null)
{
result = c.getName();
if (!result.endsWith(";") && !result.startsWith("["))
{
result = "L" + result + ";";
}
}
return result;
}
|
java
|
private String getTypeString(Class<?> c)
{
String result = TYPE_MAP.get(c);
if (result == null)
{
result = c.getName();
if (!result.endsWith(";") && !result.startsWith("["))
{
result = "L" + result + ";";
}
}
return result;
}
|
[
"private",
"String",
"getTypeString",
"(",
"Class",
"<",
"?",
">",
"c",
")",
"{",
"String",
"result",
"=",
"TYPE_MAP",
".",
"get",
"(",
"c",
")",
";",
"if",
"(",
"result",
"==",
"null",
")",
"{",
"result",
"=",
"c",
".",
"getName",
"(",
")",
";",
"if",
"(",
"!",
"result",
".",
"endsWith",
"(",
"\";\"",
")",
"&&",
"!",
"result",
".",
"startsWith",
"(",
"\"[\"",
")",
")",
"{",
"result",
"=",
"\"L\"",
"+",
"result",
"+",
"\";\"",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Converts a class into a signature token.
@param c class
@return signature token text
|
[
"Converts",
"a",
"class",
"into",
"a",
"signature",
"token",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L288-L300
|
157,304
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
|
MapFileGenerator.processClassMethods
|
private void processClassMethods(XMLStreamWriter writer, Class<?> aClass, Set<Method> methodSet) throws XMLStreamException
{
Method[] methods = aClass.getDeclaredMethods();
for (Method method : methods)
{
if (!methodSet.contains(method) && Modifier.isPublic(method.getModifiers()) && !Modifier.isInterface(method.getModifiers()))
{
if (Modifier.isStatic(method.getModifiers()))
{
// TODO Handle static methods here
}
else
{
String name = method.getName();
String methodSignature = createMethodSignature(method);
String fullJavaName = aClass.getCanonicalName() + "." + name + methodSignature;
if (!ignoreMethod(fullJavaName))
{
//
// Hide the original method
//
writer.writeStartElement("method");
writer.writeAttribute("name", name);
writer.writeAttribute("sig", methodSignature);
writer.writeStartElement("attribute");
writer.writeAttribute("type", "System.ComponentModel.EditorBrowsableAttribute");
writer.writeAttribute("sig", "(Lcli.System.ComponentModel.EditorBrowsableState;)V");
writer.writeStartElement("parameter");
writer.writeCharacters("Never");
writer.writeEndElement();
writer.writeEndElement();
writer.writeEndElement();
//
// Create a wrapper method
//
name = name.toUpperCase().charAt(0) + name.substring(1);
writer.writeStartElement("method");
writer.writeAttribute("name", name);
writer.writeAttribute("sig", methodSignature);
writer.writeAttribute("modifiers", "public");
writer.writeStartElement("body");
for (int index = 0; index <= method.getParameterTypes().length; index++)
{
if (index < 4)
{
writer.writeEmptyElement("ldarg_" + index);
}
else
{
writer.writeStartElement("ldarg_s");
writer.writeAttribute("argNum", Integer.toString(index));
writer.writeEndElement();
}
}
writer.writeStartElement("callvirt");
writer.writeAttribute("class", aClass.getName());
writer.writeAttribute("name", method.getName());
writer.writeAttribute("sig", methodSignature);
writer.writeEndElement();
if (!method.getReturnType().getName().equals("void"))
{
writer.writeEmptyElement("ldnull");
writer.writeEmptyElement("pop");
}
writer.writeEmptyElement("ret");
writer.writeEndElement();
writer.writeEndElement();
/*
* The private method approach doesn't work... so
* 3. Add EditorBrowsableAttribute (Never) to original methods
* 4. Generate C Sharp and VB variants of the DLL to avid case-sensitivity issues
* 5. Implement static method support?
<attribute type="System.ComponentModel.EditorBrowsableAttribute" sig="(Lcli.System.ComponentModel.EditorBrowsableState;)V">
914 <parameter>Never</parameter>
915 </attribute>
*/
m_responseList.add(fullJavaName);
}
}
}
}
}
|
java
|
private void processClassMethods(XMLStreamWriter writer, Class<?> aClass, Set<Method> methodSet) throws XMLStreamException
{
Method[] methods = aClass.getDeclaredMethods();
for (Method method : methods)
{
if (!methodSet.contains(method) && Modifier.isPublic(method.getModifiers()) && !Modifier.isInterface(method.getModifiers()))
{
if (Modifier.isStatic(method.getModifiers()))
{
// TODO Handle static methods here
}
else
{
String name = method.getName();
String methodSignature = createMethodSignature(method);
String fullJavaName = aClass.getCanonicalName() + "." + name + methodSignature;
if (!ignoreMethod(fullJavaName))
{
//
// Hide the original method
//
writer.writeStartElement("method");
writer.writeAttribute("name", name);
writer.writeAttribute("sig", methodSignature);
writer.writeStartElement("attribute");
writer.writeAttribute("type", "System.ComponentModel.EditorBrowsableAttribute");
writer.writeAttribute("sig", "(Lcli.System.ComponentModel.EditorBrowsableState;)V");
writer.writeStartElement("parameter");
writer.writeCharacters("Never");
writer.writeEndElement();
writer.writeEndElement();
writer.writeEndElement();
//
// Create a wrapper method
//
name = name.toUpperCase().charAt(0) + name.substring(1);
writer.writeStartElement("method");
writer.writeAttribute("name", name);
writer.writeAttribute("sig", methodSignature);
writer.writeAttribute("modifiers", "public");
writer.writeStartElement("body");
for (int index = 0; index <= method.getParameterTypes().length; index++)
{
if (index < 4)
{
writer.writeEmptyElement("ldarg_" + index);
}
else
{
writer.writeStartElement("ldarg_s");
writer.writeAttribute("argNum", Integer.toString(index));
writer.writeEndElement();
}
}
writer.writeStartElement("callvirt");
writer.writeAttribute("class", aClass.getName());
writer.writeAttribute("name", method.getName());
writer.writeAttribute("sig", methodSignature);
writer.writeEndElement();
if (!method.getReturnType().getName().equals("void"))
{
writer.writeEmptyElement("ldnull");
writer.writeEmptyElement("pop");
}
writer.writeEmptyElement("ret");
writer.writeEndElement();
writer.writeEndElement();
/*
* The private method approach doesn't work... so
* 3. Add EditorBrowsableAttribute (Never) to original methods
* 4. Generate C Sharp and VB variants of the DLL to avid case-sensitivity issues
* 5. Implement static method support?
<attribute type="System.ComponentModel.EditorBrowsableAttribute" sig="(Lcli.System.ComponentModel.EditorBrowsableState;)V">
914 <parameter>Never</parameter>
915 </attribute>
*/
m_responseList.add(fullJavaName);
}
}
}
}
}
|
[
"private",
"void",
"processClassMethods",
"(",
"XMLStreamWriter",
"writer",
",",
"Class",
"<",
"?",
">",
"aClass",
",",
"Set",
"<",
"Method",
">",
"methodSet",
")",
"throws",
"XMLStreamException",
"{",
"Method",
"[",
"]",
"methods",
"=",
"aClass",
".",
"getDeclaredMethods",
"(",
")",
";",
"for",
"(",
"Method",
"method",
":",
"methods",
")",
"{",
"if",
"(",
"!",
"methodSet",
".",
"contains",
"(",
"method",
")",
"&&",
"Modifier",
".",
"isPublic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
"&&",
"!",
"Modifier",
".",
"isInterface",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"if",
"(",
"Modifier",
".",
"isStatic",
"(",
"method",
".",
"getModifiers",
"(",
")",
")",
")",
"{",
"// TODO Handle static methods here",
"}",
"else",
"{",
"String",
"name",
"=",
"method",
".",
"getName",
"(",
")",
";",
"String",
"methodSignature",
"=",
"createMethodSignature",
"(",
"method",
")",
";",
"String",
"fullJavaName",
"=",
"aClass",
".",
"getCanonicalName",
"(",
")",
"+",
"\".\"",
"+",
"name",
"+",
"methodSignature",
";",
"if",
"(",
"!",
"ignoreMethod",
"(",
"fullJavaName",
")",
")",
"{",
"//",
"// Hide the original method",
"//",
"writer",
".",
"writeStartElement",
"(",
"\"method\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"name",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"sig\"",
",",
"methodSignature",
")",
";",
"writer",
".",
"writeStartElement",
"(",
"\"attribute\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"type\"",
",",
"\"System.ComponentModel.EditorBrowsableAttribute\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"sig\"",
",",
"\"(Lcli.System.ComponentModel.EditorBrowsableState;)V\"",
")",
";",
"writer",
".",
"writeStartElement",
"(",
"\"parameter\"",
")",
";",
"writer",
".",
"writeCharacters",
"(",
"\"Never\"",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"//",
"// Create a wrapper method",
"//",
"name",
"=",
"name",
".",
"toUpperCase",
"(",
")",
".",
"charAt",
"(",
"0",
")",
"+",
"name",
".",
"substring",
"(",
"1",
")",
";",
"writer",
".",
"writeStartElement",
"(",
"\"method\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"name",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"sig\"",
",",
"methodSignature",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"modifiers\"",
",",
"\"public\"",
")",
";",
"writer",
".",
"writeStartElement",
"(",
"\"body\"",
")",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<=",
"method",
".",
"getParameterTypes",
"(",
")",
".",
"length",
";",
"index",
"++",
")",
"{",
"if",
"(",
"index",
"<",
"4",
")",
"{",
"writer",
".",
"writeEmptyElement",
"(",
"\"ldarg_\"",
"+",
"index",
")",
";",
"}",
"else",
"{",
"writer",
".",
"writeStartElement",
"(",
"\"ldarg_s\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"argNum\"",
",",
"Integer",
".",
"toString",
"(",
"index",
")",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"}",
"}",
"writer",
".",
"writeStartElement",
"(",
"\"callvirt\"",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"class\"",
",",
"aClass",
".",
"getName",
"(",
")",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"name\"",
",",
"method",
".",
"getName",
"(",
")",
")",
";",
"writer",
".",
"writeAttribute",
"(",
"\"sig\"",
",",
"methodSignature",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"if",
"(",
"!",
"method",
".",
"getReturnType",
"(",
")",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"void\"",
")",
")",
"{",
"writer",
".",
"writeEmptyElement",
"(",
"\"ldnull\"",
")",
";",
"writer",
".",
"writeEmptyElement",
"(",
"\"pop\"",
")",
";",
"}",
"writer",
".",
"writeEmptyElement",
"(",
"\"ret\"",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"writer",
".",
"writeEndElement",
"(",
")",
";",
"/*\n * The private method approach doesn't work... so\n * 3. Add EditorBrowsableAttribute (Never) to original methods\n * 4. Generate C Sharp and VB variants of the DLL to avid case-sensitivity issues\n * 5. Implement static method support?\n <attribute type=\"System.ComponentModel.EditorBrowsableAttribute\" sig=\"(Lcli.System.ComponentModel.EditorBrowsableState;)V\">\n 914 <parameter>Never</parameter>\n 915 </attribute>\n */",
"m_responseList",
".",
"add",
"(",
"fullJavaName",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
Hides the original Java-style method name using an attribute
which should be respected by Visual Studio, the creates a new
wrapper method using a .Net style method name.
Note that this does not work for VB as it is case insensitive. Even
though Visual Studio won't show you the Java-style method name,
the VB compiler sees both and thinks they are the same... which
causes it to fail.
@param writer output stream
@param aClass class being processed
@param methodSet set of methods which have been processed.
@throws XMLStreamException
|
[
"Hides",
"the",
"original",
"Java",
"-",
"style",
"method",
"name",
"using",
"an",
"attribute",
"which",
"should",
"be",
"respected",
"by",
"Visual",
"Studio",
"the",
"creates",
"a",
"new",
"wrapper",
"method",
"using",
"a",
".",
"Net",
"style",
"method",
"name",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L367-L458
|
157,305
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
|
MapFileGenerator.ignoreMethod
|
private boolean ignoreMethod(String name)
{
boolean result = false;
for (String ignoredName : IGNORED_METHODS)
{
if (name.matches(ignoredName))
{
result = true;
break;
}
}
return result;
}
|
java
|
private boolean ignoreMethod(String name)
{
boolean result = false;
for (String ignoredName : IGNORED_METHODS)
{
if (name.matches(ignoredName))
{
result = true;
break;
}
}
return result;
}
|
[
"private",
"boolean",
"ignoreMethod",
"(",
"String",
"name",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"for",
"(",
"String",
"ignoredName",
":",
"IGNORED_METHODS",
")",
"{",
"if",
"(",
"name",
".",
"matches",
"(",
"ignoredName",
")",
")",
"{",
"result",
"=",
"true",
";",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Used to determine if the current method should be ignored.
@param name method name
@return true if the method should be ignored
|
[
"Used",
"to",
"determine",
"if",
"the",
"current",
"method",
"should",
"be",
"ignored",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L466-L480
|
157,306
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java
|
MapFileGenerator.createMethodSignature
|
private String createMethodSignature(Method method)
{
StringBuilder sb = new StringBuilder();
sb.append("(");
for (Class<?> type : method.getParameterTypes())
{
sb.append(getTypeString(type));
}
sb.append(")");
Class<?> type = method.getReturnType();
if (type.getName().equals("void"))
{
sb.append("V");
}
else
{
sb.append(getTypeString(type));
}
return sb.toString();
}
|
java
|
private String createMethodSignature(Method method)
{
StringBuilder sb = new StringBuilder();
sb.append("(");
for (Class<?> type : method.getParameterTypes())
{
sb.append(getTypeString(type));
}
sb.append(")");
Class<?> type = method.getReturnType();
if (type.getName().equals("void"))
{
sb.append("V");
}
else
{
sb.append(getTypeString(type));
}
return sb.toString();
}
|
[
"private",
"String",
"createMethodSignature",
"(",
"Method",
"method",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"\"(\"",
")",
";",
"for",
"(",
"Class",
"<",
"?",
">",
"type",
":",
"method",
".",
"getParameterTypes",
"(",
")",
")",
"{",
"sb",
".",
"append",
"(",
"getTypeString",
"(",
"type",
")",
")",
";",
"}",
"sb",
".",
"append",
"(",
"\")\"",
")",
";",
"Class",
"<",
"?",
">",
"type",
"=",
"method",
".",
"getReturnType",
"(",
")",
";",
"if",
"(",
"type",
".",
"getName",
"(",
")",
".",
"equals",
"(",
"\"void\"",
")",
")",
"{",
"sb",
".",
"append",
"(",
"\"V\"",
")",
";",
"}",
"else",
"{",
"sb",
".",
"append",
"(",
"getTypeString",
"(",
"type",
")",
")",
";",
"}",
"return",
"sb",
".",
"toString",
"(",
")",
";",
"}"
] |
Creates a method signature.
@param method Method instance
@return method signature
|
[
"Creates",
"a",
"method",
"signature",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ikvm/MapFileGenerator.java#L488-L507
|
157,307
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/ProjectCalendarException.java
|
ProjectCalendarException.contains
|
public boolean contains(Date date)
{
boolean result = false;
if (date != null)
{
result = (DateHelper.compare(getFromDate(), getToDate(), date) == 0);
}
return (result);
}
|
java
|
public boolean contains(Date date)
{
boolean result = false;
if (date != null)
{
result = (DateHelper.compare(getFromDate(), getToDate(), date) == 0);
}
return (result);
}
|
[
"public",
"boolean",
"contains",
"(",
"Date",
"date",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"if",
"(",
"date",
"!=",
"null",
")",
"{",
"result",
"=",
"(",
"DateHelper",
".",
"compare",
"(",
"getFromDate",
"(",
")",
",",
"getToDate",
"(",
")",
",",
"date",
")",
"==",
"0",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
This method determines whether the given date falls in the range of
dates covered by this exception. Note that this method assumes that both
the start and end date of this exception have been set.
@param date Date to be tested
@return Boolean value
|
[
"This",
"method",
"determines",
"whether",
"the",
"given",
"date",
"falls",
"in",
"the",
"range",
"of",
"dates",
"covered",
"by",
"this",
"exception",
".",
"Note",
"that",
"this",
"method",
"assumes",
"that",
"both",
"the",
"start",
"and",
"end",
"date",
"of",
"this",
"exception",
"have",
"been",
"set",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/ProjectCalendarException.java#L129-L139
|
157,308
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/explorer/JTableExtra.java
|
JTableExtra.setModel
|
@Override public void setModel(TableModel model)
{
super.setModel(model);
int columns = model.getColumnCount();
TableColumnModel tableColumnModel = getColumnModel();
for (int index = 0; index < columns; index++)
{
tableColumnModel.getColumn(index).setPreferredWidth(m_columnWidth);
}
}
|
java
|
@Override public void setModel(TableModel model)
{
super.setModel(model);
int columns = model.getColumnCount();
TableColumnModel tableColumnModel = getColumnModel();
for (int index = 0; index < columns; index++)
{
tableColumnModel.getColumn(index).setPreferredWidth(m_columnWidth);
}
}
|
[
"@",
"Override",
"public",
"void",
"setModel",
"(",
"TableModel",
"model",
")",
"{",
"super",
".",
"setModel",
"(",
"model",
")",
";",
"int",
"columns",
"=",
"model",
".",
"getColumnCount",
"(",
")",
";",
"TableColumnModel",
"tableColumnModel",
"=",
"getColumnModel",
"(",
")",
";",
"for",
"(",
"int",
"index",
"=",
"0",
";",
"index",
"<",
"columns",
";",
"index",
"++",
")",
"{",
"tableColumnModel",
".",
"getColumn",
"(",
"index",
")",
".",
"setPreferredWidth",
"(",
"m_columnWidth",
")",
";",
"}",
"}"
] |
Updates the model. Ensures that we reset the columns widths.
@param model table model
|
[
"Updates",
"the",
"model",
".",
"Ensures",
"that",
"we",
"reset",
"the",
"columns",
"widths",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/explorer/JTableExtra.java#L139-L148
|
157,309
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
|
MPP14Reader.process
|
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
{
try
{
populateMemberData(reader, file, root);
processProjectProperties();
if (!reader.getReadPropertiesOnly())
{
processSubProjectData();
processGraphicalIndicators();
processCustomValueLists();
processCalendarData();
processResourceData();
processTaskData();
processConstraintData();
processAssignmentData();
postProcessTasks();
if (reader.getReadPresentationData())
{
processViewPropertyData();
processTableData();
processViewData();
processFilterData();
processGroupData();
processSavedViewState();
}
}
}
finally
{
clearMemberData();
}
}
|
java
|
@Override public void process(MPPReader reader, ProjectFile file, DirectoryEntry root) throws MPXJException, IOException
{
try
{
populateMemberData(reader, file, root);
processProjectProperties();
if (!reader.getReadPropertiesOnly())
{
processSubProjectData();
processGraphicalIndicators();
processCustomValueLists();
processCalendarData();
processResourceData();
processTaskData();
processConstraintData();
processAssignmentData();
postProcessTasks();
if (reader.getReadPresentationData())
{
processViewPropertyData();
processTableData();
processViewData();
processFilterData();
processGroupData();
processSavedViewState();
}
}
}
finally
{
clearMemberData();
}
}
|
[
"@",
"Override",
"public",
"void",
"process",
"(",
"MPPReader",
"reader",
",",
"ProjectFile",
"file",
",",
"DirectoryEntry",
"root",
")",
"throws",
"MPXJException",
",",
"IOException",
"{",
"try",
"{",
"populateMemberData",
"(",
"reader",
",",
"file",
",",
"root",
")",
";",
"processProjectProperties",
"(",
")",
";",
"if",
"(",
"!",
"reader",
".",
"getReadPropertiesOnly",
"(",
")",
")",
"{",
"processSubProjectData",
"(",
")",
";",
"processGraphicalIndicators",
"(",
")",
";",
"processCustomValueLists",
"(",
")",
";",
"processCalendarData",
"(",
")",
";",
"processResourceData",
"(",
")",
";",
"processTaskData",
"(",
")",
";",
"processConstraintData",
"(",
")",
";",
"processAssignmentData",
"(",
")",
";",
"postProcessTasks",
"(",
")",
";",
"if",
"(",
"reader",
".",
"getReadPresentationData",
"(",
")",
")",
"{",
"processViewPropertyData",
"(",
")",
";",
"processTableData",
"(",
")",
";",
"processViewData",
"(",
")",
";",
"processFilterData",
"(",
")",
";",
"processGroupData",
"(",
")",
";",
"processSavedViewState",
"(",
")",
";",
"}",
"}",
"}",
"finally",
"{",
"clearMemberData",
"(",
")",
";",
"}",
"}"
] |
This method is used to process an MPP14 file. This is the file format
used by Project 14.
@param reader parent file reader
@param file parent MPP file
@param root Root of the POI file system.
|
[
"This",
"method",
"is",
"used",
"to",
"process",
"an",
"MPP14",
"file",
".",
"This",
"is",
"the",
"file",
"format",
"used",
"by",
"Project",
"14",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L80-L115
|
157,310
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
|
MPP14Reader.processGraphicalIndicators
|
private void processGraphicalIndicators()
{
GraphicalIndicatorReader graphicalIndicatorReader = new GraphicalIndicatorReader();
graphicalIndicatorReader.process(m_file.getCustomFields(), m_file.getProjectProperties(), m_projectProps);
}
|
java
|
private void processGraphicalIndicators()
{
GraphicalIndicatorReader graphicalIndicatorReader = new GraphicalIndicatorReader();
graphicalIndicatorReader.process(m_file.getCustomFields(), m_file.getProjectProperties(), m_projectProps);
}
|
[
"private",
"void",
"processGraphicalIndicators",
"(",
")",
"{",
"GraphicalIndicatorReader",
"graphicalIndicatorReader",
"=",
"new",
"GraphicalIndicatorReader",
"(",
")",
";",
"graphicalIndicatorReader",
".",
"process",
"(",
"m_file",
".",
"getCustomFields",
"(",
")",
",",
"m_file",
".",
"getProjectProperties",
"(",
")",
",",
"m_projectProps",
")",
";",
"}"
] |
Process the graphical indicator data.
|
[
"Process",
"the",
"graphical",
"indicator",
"data",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L230-L234
|
157,311
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
|
MPP14Reader.readSubProjects
|
private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex)
{
while (uniqueIDOffset < filePathOffset)
{
readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++);
uniqueIDOffset += 4;
}
}
|
java
|
private void readSubProjects(byte[] data, int uniqueIDOffset, int filePathOffset, int fileNameOffset, int subprojectIndex)
{
while (uniqueIDOffset < filePathOffset)
{
readSubProject(data, uniqueIDOffset, filePathOffset, fileNameOffset, subprojectIndex++);
uniqueIDOffset += 4;
}
}
|
[
"private",
"void",
"readSubProjects",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"uniqueIDOffset",
",",
"int",
"filePathOffset",
",",
"int",
"fileNameOffset",
",",
"int",
"subprojectIndex",
")",
"{",
"while",
"(",
"uniqueIDOffset",
"<",
"filePathOffset",
")",
"{",
"readSubProject",
"(",
"data",
",",
"uniqueIDOffset",
",",
"filePathOffset",
",",
"fileNameOffset",
",",
"subprojectIndex",
"++",
")",
";",
"uniqueIDOffset",
"+=",
"4",
";",
"}",
"}"
] |
Read a list of sub projects.
@param data byte array
@param uniqueIDOffset offset of unique ID
@param filePathOffset offset of file path
@param fileNameOffset offset of file name
@param subprojectIndex index of the subproject, used to calculate unique id offset
|
[
"Read",
"a",
"list",
"of",
"sub",
"projects",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L559-L566
|
157,312
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
|
MPP14Reader.processBaseFonts
|
private void processBaseFonts(byte[] data)
{
int offset = 0;
int blockCount = MPPUtility.getShort(data, 0);
offset += 2;
int size;
String name;
for (int loop = 0; loop < blockCount; loop++)
{
/*unknownAttribute = MPPUtility.getShort(data, offset);*/
offset += 2;
size = MPPUtility.getShort(data, offset);
offset += 2;
name = MPPUtility.getUnicodeString(data, offset);
offset += 64;
if (name.length() != 0)
{
FontBase fontBase = new FontBase(Integer.valueOf(loop), name, size);
m_fontBases.put(fontBase.getIndex(), fontBase);
}
}
}
|
java
|
private void processBaseFonts(byte[] data)
{
int offset = 0;
int blockCount = MPPUtility.getShort(data, 0);
offset += 2;
int size;
String name;
for (int loop = 0; loop < blockCount; loop++)
{
/*unknownAttribute = MPPUtility.getShort(data, offset);*/
offset += 2;
size = MPPUtility.getShort(data, offset);
offset += 2;
name = MPPUtility.getUnicodeString(data, offset);
offset += 64;
if (name.length() != 0)
{
FontBase fontBase = new FontBase(Integer.valueOf(loop), name, size);
m_fontBases.put(fontBase.getIndex(), fontBase);
}
}
}
|
[
"private",
"void",
"processBaseFonts",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"int",
"offset",
"=",
"0",
";",
"int",
"blockCount",
"=",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"0",
")",
";",
"offset",
"+=",
"2",
";",
"int",
"size",
";",
"String",
"name",
";",
"for",
"(",
"int",
"loop",
"=",
"0",
";",
"loop",
"<",
"blockCount",
";",
"loop",
"++",
")",
"{",
"/*unknownAttribute = MPPUtility.getShort(data, offset);*/",
"offset",
"+=",
"2",
";",
"size",
"=",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"offset",
")",
";",
"offset",
"+=",
"2",
";",
"name",
"=",
"MPPUtility",
".",
"getUnicodeString",
"(",
"data",
",",
"offset",
")",
";",
"offset",
"+=",
"64",
";",
"if",
"(",
"name",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"FontBase",
"fontBase",
"=",
"new",
"FontBase",
"(",
"Integer",
".",
"valueOf",
"(",
"loop",
")",
",",
"name",
",",
"size",
")",
";",
"m_fontBases",
".",
"put",
"(",
"fontBase",
".",
"getIndex",
"(",
")",
",",
"fontBase",
")",
";",
"}",
"}",
"}"
] |
Create an index of base font numbers and their associated base
font instances.
@param data property data
|
[
"Create",
"an",
"index",
"of",
"base",
"font",
"numbers",
"and",
"their",
"associated",
"base",
"font",
"instances",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L773-L800
|
157,313
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
|
MPP14Reader.createTaskMap
|
private TreeMap<Integer, Integer> createTaskMap(FieldMap fieldMap, FixedMeta taskFixedMeta, FixedData taskFixedData, Var2Data taskVarData)
{
TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>();
int uniqueIdOffset = fieldMap.getFixedDataOffset(TaskField.UNIQUE_ID);
Integer taskNameKey = fieldMap.getVarDataKey(TaskField.NAME);
int itemCount = taskFixedMeta.getAdjustedItemCount();
int uniqueID;
Integer key;
//
// First three items are not tasks, so let's skip them
//
for (int loop = 3; loop < itemCount; loop++)
{
byte[] data = taskFixedData.getByteArrayValue(loop);
if (data != null)
{
byte[] metaData = taskFixedMeta.getByteArrayValue(loop);
//
// Check for the deleted task flag
//
int flags = MPPUtility.getInt(metaData, 0);
if ((flags & 0x02) != 0)
{
// Project stores the deleted tasks unique id's into the fixed data as well
// and at least in one case the deleted task was listed twice in the list
// the second time with data with it causing a phantom task to be shown.
// See CalendarErrorPhantomTasks.mpp
//
// So let's add the unique id for the deleted task into the map so we don't
// accidentally include the task later.
//
uniqueID = MPPUtility.getShort(data, TASK_UNIQUE_ID_FIXED_OFFSET); // Only a short stored for deleted tasks?
key = Integer.valueOf(uniqueID);
if (taskMap.containsKey(key) == false)
{
taskMap.put(key, null); // use null so we can easily ignore this later
}
}
else
{
//
// Do we have a null task?
//
if (data.length == NULL_TASK_BLOCK_SIZE)
{
uniqueID = MPPUtility.getInt(data, TASK_UNIQUE_ID_FIXED_OFFSET);
key = Integer.valueOf(uniqueID);
if (taskMap.containsKey(key) == false)
{
taskMap.put(key, Integer.valueOf(loop));
}
}
else
{
//
// We apply a heuristic here - if we have more than 75% of the data, we assume
// the task is valid.
//
int maxSize = fieldMap.getMaxFixedDataSize(0);
if (maxSize == 0 || ((data.length * 100) / maxSize) > 75)
{
uniqueID = MPPUtility.getInt(data, uniqueIdOffset);
key = Integer.valueOf(uniqueID);
// Accept this task if it does not have a deleted unique ID or it has a deleted unique ID but the name is not null
if (!taskMap.containsKey(key) || taskVarData.getUnicodeString(key, taskNameKey) != null)
{
taskMap.put(key, Integer.valueOf(loop));
}
}
}
}
}
}
return (taskMap);
}
|
java
|
private TreeMap<Integer, Integer> createTaskMap(FieldMap fieldMap, FixedMeta taskFixedMeta, FixedData taskFixedData, Var2Data taskVarData)
{
TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>();
int uniqueIdOffset = fieldMap.getFixedDataOffset(TaskField.UNIQUE_ID);
Integer taskNameKey = fieldMap.getVarDataKey(TaskField.NAME);
int itemCount = taskFixedMeta.getAdjustedItemCount();
int uniqueID;
Integer key;
//
// First three items are not tasks, so let's skip them
//
for (int loop = 3; loop < itemCount; loop++)
{
byte[] data = taskFixedData.getByteArrayValue(loop);
if (data != null)
{
byte[] metaData = taskFixedMeta.getByteArrayValue(loop);
//
// Check for the deleted task flag
//
int flags = MPPUtility.getInt(metaData, 0);
if ((flags & 0x02) != 0)
{
// Project stores the deleted tasks unique id's into the fixed data as well
// and at least in one case the deleted task was listed twice in the list
// the second time with data with it causing a phantom task to be shown.
// See CalendarErrorPhantomTasks.mpp
//
// So let's add the unique id for the deleted task into the map so we don't
// accidentally include the task later.
//
uniqueID = MPPUtility.getShort(data, TASK_UNIQUE_ID_FIXED_OFFSET); // Only a short stored for deleted tasks?
key = Integer.valueOf(uniqueID);
if (taskMap.containsKey(key) == false)
{
taskMap.put(key, null); // use null so we can easily ignore this later
}
}
else
{
//
// Do we have a null task?
//
if (data.length == NULL_TASK_BLOCK_SIZE)
{
uniqueID = MPPUtility.getInt(data, TASK_UNIQUE_ID_FIXED_OFFSET);
key = Integer.valueOf(uniqueID);
if (taskMap.containsKey(key) == false)
{
taskMap.put(key, Integer.valueOf(loop));
}
}
else
{
//
// We apply a heuristic here - if we have more than 75% of the data, we assume
// the task is valid.
//
int maxSize = fieldMap.getMaxFixedDataSize(0);
if (maxSize == 0 || ((data.length * 100) / maxSize) > 75)
{
uniqueID = MPPUtility.getInt(data, uniqueIdOffset);
key = Integer.valueOf(uniqueID);
// Accept this task if it does not have a deleted unique ID or it has a deleted unique ID but the name is not null
if (!taskMap.containsKey(key) || taskVarData.getUnicodeString(key, taskNameKey) != null)
{
taskMap.put(key, Integer.valueOf(loop));
}
}
}
}
}
}
return (taskMap);
}
|
[
"private",
"TreeMap",
"<",
"Integer",
",",
"Integer",
">",
"createTaskMap",
"(",
"FieldMap",
"fieldMap",
",",
"FixedMeta",
"taskFixedMeta",
",",
"FixedData",
"taskFixedData",
",",
"Var2Data",
"taskVarData",
")",
"{",
"TreeMap",
"<",
"Integer",
",",
"Integer",
">",
"taskMap",
"=",
"new",
"TreeMap",
"<",
"Integer",
",",
"Integer",
">",
"(",
")",
";",
"int",
"uniqueIdOffset",
"=",
"fieldMap",
".",
"getFixedDataOffset",
"(",
"TaskField",
".",
"UNIQUE_ID",
")",
";",
"Integer",
"taskNameKey",
"=",
"fieldMap",
".",
"getVarDataKey",
"(",
"TaskField",
".",
"NAME",
")",
";",
"int",
"itemCount",
"=",
"taskFixedMeta",
".",
"getAdjustedItemCount",
"(",
")",
";",
"int",
"uniqueID",
";",
"Integer",
"key",
";",
"//",
"// First three items are not tasks, so let's skip them",
"//",
"for",
"(",
"int",
"loop",
"=",
"3",
";",
"loop",
"<",
"itemCount",
";",
"loop",
"++",
")",
"{",
"byte",
"[",
"]",
"data",
"=",
"taskFixedData",
".",
"getByteArrayValue",
"(",
"loop",
")",
";",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"byte",
"[",
"]",
"metaData",
"=",
"taskFixedMeta",
".",
"getByteArrayValue",
"(",
"loop",
")",
";",
"//",
"// Check for the deleted task flag",
"//",
"int",
"flags",
"=",
"MPPUtility",
".",
"getInt",
"(",
"metaData",
",",
"0",
")",
";",
"if",
"(",
"(",
"flags",
"&",
"0x02",
")",
"!=",
"0",
")",
"{",
"// Project stores the deleted tasks unique id's into the fixed data as well",
"// and at least in one case the deleted task was listed twice in the list",
"// the second time with data with it causing a phantom task to be shown.",
"// See CalendarErrorPhantomTasks.mpp",
"//",
"// So let's add the unique id for the deleted task into the map so we don't",
"// accidentally include the task later.",
"//",
"uniqueID",
"=",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"TASK_UNIQUE_ID_FIXED_OFFSET",
")",
";",
"// Only a short stored for deleted tasks?",
"key",
"=",
"Integer",
".",
"valueOf",
"(",
"uniqueID",
")",
";",
"if",
"(",
"taskMap",
".",
"containsKey",
"(",
"key",
")",
"==",
"false",
")",
"{",
"taskMap",
".",
"put",
"(",
"key",
",",
"null",
")",
";",
"// use null so we can easily ignore this later",
"}",
"}",
"else",
"{",
"//",
"// Do we have a null task?",
"//",
"if",
"(",
"data",
".",
"length",
"==",
"NULL_TASK_BLOCK_SIZE",
")",
"{",
"uniqueID",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"TASK_UNIQUE_ID_FIXED_OFFSET",
")",
";",
"key",
"=",
"Integer",
".",
"valueOf",
"(",
"uniqueID",
")",
";",
"if",
"(",
"taskMap",
".",
"containsKey",
"(",
"key",
")",
"==",
"false",
")",
"{",
"taskMap",
".",
"put",
"(",
"key",
",",
"Integer",
".",
"valueOf",
"(",
"loop",
")",
")",
";",
"}",
"}",
"else",
"{",
"//",
"// We apply a heuristic here - if we have more than 75% of the data, we assume",
"// the task is valid.",
"//",
"int",
"maxSize",
"=",
"fieldMap",
".",
"getMaxFixedDataSize",
"(",
"0",
")",
";",
"if",
"(",
"maxSize",
"==",
"0",
"||",
"(",
"(",
"data",
".",
"length",
"*",
"100",
")",
"/",
"maxSize",
")",
">",
"75",
")",
"{",
"uniqueID",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"uniqueIdOffset",
")",
";",
"key",
"=",
"Integer",
".",
"valueOf",
"(",
"uniqueID",
")",
";",
"// Accept this task if it does not have a deleted unique ID or it has a deleted unique ID but the name is not null",
"if",
"(",
"!",
"taskMap",
".",
"containsKey",
"(",
"key",
")",
"||",
"taskVarData",
".",
"getUnicodeString",
"(",
"key",
",",
"taskNameKey",
")",
"!=",
"null",
")",
"{",
"taskMap",
".",
"put",
"(",
"key",
",",
"Integer",
".",
"valueOf",
"(",
"loop",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"return",
"(",
"taskMap",
")",
";",
"}"
] |
This method maps the task unique identifiers to their index number
within the FixedData block.
@param fieldMap field map
@param taskFixedMeta Fixed meta data for this task
@param taskFixedData Fixed data for this task
@param taskVarData Variable task data
@return Mapping between task identifiers and block position
|
[
"This",
"method",
"maps",
"the",
"task",
"unique",
"identifiers",
"to",
"their",
"index",
"number",
"within",
"the",
"FixedData",
"block",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L812-L890
|
157,314
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
|
MPP14Reader.postProcessTasks
|
private void postProcessTasks() throws MPXJException
{
//
// Renumber ID values using a large increment to allow
// space for later inserts.
//
TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>();
// I've found a pathological case of an MPP file with around 102k blank tasks...
int nextIDIncrement = 102000;
int nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? nextIDIncrement : 0);
for (Map.Entry<Long, Integer> entry : m_taskOrder.entrySet())
{
taskMap.put(Integer.valueOf(nextID), entry.getValue());
nextID += nextIDIncrement;
}
//
// Insert any null tasks into the correct location
//
int insertionCount = 0;
Map<Integer, Integer> offsetMap = new HashMap<Integer, Integer>();
for (Map.Entry<Integer, Integer> entry : m_nullTaskOrder.entrySet())
{
int idValue = entry.getKey().intValue();
int baseTargetIdValue = (idValue - insertionCount) * nextIDIncrement;
int targetIDValue = baseTargetIdValue;
Integer previousOffsetKey = Integer.valueOf(baseTargetIdValue);
Integer previousOffset = offsetMap.get(previousOffsetKey);
int offset = previousOffset == null ? 0 : previousOffset.intValue() + 1;
++insertionCount;
while (taskMap.containsKey(Integer.valueOf(targetIDValue)))
{
++offset;
if (offset == nextIDIncrement)
{
throw new MPXJException("Unable to fix task order");
}
targetIDValue = baseTargetIdValue - (nextIDIncrement - offset);
}
offsetMap.put(previousOffsetKey, Integer.valueOf(offset));
taskMap.put(Integer.valueOf(targetIDValue), entry.getValue());
}
//
// Finally, we can renumber the tasks
//
nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? 1 : 0);
for (Map.Entry<Integer, Integer> entry : taskMap.entrySet())
{
Task task = m_file.getTaskByUniqueID(entry.getValue());
if (task != null)
{
task.setID(Integer.valueOf(nextID));
}
nextID++;
}
}
|
java
|
private void postProcessTasks() throws MPXJException
{
//
// Renumber ID values using a large increment to allow
// space for later inserts.
//
TreeMap<Integer, Integer> taskMap = new TreeMap<Integer, Integer>();
// I've found a pathological case of an MPP file with around 102k blank tasks...
int nextIDIncrement = 102000;
int nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? nextIDIncrement : 0);
for (Map.Entry<Long, Integer> entry : m_taskOrder.entrySet())
{
taskMap.put(Integer.valueOf(nextID), entry.getValue());
nextID += nextIDIncrement;
}
//
// Insert any null tasks into the correct location
//
int insertionCount = 0;
Map<Integer, Integer> offsetMap = new HashMap<Integer, Integer>();
for (Map.Entry<Integer, Integer> entry : m_nullTaskOrder.entrySet())
{
int idValue = entry.getKey().intValue();
int baseTargetIdValue = (idValue - insertionCount) * nextIDIncrement;
int targetIDValue = baseTargetIdValue;
Integer previousOffsetKey = Integer.valueOf(baseTargetIdValue);
Integer previousOffset = offsetMap.get(previousOffsetKey);
int offset = previousOffset == null ? 0 : previousOffset.intValue() + 1;
++insertionCount;
while (taskMap.containsKey(Integer.valueOf(targetIDValue)))
{
++offset;
if (offset == nextIDIncrement)
{
throw new MPXJException("Unable to fix task order");
}
targetIDValue = baseTargetIdValue - (nextIDIncrement - offset);
}
offsetMap.put(previousOffsetKey, Integer.valueOf(offset));
taskMap.put(Integer.valueOf(targetIDValue), entry.getValue());
}
//
// Finally, we can renumber the tasks
//
nextID = (m_file.getTaskByUniqueID(Integer.valueOf(0)) == null ? 1 : 0);
for (Map.Entry<Integer, Integer> entry : taskMap.entrySet())
{
Task task = m_file.getTaskByUniqueID(entry.getValue());
if (task != null)
{
task.setID(Integer.valueOf(nextID));
}
nextID++;
}
}
|
[
"private",
"void",
"postProcessTasks",
"(",
")",
"throws",
"MPXJException",
"{",
"//",
"// Renumber ID values using a large increment to allow",
"// space for later inserts.",
"//",
"TreeMap",
"<",
"Integer",
",",
"Integer",
">",
"taskMap",
"=",
"new",
"TreeMap",
"<",
"Integer",
",",
"Integer",
">",
"(",
")",
";",
"// I've found a pathological case of an MPP file with around 102k blank tasks...",
"int",
"nextIDIncrement",
"=",
"102000",
";",
"int",
"nextID",
"=",
"(",
"m_file",
".",
"getTaskByUniqueID",
"(",
"Integer",
".",
"valueOf",
"(",
"0",
")",
")",
"==",
"null",
"?",
"nextIDIncrement",
":",
"0",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Long",
",",
"Integer",
">",
"entry",
":",
"m_taskOrder",
".",
"entrySet",
"(",
")",
")",
"{",
"taskMap",
".",
"put",
"(",
"Integer",
".",
"valueOf",
"(",
"nextID",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"nextID",
"+=",
"nextIDIncrement",
";",
"}",
"//",
"// Insert any null tasks into the correct location",
"//",
"int",
"insertionCount",
"=",
"0",
";",
"Map",
"<",
"Integer",
",",
"Integer",
">",
"offsetMap",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Integer",
">",
"entry",
":",
"m_nullTaskOrder",
".",
"entrySet",
"(",
")",
")",
"{",
"int",
"idValue",
"=",
"entry",
".",
"getKey",
"(",
")",
".",
"intValue",
"(",
")",
";",
"int",
"baseTargetIdValue",
"=",
"(",
"idValue",
"-",
"insertionCount",
")",
"*",
"nextIDIncrement",
";",
"int",
"targetIDValue",
"=",
"baseTargetIdValue",
";",
"Integer",
"previousOffsetKey",
"=",
"Integer",
".",
"valueOf",
"(",
"baseTargetIdValue",
")",
";",
"Integer",
"previousOffset",
"=",
"offsetMap",
".",
"get",
"(",
"previousOffsetKey",
")",
";",
"int",
"offset",
"=",
"previousOffset",
"==",
"null",
"?",
"0",
":",
"previousOffset",
".",
"intValue",
"(",
")",
"+",
"1",
";",
"++",
"insertionCount",
";",
"while",
"(",
"taskMap",
".",
"containsKey",
"(",
"Integer",
".",
"valueOf",
"(",
"targetIDValue",
")",
")",
")",
"{",
"++",
"offset",
";",
"if",
"(",
"offset",
"==",
"nextIDIncrement",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"\"Unable to fix task order\"",
")",
";",
"}",
"targetIDValue",
"=",
"baseTargetIdValue",
"-",
"(",
"nextIDIncrement",
"-",
"offset",
")",
";",
"}",
"offsetMap",
".",
"put",
"(",
"previousOffsetKey",
",",
"Integer",
".",
"valueOf",
"(",
"offset",
")",
")",
";",
"taskMap",
".",
"put",
"(",
"Integer",
".",
"valueOf",
"(",
"targetIDValue",
")",
",",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"}",
"//",
"// Finally, we can renumber the tasks",
"//",
"nextID",
"=",
"(",
"m_file",
".",
"getTaskByUniqueID",
"(",
"Integer",
".",
"valueOf",
"(",
"0",
")",
")",
"==",
"null",
"?",
"1",
":",
"0",
")",
";",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Integer",
",",
"Integer",
">",
"entry",
":",
"taskMap",
".",
"entrySet",
"(",
")",
")",
"{",
"Task",
"task",
"=",
"m_file",
".",
"getTaskByUniqueID",
"(",
"entry",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"task",
"!=",
"null",
")",
"{",
"task",
".",
"setID",
"(",
"Integer",
".",
"valueOf",
"(",
"nextID",
")",
")",
";",
"}",
"nextID",
"++",
";",
"}",
"}"
] |
MPP14 files seem to exhibit some occasional weirdness
with duplicate ID values which leads to the task structure
being reported incorrectly. The following method attempts to correct this.
The method uses ordering data embedded in the file to reconstruct
the correct ID order of the tasks.
|
[
"MPP14",
"files",
"seem",
"to",
"exhibit",
"some",
"occasional",
"weirdness",
"with",
"duplicate",
"ID",
"values",
"which",
"leads",
"to",
"the",
"task",
"structure",
"being",
"reported",
"incorrectly",
".",
"The",
"following",
"method",
"attempts",
"to",
"correct",
"this",
".",
"The",
"method",
"uses",
"ordering",
"data",
"embedded",
"in",
"the",
"file",
"to",
"reconstruct",
"the",
"correct",
"ID",
"order",
"of",
"the",
"tasks",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L1317-L1376
|
157,315
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
|
MPP14Reader.processHyperlinkData
|
private void processHyperlinkData(Resource resource, byte[] data)
{
if (data != null)
{
int offset = 12;
String hyperlink;
String address;
String subaddress;
offset += 12;
hyperlink = MPPUtility.getUnicodeString(data, offset);
offset += ((hyperlink.length() + 1) * 2);
offset += 12;
address = MPPUtility.getUnicodeString(data, offset);
offset += ((address.length() + 1) * 2);
offset += 12;
subaddress = MPPUtility.getUnicodeString(data, offset);
resource.setHyperlink(hyperlink);
resource.setHyperlinkAddress(address);
resource.setHyperlinkSubAddress(subaddress);
}
}
|
java
|
private void processHyperlinkData(Resource resource, byte[] data)
{
if (data != null)
{
int offset = 12;
String hyperlink;
String address;
String subaddress;
offset += 12;
hyperlink = MPPUtility.getUnicodeString(data, offset);
offset += ((hyperlink.length() + 1) * 2);
offset += 12;
address = MPPUtility.getUnicodeString(data, offset);
offset += ((address.length() + 1) * 2);
offset += 12;
subaddress = MPPUtility.getUnicodeString(data, offset);
resource.setHyperlink(hyperlink);
resource.setHyperlinkAddress(address);
resource.setHyperlinkSubAddress(subaddress);
}
}
|
[
"private",
"void",
"processHyperlinkData",
"(",
"Resource",
"resource",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"if",
"(",
"data",
"!=",
"null",
")",
"{",
"int",
"offset",
"=",
"12",
";",
"String",
"hyperlink",
";",
"String",
"address",
";",
"String",
"subaddress",
";",
"offset",
"+=",
"12",
";",
"hyperlink",
"=",
"MPPUtility",
".",
"getUnicodeString",
"(",
"data",
",",
"offset",
")",
";",
"offset",
"+=",
"(",
"(",
"hyperlink",
".",
"length",
"(",
")",
"+",
"1",
")",
"*",
"2",
")",
";",
"offset",
"+=",
"12",
";",
"address",
"=",
"MPPUtility",
".",
"getUnicodeString",
"(",
"data",
",",
"offset",
")",
";",
"offset",
"+=",
"(",
"(",
"address",
".",
"length",
"(",
")",
"+",
"1",
")",
"*",
"2",
")",
";",
"offset",
"+=",
"12",
";",
"subaddress",
"=",
"MPPUtility",
".",
"getUnicodeString",
"(",
"data",
",",
"offset",
")",
";",
"resource",
".",
"setHyperlink",
"(",
"hyperlink",
")",
";",
"resource",
".",
"setHyperlinkAddress",
"(",
"address",
")",
";",
"resource",
".",
"setHyperlinkSubAddress",
"(",
"subaddress",
")",
";",
"}",
"}"
] |
This method is used to extract the resource hyperlink attributes
from a block of data and call the appropriate modifier methods
to configure the specified task object.
@param resource resource instance
@param data hyperlink data block
|
[
"This",
"method",
"is",
"used",
"to",
"extract",
"the",
"resource",
"hyperlink",
"attributes",
"from",
"a",
"block",
"of",
"data",
"and",
"call",
"the",
"appropriate",
"modifier",
"methods",
"to",
"configure",
"the",
"specified",
"task",
"object",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L1547-L1571
|
157,316
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPP14Reader.java
|
MPP14Reader.readBitFields
|
private void readBitFields(MppBitFlag[] flags, FieldContainer container, byte[] data)
{
for (MppBitFlag flag : flags)
{
flag.setValue(container, data);
}
}
|
java
|
private void readBitFields(MppBitFlag[] flags, FieldContainer container, byte[] data)
{
for (MppBitFlag flag : flags)
{
flag.setValue(container, data);
}
}
|
[
"private",
"void",
"readBitFields",
"(",
"MppBitFlag",
"[",
"]",
"flags",
",",
"FieldContainer",
"container",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"for",
"(",
"MppBitFlag",
"flag",
":",
"flags",
")",
"{",
"flag",
".",
"setValue",
"(",
"container",
",",
"data",
")",
";",
"}",
"}"
] |
Iterate through a set of bit field flags and set the value for each one
in the supplied container.
@param flags bit field flags
@param container field container
@param data source data
|
[
"Iterate",
"through",
"a",
"set",
"of",
"bit",
"field",
"flags",
"and",
"set",
"the",
"value",
"for",
"each",
"one",
"in",
"the",
"supplied",
"container",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPP14Reader.java#L2039-L2045
|
157,317
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/turboproject/Table.java
|
Table.read
|
public void read(InputStream is) throws IOException
{
byte[] headerBlock = new byte[20];
is.read(headerBlock);
int headerLength = PEPUtility.getShort(headerBlock, 8);
int recordCount = PEPUtility.getInt(headerBlock, 10);
int recordLength = PEPUtility.getInt(headerBlock, 16);
StreamHelper.skip(is, headerLength - headerBlock.length);
byte[] record = new byte[recordLength];
for (int recordIndex = 1; recordIndex <= recordCount; recordIndex++)
{
is.read(record);
readRow(recordIndex, record);
}
}
|
java
|
public void read(InputStream is) throws IOException
{
byte[] headerBlock = new byte[20];
is.read(headerBlock);
int headerLength = PEPUtility.getShort(headerBlock, 8);
int recordCount = PEPUtility.getInt(headerBlock, 10);
int recordLength = PEPUtility.getInt(headerBlock, 16);
StreamHelper.skip(is, headerLength - headerBlock.length);
byte[] record = new byte[recordLength];
for (int recordIndex = 1; recordIndex <= recordCount; recordIndex++)
{
is.read(record);
readRow(recordIndex, record);
}
}
|
[
"public",
"void",
"read",
"(",
"InputStream",
"is",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"headerBlock",
"=",
"new",
"byte",
"[",
"20",
"]",
";",
"is",
".",
"read",
"(",
"headerBlock",
")",
";",
"int",
"headerLength",
"=",
"PEPUtility",
".",
"getShort",
"(",
"headerBlock",
",",
"8",
")",
";",
"int",
"recordCount",
"=",
"PEPUtility",
".",
"getInt",
"(",
"headerBlock",
",",
"10",
")",
";",
"int",
"recordLength",
"=",
"PEPUtility",
".",
"getInt",
"(",
"headerBlock",
",",
"16",
")",
";",
"StreamHelper",
".",
"skip",
"(",
"is",
",",
"headerLength",
"-",
"headerBlock",
".",
"length",
")",
";",
"byte",
"[",
"]",
"record",
"=",
"new",
"byte",
"[",
"recordLength",
"]",
";",
"for",
"(",
"int",
"recordIndex",
"=",
"1",
";",
"recordIndex",
"<=",
"recordCount",
";",
"recordIndex",
"++",
")",
"{",
"is",
".",
"read",
"(",
"record",
")",
";",
"readRow",
"(",
"recordIndex",
",",
"record",
")",
";",
"}",
"}"
] |
Reads the table data from an input stream and breaks
it down into rows.
@param is input stream
|
[
"Reads",
"the",
"table",
"data",
"from",
"an",
"input",
"stream",
"and",
"breaks",
"it",
"down",
"into",
"rows",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/Table.java#L59-L75
|
157,318
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/turboproject/Table.java
|
Table.addRow
|
protected void addRow(int uniqueID, Map<String, Object> map)
{
m_rows.put(Integer.valueOf(uniqueID), new MapRow(map));
}
|
java
|
protected void addRow(int uniqueID, Map<String, Object> map)
{
m_rows.put(Integer.valueOf(uniqueID), new MapRow(map));
}
|
[
"protected",
"void",
"addRow",
"(",
"int",
"uniqueID",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"map",
")",
"{",
"m_rows",
".",
"put",
"(",
"Integer",
".",
"valueOf",
"(",
"uniqueID",
")",
",",
"new",
"MapRow",
"(",
"map",
")",
")",
";",
"}"
] |
Adds a row to the internal storage, indexed by primary key.
@param uniqueID unique ID of the row
@param map row data as a simpe map
|
[
"Adds",
"a",
"row",
"to",
"the",
"internal",
"storage",
"indexed",
"by",
"primary",
"key",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/turboproject/Table.java#L106-L109
|
157,319
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java
|
TimephasedDataFactory.getCompleteWork
|
public List<TimephasedWork> getCompleteWork(ProjectCalendar calendar, ResourceAssignment resourceAssignment, byte[] data)
{
LinkedList<TimephasedWork> list = new LinkedList<TimephasedWork>();
if (calendar != null && data != null && data.length > 2 && MPPUtility.getShort(data, 0) > 0)
{
Date startDate = resourceAssignment.getStart();
double finishTime = MPPUtility.getInt(data, 24);
int blockCount = MPPUtility.getShort(data, 0);
double previousCumulativeWork = 0;
TimephasedWork previousAssignment = null;
int index = 32;
int currentBlock = 0;
while (currentBlock < blockCount && index + 20 <= data.length)
{
double time = MPPUtility.getInt(data, index + 0);
// If the start of this block is before the start of the assignment, or after the end of the assignment
// the values don't make sense, so we'll just set the start of this block to be the start of the assignment.
// This deals with an issue where odd timephased data like this was causing an MPP file to be read
// extremely slowly.
if (time < 0 || time > finishTime)
{
time = 0;
}
else
{
time /= 80;
}
Duration startWork = Duration.getInstance(time, TimeUnit.MINUTES);
double currentCumulativeWork = (long) MPPUtility.getDouble(data, index + 4);
double assignmentDuration = currentCumulativeWork - previousCumulativeWork;
previousCumulativeWork = currentCumulativeWork;
assignmentDuration /= 1000;
Duration totalWork = Duration.getInstance(assignmentDuration, TimeUnit.MINUTES);
time = (long) MPPUtility.getDouble(data, index + 12);
time /= 125;
time *= 6;
Duration workPerDay = Duration.getInstance(time, TimeUnit.MINUTES);
Date start;
if (startWork.getDuration() == 0)
{
start = startDate;
}
else
{
start = calendar.getDate(startDate, startWork, true);
}
TimephasedWork assignment = new TimephasedWork();
assignment.setStart(start);
assignment.setAmountPerDay(workPerDay);
assignment.setTotalAmount(totalWork);
if (previousAssignment != null)
{
Date finish = calendar.getDate(startDate, startWork, false);
previousAssignment.setFinish(finish);
if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime())
{
list.removeLast();
}
}
list.add(assignment);
previousAssignment = assignment;
index += 20;
++currentBlock;
}
if (previousAssignment != null)
{
Duration finishWork = Duration.getInstance(finishTime / 80, TimeUnit.MINUTES);
Date finish = calendar.getDate(startDate, finishWork, false);
previousAssignment.setFinish(finish);
if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime())
{
list.removeLast();
}
}
}
return list;
}
|
java
|
public List<TimephasedWork> getCompleteWork(ProjectCalendar calendar, ResourceAssignment resourceAssignment, byte[] data)
{
LinkedList<TimephasedWork> list = new LinkedList<TimephasedWork>();
if (calendar != null && data != null && data.length > 2 && MPPUtility.getShort(data, 0) > 0)
{
Date startDate = resourceAssignment.getStart();
double finishTime = MPPUtility.getInt(data, 24);
int blockCount = MPPUtility.getShort(data, 0);
double previousCumulativeWork = 0;
TimephasedWork previousAssignment = null;
int index = 32;
int currentBlock = 0;
while (currentBlock < blockCount && index + 20 <= data.length)
{
double time = MPPUtility.getInt(data, index + 0);
// If the start of this block is before the start of the assignment, or after the end of the assignment
// the values don't make sense, so we'll just set the start of this block to be the start of the assignment.
// This deals with an issue where odd timephased data like this was causing an MPP file to be read
// extremely slowly.
if (time < 0 || time > finishTime)
{
time = 0;
}
else
{
time /= 80;
}
Duration startWork = Duration.getInstance(time, TimeUnit.MINUTES);
double currentCumulativeWork = (long) MPPUtility.getDouble(data, index + 4);
double assignmentDuration = currentCumulativeWork - previousCumulativeWork;
previousCumulativeWork = currentCumulativeWork;
assignmentDuration /= 1000;
Duration totalWork = Duration.getInstance(assignmentDuration, TimeUnit.MINUTES);
time = (long) MPPUtility.getDouble(data, index + 12);
time /= 125;
time *= 6;
Duration workPerDay = Duration.getInstance(time, TimeUnit.MINUTES);
Date start;
if (startWork.getDuration() == 0)
{
start = startDate;
}
else
{
start = calendar.getDate(startDate, startWork, true);
}
TimephasedWork assignment = new TimephasedWork();
assignment.setStart(start);
assignment.setAmountPerDay(workPerDay);
assignment.setTotalAmount(totalWork);
if (previousAssignment != null)
{
Date finish = calendar.getDate(startDate, startWork, false);
previousAssignment.setFinish(finish);
if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime())
{
list.removeLast();
}
}
list.add(assignment);
previousAssignment = assignment;
index += 20;
++currentBlock;
}
if (previousAssignment != null)
{
Duration finishWork = Duration.getInstance(finishTime / 80, TimeUnit.MINUTES);
Date finish = calendar.getDate(startDate, finishWork, false);
previousAssignment.setFinish(finish);
if (previousAssignment.getStart().getTime() == previousAssignment.getFinish().getTime())
{
list.removeLast();
}
}
}
return list;
}
|
[
"public",
"List",
"<",
"TimephasedWork",
">",
"getCompleteWork",
"(",
"ProjectCalendar",
"calendar",
",",
"ResourceAssignment",
"resourceAssignment",
",",
"byte",
"[",
"]",
"data",
")",
"{",
"LinkedList",
"<",
"TimephasedWork",
">",
"list",
"=",
"new",
"LinkedList",
"<",
"TimephasedWork",
">",
"(",
")",
";",
"if",
"(",
"calendar",
"!=",
"null",
"&&",
"data",
"!=",
"null",
"&&",
"data",
".",
"length",
">",
"2",
"&&",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"0",
")",
">",
"0",
")",
"{",
"Date",
"startDate",
"=",
"resourceAssignment",
".",
"getStart",
"(",
")",
";",
"double",
"finishTime",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"24",
")",
";",
"int",
"blockCount",
"=",
"MPPUtility",
".",
"getShort",
"(",
"data",
",",
"0",
")",
";",
"double",
"previousCumulativeWork",
"=",
"0",
";",
"TimephasedWork",
"previousAssignment",
"=",
"null",
";",
"int",
"index",
"=",
"32",
";",
"int",
"currentBlock",
"=",
"0",
";",
"while",
"(",
"currentBlock",
"<",
"blockCount",
"&&",
"index",
"+",
"20",
"<=",
"data",
".",
"length",
")",
"{",
"double",
"time",
"=",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"index",
"+",
"0",
")",
";",
"// If the start of this block is before the start of the assignment, or after the end of the assignment",
"// the values don't make sense, so we'll just set the start of this block to be the start of the assignment.",
"// This deals with an issue where odd timephased data like this was causing an MPP file to be read",
"// extremely slowly.",
"if",
"(",
"time",
"<",
"0",
"||",
"time",
">",
"finishTime",
")",
"{",
"time",
"=",
"0",
";",
"}",
"else",
"{",
"time",
"/=",
"80",
";",
"}",
"Duration",
"startWork",
"=",
"Duration",
".",
"getInstance",
"(",
"time",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"double",
"currentCumulativeWork",
"=",
"(",
"long",
")",
"MPPUtility",
".",
"getDouble",
"(",
"data",
",",
"index",
"+",
"4",
")",
";",
"double",
"assignmentDuration",
"=",
"currentCumulativeWork",
"-",
"previousCumulativeWork",
";",
"previousCumulativeWork",
"=",
"currentCumulativeWork",
";",
"assignmentDuration",
"/=",
"1000",
";",
"Duration",
"totalWork",
"=",
"Duration",
".",
"getInstance",
"(",
"assignmentDuration",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"time",
"=",
"(",
"long",
")",
"MPPUtility",
".",
"getDouble",
"(",
"data",
",",
"index",
"+",
"12",
")",
";",
"time",
"/=",
"125",
";",
"time",
"*=",
"6",
";",
"Duration",
"workPerDay",
"=",
"Duration",
".",
"getInstance",
"(",
"time",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"Date",
"start",
";",
"if",
"(",
"startWork",
".",
"getDuration",
"(",
")",
"==",
"0",
")",
"{",
"start",
"=",
"startDate",
";",
"}",
"else",
"{",
"start",
"=",
"calendar",
".",
"getDate",
"(",
"startDate",
",",
"startWork",
",",
"true",
")",
";",
"}",
"TimephasedWork",
"assignment",
"=",
"new",
"TimephasedWork",
"(",
")",
";",
"assignment",
".",
"setStart",
"(",
"start",
")",
";",
"assignment",
".",
"setAmountPerDay",
"(",
"workPerDay",
")",
";",
"assignment",
".",
"setTotalAmount",
"(",
"totalWork",
")",
";",
"if",
"(",
"previousAssignment",
"!=",
"null",
")",
"{",
"Date",
"finish",
"=",
"calendar",
".",
"getDate",
"(",
"startDate",
",",
"startWork",
",",
"false",
")",
";",
"previousAssignment",
".",
"setFinish",
"(",
"finish",
")",
";",
"if",
"(",
"previousAssignment",
".",
"getStart",
"(",
")",
".",
"getTime",
"(",
")",
"==",
"previousAssignment",
".",
"getFinish",
"(",
")",
".",
"getTime",
"(",
")",
")",
"{",
"list",
".",
"removeLast",
"(",
")",
";",
"}",
"}",
"list",
".",
"add",
"(",
"assignment",
")",
";",
"previousAssignment",
"=",
"assignment",
";",
"index",
"+=",
"20",
";",
"++",
"currentBlock",
";",
"}",
"if",
"(",
"previousAssignment",
"!=",
"null",
")",
"{",
"Duration",
"finishWork",
"=",
"Duration",
".",
"getInstance",
"(",
"finishTime",
"/",
"80",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"Date",
"finish",
"=",
"calendar",
".",
"getDate",
"(",
"startDate",
",",
"finishWork",
",",
"false",
")",
";",
"previousAssignment",
".",
"setFinish",
"(",
"finish",
")",
";",
"if",
"(",
"previousAssignment",
".",
"getStart",
"(",
")",
".",
"getTime",
"(",
")",
"==",
"previousAssignment",
".",
"getFinish",
"(",
")",
".",
"getTime",
"(",
")",
")",
"{",
"list",
".",
"removeLast",
"(",
")",
";",
"}",
"}",
"}",
"return",
"list",
";",
"}"
] |
Given a block of data representing completed work, this method will
retrieve a set of TimephasedWork instances which represent
the day by day work carried out for a specific resource assignment.
@param calendar calendar on which date calculations are based
@param resourceAssignment resource assignment
@param data completed work data block
@return list of TimephasedWork instances
|
[
"Given",
"a",
"block",
"of",
"data",
"representing",
"completed",
"work",
"this",
"method",
"will",
"retrieve",
"a",
"set",
"of",
"TimephasedWork",
"instances",
"which",
"represent",
"the",
"day",
"by",
"day",
"work",
"carried",
"out",
"for",
"a",
"specific",
"resource",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java#L61-L149
|
157,320
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java
|
TimephasedDataFactory.getWorkModified
|
public boolean getWorkModified(List<TimephasedWork> list)
{
boolean result = false;
for (TimephasedWork assignment : list)
{
result = assignment.getModified();
if (result)
{
break;
}
}
return result;
}
|
java
|
public boolean getWorkModified(List<TimephasedWork> list)
{
boolean result = false;
for (TimephasedWork assignment : list)
{
result = assignment.getModified();
if (result)
{
break;
}
}
return result;
}
|
[
"public",
"boolean",
"getWorkModified",
"(",
"List",
"<",
"TimephasedWork",
">",
"list",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"for",
"(",
"TimephasedWork",
"assignment",
":",
"list",
")",
"{",
"result",
"=",
"assignment",
".",
"getModified",
"(",
")",
";",
"if",
"(",
"result",
")",
"{",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Test the list of TimephasedWork instances to see
if any of them have been modified.
@param list list of TimephasedWork instances
@return boolean flag
|
[
"Test",
"the",
"list",
"of",
"TimephasedWork",
"instances",
"to",
"see",
"if",
"any",
"of",
"them",
"have",
"been",
"modified",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java#L304-L316
|
157,321
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java
|
TimephasedDataFactory.getBaselineWork
|
public TimephasedWorkContainer getBaselineWork(ResourceAssignment assignment, ProjectCalendar calendar, TimephasedWorkNormaliser normaliser, byte[] data, boolean raw)
{
TimephasedWorkContainer result = null;
if (data != null && data.length > 0)
{
LinkedList<TimephasedWork> list = null;
//System.out.println(ByteArrayHelper.hexdump(data, false));
int index = 8; // 8 byte header
int blockSize = 40;
double previousCumulativeWorkPerformedInMinutes = 0;
Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 36);
index += blockSize;
TimephasedWork work = null;
while (index + blockSize <= data.length)
{
double cumulativeWorkInMinutes = (double) ((long) MPPUtility.getDouble(data, index + 20)) / 1000;
if (!Duration.durationValueEquals(cumulativeWorkInMinutes, previousCumulativeWorkPerformedInMinutes))
{
//double unknownWorkThisPeriodInMinutes = ((long) MPPUtility.getDouble(data, index + 0)) / 1000;
double normalActualWorkThisPeriodInMinutes = ((double) MPPUtility.getInt(data, index + 8)) / 10;
double normalRemainingWorkThisPeriodInMinutes = ((double) MPPUtility.getInt(data, index + 28)) / 10;
double workThisPeriodInMinutes = cumulativeWorkInMinutes - previousCumulativeWorkPerformedInMinutes;
double overtimeWorkThisPeriodInMinutes = workThisPeriodInMinutes - (normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes);
double overtimeFactor = overtimeWorkThisPeriodInMinutes / (normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes);
double normalWorkPerDayInMinutes = 480;
double overtimeWorkPerDayInMinutes = normalWorkPerDayInMinutes * overtimeFactor;
work = new TimephasedWork();
work.setFinish(MPPUtility.getTimestampFromTenths(data, index + 16));
work.setStart(blockStartDate);
work.setTotalAmount(Duration.getInstance(workThisPeriodInMinutes, TimeUnit.MINUTES));
work.setAmountPerDay(Duration.getInstance(normalWorkPerDayInMinutes + overtimeWorkPerDayInMinutes, TimeUnit.MINUTES));
previousCumulativeWorkPerformedInMinutes = cumulativeWorkInMinutes;
if (list == null)
{
list = new LinkedList<TimephasedWork>();
}
list.add(work);
//System.out.println(work);
}
blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 36);
index += blockSize;
}
if (list != null)
{
if (work != null)
{
work.setFinish(assignment.getFinish());
}
result = new DefaultTimephasedWorkContainer(calendar, normaliser, list, raw);
}
}
return result;
}
|
java
|
public TimephasedWorkContainer getBaselineWork(ResourceAssignment assignment, ProjectCalendar calendar, TimephasedWorkNormaliser normaliser, byte[] data, boolean raw)
{
TimephasedWorkContainer result = null;
if (data != null && data.length > 0)
{
LinkedList<TimephasedWork> list = null;
//System.out.println(ByteArrayHelper.hexdump(data, false));
int index = 8; // 8 byte header
int blockSize = 40;
double previousCumulativeWorkPerformedInMinutes = 0;
Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 36);
index += blockSize;
TimephasedWork work = null;
while (index + blockSize <= data.length)
{
double cumulativeWorkInMinutes = (double) ((long) MPPUtility.getDouble(data, index + 20)) / 1000;
if (!Duration.durationValueEquals(cumulativeWorkInMinutes, previousCumulativeWorkPerformedInMinutes))
{
//double unknownWorkThisPeriodInMinutes = ((long) MPPUtility.getDouble(data, index + 0)) / 1000;
double normalActualWorkThisPeriodInMinutes = ((double) MPPUtility.getInt(data, index + 8)) / 10;
double normalRemainingWorkThisPeriodInMinutes = ((double) MPPUtility.getInt(data, index + 28)) / 10;
double workThisPeriodInMinutes = cumulativeWorkInMinutes - previousCumulativeWorkPerformedInMinutes;
double overtimeWorkThisPeriodInMinutes = workThisPeriodInMinutes - (normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes);
double overtimeFactor = overtimeWorkThisPeriodInMinutes / (normalActualWorkThisPeriodInMinutes + normalRemainingWorkThisPeriodInMinutes);
double normalWorkPerDayInMinutes = 480;
double overtimeWorkPerDayInMinutes = normalWorkPerDayInMinutes * overtimeFactor;
work = new TimephasedWork();
work.setFinish(MPPUtility.getTimestampFromTenths(data, index + 16));
work.setStart(blockStartDate);
work.setTotalAmount(Duration.getInstance(workThisPeriodInMinutes, TimeUnit.MINUTES));
work.setAmountPerDay(Duration.getInstance(normalWorkPerDayInMinutes + overtimeWorkPerDayInMinutes, TimeUnit.MINUTES));
previousCumulativeWorkPerformedInMinutes = cumulativeWorkInMinutes;
if (list == null)
{
list = new LinkedList<TimephasedWork>();
}
list.add(work);
//System.out.println(work);
}
blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 36);
index += blockSize;
}
if (list != null)
{
if (work != null)
{
work.setFinish(assignment.getFinish());
}
result = new DefaultTimephasedWorkContainer(calendar, normaliser, list, raw);
}
}
return result;
}
|
[
"public",
"TimephasedWorkContainer",
"getBaselineWork",
"(",
"ResourceAssignment",
"assignment",
",",
"ProjectCalendar",
"calendar",
",",
"TimephasedWorkNormaliser",
"normaliser",
",",
"byte",
"[",
"]",
"data",
",",
"boolean",
"raw",
")",
"{",
"TimephasedWorkContainer",
"result",
"=",
"null",
";",
"if",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"length",
">",
"0",
")",
"{",
"LinkedList",
"<",
"TimephasedWork",
">",
"list",
"=",
"null",
";",
"//System.out.println(ByteArrayHelper.hexdump(data, false));",
"int",
"index",
"=",
"8",
";",
"// 8 byte header",
"int",
"blockSize",
"=",
"40",
";",
"double",
"previousCumulativeWorkPerformedInMinutes",
"=",
"0",
";",
"Date",
"blockStartDate",
"=",
"MPPUtility",
".",
"getTimestampFromTenths",
"(",
"data",
",",
"index",
"+",
"36",
")",
";",
"index",
"+=",
"blockSize",
";",
"TimephasedWork",
"work",
"=",
"null",
";",
"while",
"(",
"index",
"+",
"blockSize",
"<=",
"data",
".",
"length",
")",
"{",
"double",
"cumulativeWorkInMinutes",
"=",
"(",
"double",
")",
"(",
"(",
"long",
")",
"MPPUtility",
".",
"getDouble",
"(",
"data",
",",
"index",
"+",
"20",
")",
")",
"/",
"1000",
";",
"if",
"(",
"!",
"Duration",
".",
"durationValueEquals",
"(",
"cumulativeWorkInMinutes",
",",
"previousCumulativeWorkPerformedInMinutes",
")",
")",
"{",
"//double unknownWorkThisPeriodInMinutes = ((long) MPPUtility.getDouble(data, index + 0)) / 1000;",
"double",
"normalActualWorkThisPeriodInMinutes",
"=",
"(",
"(",
"double",
")",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"index",
"+",
"8",
")",
")",
"/",
"10",
";",
"double",
"normalRemainingWorkThisPeriodInMinutes",
"=",
"(",
"(",
"double",
")",
"MPPUtility",
".",
"getInt",
"(",
"data",
",",
"index",
"+",
"28",
")",
")",
"/",
"10",
";",
"double",
"workThisPeriodInMinutes",
"=",
"cumulativeWorkInMinutes",
"-",
"previousCumulativeWorkPerformedInMinutes",
";",
"double",
"overtimeWorkThisPeriodInMinutes",
"=",
"workThisPeriodInMinutes",
"-",
"(",
"normalActualWorkThisPeriodInMinutes",
"+",
"normalRemainingWorkThisPeriodInMinutes",
")",
";",
"double",
"overtimeFactor",
"=",
"overtimeWorkThisPeriodInMinutes",
"/",
"(",
"normalActualWorkThisPeriodInMinutes",
"+",
"normalRemainingWorkThisPeriodInMinutes",
")",
";",
"double",
"normalWorkPerDayInMinutes",
"=",
"480",
";",
"double",
"overtimeWorkPerDayInMinutes",
"=",
"normalWorkPerDayInMinutes",
"*",
"overtimeFactor",
";",
"work",
"=",
"new",
"TimephasedWork",
"(",
")",
";",
"work",
".",
"setFinish",
"(",
"MPPUtility",
".",
"getTimestampFromTenths",
"(",
"data",
",",
"index",
"+",
"16",
")",
")",
";",
"work",
".",
"setStart",
"(",
"blockStartDate",
")",
";",
"work",
".",
"setTotalAmount",
"(",
"Duration",
".",
"getInstance",
"(",
"workThisPeriodInMinutes",
",",
"TimeUnit",
".",
"MINUTES",
")",
")",
";",
"work",
".",
"setAmountPerDay",
"(",
"Duration",
".",
"getInstance",
"(",
"normalWorkPerDayInMinutes",
"+",
"overtimeWorkPerDayInMinutes",
",",
"TimeUnit",
".",
"MINUTES",
")",
")",
";",
"previousCumulativeWorkPerformedInMinutes",
"=",
"cumulativeWorkInMinutes",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"LinkedList",
"<",
"TimephasedWork",
">",
"(",
")",
";",
"}",
"list",
".",
"add",
"(",
"work",
")",
";",
"//System.out.println(work);",
"}",
"blockStartDate",
"=",
"MPPUtility",
".",
"getTimestampFromTenths",
"(",
"data",
",",
"index",
"+",
"36",
")",
";",
"index",
"+=",
"blockSize",
";",
"}",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"if",
"(",
"work",
"!=",
"null",
")",
"{",
"work",
".",
"setFinish",
"(",
"assignment",
".",
"getFinish",
"(",
")",
")",
";",
"}",
"result",
"=",
"new",
"DefaultTimephasedWorkContainer",
"(",
"calendar",
",",
"normaliser",
",",
"list",
",",
"raw",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Extracts baseline work from the MPP file for a specific baseline.
Returns null if no baseline work is present, otherwise returns
a list of timephased work items.
@param assignment parent assignment
@param calendar baseline calendar
@param normaliser normaliser associated with this data
@param data timephased baseline work data block
@param raw flag indicating if this data is to be treated as raw
@return timephased work
|
[
"Extracts",
"baseline",
"work",
"from",
"the",
"MPP",
"file",
"for",
"a",
"specific",
"baseline",
".",
"Returns",
"null",
"if",
"no",
"baseline",
"work",
"is",
"present",
"otherwise",
"returns",
"a",
"list",
"of",
"timephased",
"work",
"items",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java#L330-L392
|
157,322
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java
|
TimephasedDataFactory.getBaselineCost
|
public TimephasedCostContainer getBaselineCost(ProjectCalendar calendar, TimephasedCostNormaliser normaliser, byte[] data, boolean raw)
{
TimephasedCostContainer result = null;
if (data != null && data.length > 0)
{
LinkedList<TimephasedCost> list = null;
//System.out.println(ByteArrayHelper.hexdump(data, false));
int index = 16; // 16 byte header
int blockSize = 20;
double previousTotalCost = 0;
Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 16);
index += blockSize;
while (index + blockSize <= data.length)
{
Date blockEndDate = MPPUtility.getTimestampFromTenths(data, index + 16);
double currentTotalCost = (double) ((long) MPPUtility.getDouble(data, index + 8)) / 100;
if (!costEquals(previousTotalCost, currentTotalCost))
{
TimephasedCost cost = new TimephasedCost();
cost.setStart(blockStartDate);
cost.setFinish(blockEndDate);
cost.setTotalAmount(Double.valueOf(currentTotalCost - previousTotalCost));
if (list == null)
{
list = new LinkedList<TimephasedCost>();
}
list.add(cost);
//System.out.println(cost);
previousTotalCost = currentTotalCost;
}
blockStartDate = blockEndDate;
index += blockSize;
}
if (list != null)
{
result = new DefaultTimephasedCostContainer(calendar, normaliser, list, raw);
}
}
return result;
}
|
java
|
public TimephasedCostContainer getBaselineCost(ProjectCalendar calendar, TimephasedCostNormaliser normaliser, byte[] data, boolean raw)
{
TimephasedCostContainer result = null;
if (data != null && data.length > 0)
{
LinkedList<TimephasedCost> list = null;
//System.out.println(ByteArrayHelper.hexdump(data, false));
int index = 16; // 16 byte header
int blockSize = 20;
double previousTotalCost = 0;
Date blockStartDate = MPPUtility.getTimestampFromTenths(data, index + 16);
index += blockSize;
while (index + blockSize <= data.length)
{
Date blockEndDate = MPPUtility.getTimestampFromTenths(data, index + 16);
double currentTotalCost = (double) ((long) MPPUtility.getDouble(data, index + 8)) / 100;
if (!costEquals(previousTotalCost, currentTotalCost))
{
TimephasedCost cost = new TimephasedCost();
cost.setStart(blockStartDate);
cost.setFinish(blockEndDate);
cost.setTotalAmount(Double.valueOf(currentTotalCost - previousTotalCost));
if (list == null)
{
list = new LinkedList<TimephasedCost>();
}
list.add(cost);
//System.out.println(cost);
previousTotalCost = currentTotalCost;
}
blockStartDate = blockEndDate;
index += blockSize;
}
if (list != null)
{
result = new DefaultTimephasedCostContainer(calendar, normaliser, list, raw);
}
}
return result;
}
|
[
"public",
"TimephasedCostContainer",
"getBaselineCost",
"(",
"ProjectCalendar",
"calendar",
",",
"TimephasedCostNormaliser",
"normaliser",
",",
"byte",
"[",
"]",
"data",
",",
"boolean",
"raw",
")",
"{",
"TimephasedCostContainer",
"result",
"=",
"null",
";",
"if",
"(",
"data",
"!=",
"null",
"&&",
"data",
".",
"length",
">",
"0",
")",
"{",
"LinkedList",
"<",
"TimephasedCost",
">",
"list",
"=",
"null",
";",
"//System.out.println(ByteArrayHelper.hexdump(data, false));",
"int",
"index",
"=",
"16",
";",
"// 16 byte header",
"int",
"blockSize",
"=",
"20",
";",
"double",
"previousTotalCost",
"=",
"0",
";",
"Date",
"blockStartDate",
"=",
"MPPUtility",
".",
"getTimestampFromTenths",
"(",
"data",
",",
"index",
"+",
"16",
")",
";",
"index",
"+=",
"blockSize",
";",
"while",
"(",
"index",
"+",
"blockSize",
"<=",
"data",
".",
"length",
")",
"{",
"Date",
"blockEndDate",
"=",
"MPPUtility",
".",
"getTimestampFromTenths",
"(",
"data",
",",
"index",
"+",
"16",
")",
";",
"double",
"currentTotalCost",
"=",
"(",
"double",
")",
"(",
"(",
"long",
")",
"MPPUtility",
".",
"getDouble",
"(",
"data",
",",
"index",
"+",
"8",
")",
")",
"/",
"100",
";",
"if",
"(",
"!",
"costEquals",
"(",
"previousTotalCost",
",",
"currentTotalCost",
")",
")",
"{",
"TimephasedCost",
"cost",
"=",
"new",
"TimephasedCost",
"(",
")",
";",
"cost",
".",
"setStart",
"(",
"blockStartDate",
")",
";",
"cost",
".",
"setFinish",
"(",
"blockEndDate",
")",
";",
"cost",
".",
"setTotalAmount",
"(",
"Double",
".",
"valueOf",
"(",
"currentTotalCost",
"-",
"previousTotalCost",
")",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"LinkedList",
"<",
"TimephasedCost",
">",
"(",
")",
";",
"}",
"list",
".",
"add",
"(",
"cost",
")",
";",
"//System.out.println(cost);",
"previousTotalCost",
"=",
"currentTotalCost",
";",
"}",
"blockStartDate",
"=",
"blockEndDate",
";",
"index",
"+=",
"blockSize",
";",
"}",
"if",
"(",
"list",
"!=",
"null",
")",
"{",
"result",
"=",
"new",
"DefaultTimephasedCostContainer",
"(",
"calendar",
",",
"normaliser",
",",
"list",
",",
"raw",
")",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Extracts baseline cost from the MPP file for a specific baseline.
Returns null if no baseline cost is present, otherwise returns
a list of timephased work items.
@param calendar baseline calendar
@param normaliser normaliser associated with this data
@param data timephased baseline work data block
@param raw flag indicating if this data is to be treated as raw
@return timephased work
|
[
"Extracts",
"baseline",
"cost",
"from",
"the",
"MPP",
"file",
"for",
"a",
"specific",
"baseline",
".",
"Returns",
"null",
"if",
"no",
"baseline",
"cost",
"is",
"present",
"otherwise",
"returns",
"a",
"list",
"of",
"timephased",
"work",
"items",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/TimephasedDataFactory.java#L405-L453
|
157,323
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/common/SplitTaskFactory.java
|
SplitTaskFactory.processSplitData
|
public void processSplitData(Task task, List<TimephasedWork> timephasedComplete, List<TimephasedWork> timephasedPlanned)
{
Date splitsComplete = null;
TimephasedWork lastComplete = null;
TimephasedWork firstPlanned = null;
if (!timephasedComplete.isEmpty())
{
lastComplete = timephasedComplete.get(timephasedComplete.size() - 1);
splitsComplete = lastComplete.getFinish();
}
if (!timephasedPlanned.isEmpty())
{
firstPlanned = timephasedPlanned.get(0);
}
LinkedList<DateRange> splits = new LinkedList<DateRange>();
TimephasedWork lastAssignment = null;
DateRange lastRange = null;
for (TimephasedWork assignment : timephasedComplete)
{
if (lastAssignment != null && lastRange != null && lastAssignment.getTotalAmount().getDuration() != 0 && assignment.getTotalAmount().getDuration() != 0)
{
splits.removeLast();
lastRange = new DateRange(lastRange.getStart(), assignment.getFinish());
}
else
{
lastRange = new DateRange(assignment.getStart(), assignment.getFinish());
}
splits.add(lastRange);
lastAssignment = assignment;
}
//
// We may not have a split, we may just have a partially
// complete split.
//
Date splitStart = null;
if (lastComplete != null && firstPlanned != null && lastComplete.getTotalAmount().getDuration() != 0 && firstPlanned.getTotalAmount().getDuration() != 0)
{
lastRange = splits.removeLast();
splitStart = lastRange.getStart();
}
lastAssignment = null;
lastRange = null;
for (TimephasedWork assignment : timephasedPlanned)
{
if (splitStart == null)
{
if (lastAssignment != null && lastRange != null && lastAssignment.getTotalAmount().getDuration() != 0 && assignment.getTotalAmount().getDuration() != 0)
{
splits.removeLast();
lastRange = new DateRange(lastRange.getStart(), assignment.getFinish());
}
else
{
lastRange = new DateRange(assignment.getStart(), assignment.getFinish());
}
}
else
{
lastRange = new DateRange(splitStart, assignment.getFinish());
}
splits.add(lastRange);
splitStart = null;
lastAssignment = assignment;
}
//
// We must have a minimum of 3 entries for this to be a valid split task
//
if (splits.size() > 2)
{
task.getSplits().addAll(splits);
task.setSplitCompleteDuration(splitsComplete);
}
else
{
task.setSplits(null);
task.setSplitCompleteDuration(null);
}
}
|
java
|
public void processSplitData(Task task, List<TimephasedWork> timephasedComplete, List<TimephasedWork> timephasedPlanned)
{
Date splitsComplete = null;
TimephasedWork lastComplete = null;
TimephasedWork firstPlanned = null;
if (!timephasedComplete.isEmpty())
{
lastComplete = timephasedComplete.get(timephasedComplete.size() - 1);
splitsComplete = lastComplete.getFinish();
}
if (!timephasedPlanned.isEmpty())
{
firstPlanned = timephasedPlanned.get(0);
}
LinkedList<DateRange> splits = new LinkedList<DateRange>();
TimephasedWork lastAssignment = null;
DateRange lastRange = null;
for (TimephasedWork assignment : timephasedComplete)
{
if (lastAssignment != null && lastRange != null && lastAssignment.getTotalAmount().getDuration() != 0 && assignment.getTotalAmount().getDuration() != 0)
{
splits.removeLast();
lastRange = new DateRange(lastRange.getStart(), assignment.getFinish());
}
else
{
lastRange = new DateRange(assignment.getStart(), assignment.getFinish());
}
splits.add(lastRange);
lastAssignment = assignment;
}
//
// We may not have a split, we may just have a partially
// complete split.
//
Date splitStart = null;
if (lastComplete != null && firstPlanned != null && lastComplete.getTotalAmount().getDuration() != 0 && firstPlanned.getTotalAmount().getDuration() != 0)
{
lastRange = splits.removeLast();
splitStart = lastRange.getStart();
}
lastAssignment = null;
lastRange = null;
for (TimephasedWork assignment : timephasedPlanned)
{
if (splitStart == null)
{
if (lastAssignment != null && lastRange != null && lastAssignment.getTotalAmount().getDuration() != 0 && assignment.getTotalAmount().getDuration() != 0)
{
splits.removeLast();
lastRange = new DateRange(lastRange.getStart(), assignment.getFinish());
}
else
{
lastRange = new DateRange(assignment.getStart(), assignment.getFinish());
}
}
else
{
lastRange = new DateRange(splitStart, assignment.getFinish());
}
splits.add(lastRange);
splitStart = null;
lastAssignment = assignment;
}
//
// We must have a minimum of 3 entries for this to be a valid split task
//
if (splits.size() > 2)
{
task.getSplits().addAll(splits);
task.setSplitCompleteDuration(splitsComplete);
}
else
{
task.setSplits(null);
task.setSplitCompleteDuration(null);
}
}
|
[
"public",
"void",
"processSplitData",
"(",
"Task",
"task",
",",
"List",
"<",
"TimephasedWork",
">",
"timephasedComplete",
",",
"List",
"<",
"TimephasedWork",
">",
"timephasedPlanned",
")",
"{",
"Date",
"splitsComplete",
"=",
"null",
";",
"TimephasedWork",
"lastComplete",
"=",
"null",
";",
"TimephasedWork",
"firstPlanned",
"=",
"null",
";",
"if",
"(",
"!",
"timephasedComplete",
".",
"isEmpty",
"(",
")",
")",
"{",
"lastComplete",
"=",
"timephasedComplete",
".",
"get",
"(",
"timephasedComplete",
".",
"size",
"(",
")",
"-",
"1",
")",
";",
"splitsComplete",
"=",
"lastComplete",
".",
"getFinish",
"(",
")",
";",
"}",
"if",
"(",
"!",
"timephasedPlanned",
".",
"isEmpty",
"(",
")",
")",
"{",
"firstPlanned",
"=",
"timephasedPlanned",
".",
"get",
"(",
"0",
")",
";",
"}",
"LinkedList",
"<",
"DateRange",
">",
"splits",
"=",
"new",
"LinkedList",
"<",
"DateRange",
">",
"(",
")",
";",
"TimephasedWork",
"lastAssignment",
"=",
"null",
";",
"DateRange",
"lastRange",
"=",
"null",
";",
"for",
"(",
"TimephasedWork",
"assignment",
":",
"timephasedComplete",
")",
"{",
"if",
"(",
"lastAssignment",
"!=",
"null",
"&&",
"lastRange",
"!=",
"null",
"&&",
"lastAssignment",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
"!=",
"0",
"&&",
"assignment",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
"!=",
"0",
")",
"{",
"splits",
".",
"removeLast",
"(",
")",
";",
"lastRange",
"=",
"new",
"DateRange",
"(",
"lastRange",
".",
"getStart",
"(",
")",
",",
"assignment",
".",
"getFinish",
"(",
")",
")",
";",
"}",
"else",
"{",
"lastRange",
"=",
"new",
"DateRange",
"(",
"assignment",
".",
"getStart",
"(",
")",
",",
"assignment",
".",
"getFinish",
"(",
")",
")",
";",
"}",
"splits",
".",
"add",
"(",
"lastRange",
")",
";",
"lastAssignment",
"=",
"assignment",
";",
"}",
"//",
"// We may not have a split, we may just have a partially",
"// complete split.",
"//",
"Date",
"splitStart",
"=",
"null",
";",
"if",
"(",
"lastComplete",
"!=",
"null",
"&&",
"firstPlanned",
"!=",
"null",
"&&",
"lastComplete",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
"!=",
"0",
"&&",
"firstPlanned",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
"!=",
"0",
")",
"{",
"lastRange",
"=",
"splits",
".",
"removeLast",
"(",
")",
";",
"splitStart",
"=",
"lastRange",
".",
"getStart",
"(",
")",
";",
"}",
"lastAssignment",
"=",
"null",
";",
"lastRange",
"=",
"null",
";",
"for",
"(",
"TimephasedWork",
"assignment",
":",
"timephasedPlanned",
")",
"{",
"if",
"(",
"splitStart",
"==",
"null",
")",
"{",
"if",
"(",
"lastAssignment",
"!=",
"null",
"&&",
"lastRange",
"!=",
"null",
"&&",
"lastAssignment",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
"!=",
"0",
"&&",
"assignment",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
"!=",
"0",
")",
"{",
"splits",
".",
"removeLast",
"(",
")",
";",
"lastRange",
"=",
"new",
"DateRange",
"(",
"lastRange",
".",
"getStart",
"(",
")",
",",
"assignment",
".",
"getFinish",
"(",
")",
")",
";",
"}",
"else",
"{",
"lastRange",
"=",
"new",
"DateRange",
"(",
"assignment",
".",
"getStart",
"(",
")",
",",
"assignment",
".",
"getFinish",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"lastRange",
"=",
"new",
"DateRange",
"(",
"splitStart",
",",
"assignment",
".",
"getFinish",
"(",
")",
")",
";",
"}",
"splits",
".",
"add",
"(",
"lastRange",
")",
";",
"splitStart",
"=",
"null",
";",
"lastAssignment",
"=",
"assignment",
";",
"}",
"//",
"// We must have a minimum of 3 entries for this to be a valid split task",
"//",
"if",
"(",
"splits",
".",
"size",
"(",
")",
">",
"2",
")",
"{",
"task",
".",
"getSplits",
"(",
")",
".",
"addAll",
"(",
"splits",
")",
";",
"task",
".",
"setSplitCompleteDuration",
"(",
"splitsComplete",
")",
";",
"}",
"else",
"{",
"task",
".",
"setSplits",
"(",
"null",
")",
";",
"task",
".",
"setSplitCompleteDuration",
"(",
"null",
")",
";",
"}",
"}"
] |
Process the timephased resource assignment data to work out the
split structure of the task.
@param task parent task
@param timephasedComplete completed resource assignment work
@param timephasedPlanned planned resource assignment work
|
[
"Process",
"the",
"timephased",
"resource",
"assignment",
"data",
"to",
"work",
"out",
"the",
"split",
"structure",
"of",
"the",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/common/SplitTaskFactory.java#L48-L131
|
157,324
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.updateScheduleSource
|
private void updateScheduleSource(ProjectProperties properties)
{
// Rudimentary identification of schedule source
if (properties.getCompany() != null && properties.getCompany().equals("Synchro Software Ltd"))
{
properties.setFileApplication("Synchro");
}
else
{
if (properties.getAuthor() != null && properties.getAuthor().equals("SG Project"))
{
properties.setFileApplication("Simple Genius");
}
else
{
properties.setFileApplication("Microsoft");
}
}
properties.setFileType("MSPDI");
}
|
java
|
private void updateScheduleSource(ProjectProperties properties)
{
// Rudimentary identification of schedule source
if (properties.getCompany() != null && properties.getCompany().equals("Synchro Software Ltd"))
{
properties.setFileApplication("Synchro");
}
else
{
if (properties.getAuthor() != null && properties.getAuthor().equals("SG Project"))
{
properties.setFileApplication("Simple Genius");
}
else
{
properties.setFileApplication("Microsoft");
}
}
properties.setFileType("MSPDI");
}
|
[
"private",
"void",
"updateScheduleSource",
"(",
"ProjectProperties",
"properties",
")",
"{",
"// Rudimentary identification of schedule source",
"if",
"(",
"properties",
".",
"getCompany",
"(",
")",
"!=",
"null",
"&&",
"properties",
".",
"getCompany",
"(",
")",
".",
"equals",
"(",
"\"Synchro Software Ltd\"",
")",
")",
"{",
"properties",
".",
"setFileApplication",
"(",
"\"Synchro\"",
")",
";",
"}",
"else",
"{",
"if",
"(",
"properties",
".",
"getAuthor",
"(",
")",
"!=",
"null",
"&&",
"properties",
".",
"getAuthor",
"(",
")",
".",
"equals",
"(",
"\"SG Project\"",
")",
")",
"{",
"properties",
".",
"setFileApplication",
"(",
"\"Simple Genius\"",
")",
";",
"}",
"else",
"{",
"properties",
".",
"setFileApplication",
"(",
"\"Microsoft\"",
")",
";",
"}",
"}",
"properties",
".",
"setFileType",
"(",
"\"MSPDI\"",
")",
";",
"}"
] |
Populate the properties indicating the source of this schedule.
@param properties project properties
|
[
"Populate",
"the",
"properties",
"indicating",
"the",
"source",
"of",
"this",
"schedule",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L357-L376
|
157,325
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readCalendars
|
private void readCalendars(Project project, HashMap<BigInteger, ProjectCalendar> map)
{
Project.Calendars calendars = project.getCalendars();
if (calendars != null)
{
LinkedList<Pair<ProjectCalendar, BigInteger>> baseCalendars = new LinkedList<Pair<ProjectCalendar, BigInteger>>();
for (Project.Calendars.Calendar cal : calendars.getCalendar())
{
readCalendar(cal, map, baseCalendars);
}
updateBaseCalendarNames(baseCalendars, map);
}
try
{
ProjectProperties properties = m_projectFile.getProjectProperties();
BigInteger calendarID = new BigInteger(properties.getDefaultCalendarName());
ProjectCalendar calendar = map.get(calendarID);
m_projectFile.setDefaultCalendar(calendar);
}
catch (Exception ex)
{
// Ignore exceptions
}
}
|
java
|
private void readCalendars(Project project, HashMap<BigInteger, ProjectCalendar> map)
{
Project.Calendars calendars = project.getCalendars();
if (calendars != null)
{
LinkedList<Pair<ProjectCalendar, BigInteger>> baseCalendars = new LinkedList<Pair<ProjectCalendar, BigInteger>>();
for (Project.Calendars.Calendar cal : calendars.getCalendar())
{
readCalendar(cal, map, baseCalendars);
}
updateBaseCalendarNames(baseCalendars, map);
}
try
{
ProjectProperties properties = m_projectFile.getProjectProperties();
BigInteger calendarID = new BigInteger(properties.getDefaultCalendarName());
ProjectCalendar calendar = map.get(calendarID);
m_projectFile.setDefaultCalendar(calendar);
}
catch (Exception ex)
{
// Ignore exceptions
}
}
|
[
"private",
"void",
"readCalendars",
"(",
"Project",
"project",
",",
"HashMap",
"<",
"BigInteger",
",",
"ProjectCalendar",
">",
"map",
")",
"{",
"Project",
".",
"Calendars",
"calendars",
"=",
"project",
".",
"getCalendars",
"(",
")",
";",
"if",
"(",
"calendars",
"!=",
"null",
")",
"{",
"LinkedList",
"<",
"Pair",
"<",
"ProjectCalendar",
",",
"BigInteger",
">",
">",
"baseCalendars",
"=",
"new",
"LinkedList",
"<",
"Pair",
"<",
"ProjectCalendar",
",",
"BigInteger",
">",
">",
"(",
")",
";",
"for",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"cal",
":",
"calendars",
".",
"getCalendar",
"(",
")",
")",
"{",
"readCalendar",
"(",
"cal",
",",
"map",
",",
"baseCalendars",
")",
";",
"}",
"updateBaseCalendarNames",
"(",
"baseCalendars",
",",
"map",
")",
";",
"}",
"try",
"{",
"ProjectProperties",
"properties",
"=",
"m_projectFile",
".",
"getProjectProperties",
"(",
")",
";",
"BigInteger",
"calendarID",
"=",
"new",
"BigInteger",
"(",
"properties",
".",
"getDefaultCalendarName",
"(",
")",
")",
";",
"ProjectCalendar",
"calendar",
"=",
"map",
".",
"get",
"(",
"calendarID",
")",
";",
"m_projectFile",
".",
"setDefaultCalendar",
"(",
"calendar",
")",
";",
"}",
"catch",
"(",
"Exception",
"ex",
")",
"{",
"// Ignore exceptions",
"}",
"}"
] |
This method extracts calendar data from an MSPDI file.
@param project Root node of the MSPDI file
@param map Map of calendar UIDs to names
|
[
"This",
"method",
"extracts",
"calendar",
"data",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L384-L409
|
157,326
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.updateBaseCalendarNames
|
private static void updateBaseCalendarNames(List<Pair<ProjectCalendar, BigInteger>> baseCalendars, HashMap<BigInteger, ProjectCalendar> map)
{
for (Pair<ProjectCalendar, BigInteger> pair : baseCalendars)
{
ProjectCalendar cal = pair.getFirst();
BigInteger baseCalendarID = pair.getSecond();
ProjectCalendar baseCal = map.get(baseCalendarID);
if (baseCal != null)
{
cal.setParent(baseCal);
}
}
}
|
java
|
private static void updateBaseCalendarNames(List<Pair<ProjectCalendar, BigInteger>> baseCalendars, HashMap<BigInteger, ProjectCalendar> map)
{
for (Pair<ProjectCalendar, BigInteger> pair : baseCalendars)
{
ProjectCalendar cal = pair.getFirst();
BigInteger baseCalendarID = pair.getSecond();
ProjectCalendar baseCal = map.get(baseCalendarID);
if (baseCal != null)
{
cal.setParent(baseCal);
}
}
}
|
[
"private",
"static",
"void",
"updateBaseCalendarNames",
"(",
"List",
"<",
"Pair",
"<",
"ProjectCalendar",
",",
"BigInteger",
">",
">",
"baseCalendars",
",",
"HashMap",
"<",
"BigInteger",
",",
"ProjectCalendar",
">",
"map",
")",
"{",
"for",
"(",
"Pair",
"<",
"ProjectCalendar",
",",
"BigInteger",
">",
"pair",
":",
"baseCalendars",
")",
"{",
"ProjectCalendar",
"cal",
"=",
"pair",
".",
"getFirst",
"(",
")",
";",
"BigInteger",
"baseCalendarID",
"=",
"pair",
".",
"getSecond",
"(",
")",
";",
"ProjectCalendar",
"baseCal",
"=",
"map",
".",
"get",
"(",
"baseCalendarID",
")",
";",
"if",
"(",
"baseCal",
"!=",
"null",
")",
"{",
"cal",
".",
"setParent",
"(",
"baseCal",
")",
";",
"}",
"}",
"}"
] |
The way calendars are stored in an MSPDI file means that there
can be forward references between the base calendar unique ID for a
derived calendar, and the base calendar itself. To get around this,
we initially populate the base calendar name attribute with the
base calendar unique ID, and now in this method we can convert those
ID values into the correct names.
@param baseCalendars list of calendars and base calendar IDs
@param map map of calendar ID values and calendar objects
|
[
"The",
"way",
"calendars",
"are",
"stored",
"in",
"an",
"MSPDI",
"file",
"means",
"that",
"there",
"can",
"be",
"forward",
"references",
"between",
"the",
"base",
"calendar",
"unique",
"ID",
"for",
"a",
"derived",
"calendar",
"and",
"the",
"base",
"calendar",
"itself",
".",
"To",
"get",
"around",
"this",
"we",
"initially",
"populate",
"the",
"base",
"calendar",
"name",
"attribute",
"with",
"the",
"base",
"calendar",
"unique",
"ID",
"and",
"now",
"in",
"this",
"method",
"we",
"can",
"convert",
"those",
"ID",
"values",
"into",
"the",
"correct",
"names",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L422-L435
|
157,327
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readCalendar
|
private void readCalendar(Project.Calendars.Calendar calendar, HashMap<BigInteger, ProjectCalendar> map, List<Pair<ProjectCalendar, BigInteger>> baseCalendars)
{
ProjectCalendar bc = m_projectFile.addCalendar();
bc.setUniqueID(NumberHelper.getInteger(calendar.getUID()));
bc.setName(calendar.getName());
BigInteger baseCalendarID = calendar.getBaseCalendarUID();
if (baseCalendarID != null)
{
baseCalendars.add(new Pair<ProjectCalendar, BigInteger>(bc, baseCalendarID));
}
readExceptions(calendar, bc);
boolean readExceptionsFromDays = bc.getCalendarExceptions().isEmpty();
Project.Calendars.Calendar.WeekDays days = calendar.getWeekDays();
if (days != null)
{
for (Project.Calendars.Calendar.WeekDays.WeekDay weekDay : days.getWeekDay())
{
readDay(bc, weekDay, readExceptionsFromDays);
}
}
else
{
bc.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.MONDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);
}
readWorkWeeks(calendar, bc);
map.put(calendar.getUID(), bc);
m_eventManager.fireCalendarReadEvent(bc);
}
|
java
|
private void readCalendar(Project.Calendars.Calendar calendar, HashMap<BigInteger, ProjectCalendar> map, List<Pair<ProjectCalendar, BigInteger>> baseCalendars)
{
ProjectCalendar bc = m_projectFile.addCalendar();
bc.setUniqueID(NumberHelper.getInteger(calendar.getUID()));
bc.setName(calendar.getName());
BigInteger baseCalendarID = calendar.getBaseCalendarUID();
if (baseCalendarID != null)
{
baseCalendars.add(new Pair<ProjectCalendar, BigInteger>(bc, baseCalendarID));
}
readExceptions(calendar, bc);
boolean readExceptionsFromDays = bc.getCalendarExceptions().isEmpty();
Project.Calendars.Calendar.WeekDays days = calendar.getWeekDays();
if (days != null)
{
for (Project.Calendars.Calendar.WeekDays.WeekDay weekDay : days.getWeekDay())
{
readDay(bc, weekDay, readExceptionsFromDays);
}
}
else
{
bc.setWorkingDay(Day.SUNDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.MONDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.TUESDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.WEDNESDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.THURSDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.FRIDAY, DayType.DEFAULT);
bc.setWorkingDay(Day.SATURDAY, DayType.DEFAULT);
}
readWorkWeeks(calendar, bc);
map.put(calendar.getUID(), bc);
m_eventManager.fireCalendarReadEvent(bc);
}
|
[
"private",
"void",
"readCalendar",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"calendar",
",",
"HashMap",
"<",
"BigInteger",
",",
"ProjectCalendar",
">",
"map",
",",
"List",
"<",
"Pair",
"<",
"ProjectCalendar",
",",
"BigInteger",
">",
">",
"baseCalendars",
")",
"{",
"ProjectCalendar",
"bc",
"=",
"m_projectFile",
".",
"addCalendar",
"(",
")",
";",
"bc",
".",
"setUniqueID",
"(",
"NumberHelper",
".",
"getInteger",
"(",
"calendar",
".",
"getUID",
"(",
")",
")",
")",
";",
"bc",
".",
"setName",
"(",
"calendar",
".",
"getName",
"(",
")",
")",
";",
"BigInteger",
"baseCalendarID",
"=",
"calendar",
".",
"getBaseCalendarUID",
"(",
")",
";",
"if",
"(",
"baseCalendarID",
"!=",
"null",
")",
"{",
"baseCalendars",
".",
"add",
"(",
"new",
"Pair",
"<",
"ProjectCalendar",
",",
"BigInteger",
">",
"(",
"bc",
",",
"baseCalendarID",
")",
")",
";",
"}",
"readExceptions",
"(",
"calendar",
",",
"bc",
")",
";",
"boolean",
"readExceptionsFromDays",
"=",
"bc",
".",
"getCalendarExceptions",
"(",
")",
".",
"isEmpty",
"(",
")",
";",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
"days",
"=",
"calendar",
".",
"getWeekDays",
"(",
")",
";",
"if",
"(",
"days",
"!=",
"null",
")",
"{",
"for",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
"weekDay",
":",
"days",
".",
"getWeekDay",
"(",
")",
")",
"{",
"readDay",
"(",
"bc",
",",
"weekDay",
",",
"readExceptionsFromDays",
")",
";",
"}",
"}",
"else",
"{",
"bc",
".",
"setWorkingDay",
"(",
"Day",
".",
"SUNDAY",
",",
"DayType",
".",
"DEFAULT",
")",
";",
"bc",
".",
"setWorkingDay",
"(",
"Day",
".",
"MONDAY",
",",
"DayType",
".",
"DEFAULT",
")",
";",
"bc",
".",
"setWorkingDay",
"(",
"Day",
".",
"TUESDAY",
",",
"DayType",
".",
"DEFAULT",
")",
";",
"bc",
".",
"setWorkingDay",
"(",
"Day",
".",
"WEDNESDAY",
",",
"DayType",
".",
"DEFAULT",
")",
";",
"bc",
".",
"setWorkingDay",
"(",
"Day",
".",
"THURSDAY",
",",
"DayType",
".",
"DEFAULT",
")",
";",
"bc",
".",
"setWorkingDay",
"(",
"Day",
".",
"FRIDAY",
",",
"DayType",
".",
"DEFAULT",
")",
";",
"bc",
".",
"setWorkingDay",
"(",
"Day",
".",
"SATURDAY",
",",
"DayType",
".",
"DEFAULT",
")",
";",
"}",
"readWorkWeeks",
"(",
"calendar",
",",
"bc",
")",
";",
"map",
".",
"put",
"(",
"calendar",
".",
"getUID",
"(",
")",
",",
"bc",
")",
";",
"m_eventManager",
".",
"fireCalendarReadEvent",
"(",
"bc",
")",
";",
"}"
] |
This method extracts data for a single calendar from an MSPDI file.
@param calendar Calendar data
@param map Map of calendar UIDs to names
@param baseCalendars list of base calendars
|
[
"This",
"method",
"extracts",
"data",
"for",
"a",
"single",
"calendar",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L444-L482
|
157,328
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readDay
|
private void readDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day, boolean readExceptionsFromDays)
{
BigInteger dayType = day.getDayType();
if (dayType != null)
{
if (dayType.intValue() == 0)
{
if (readExceptionsFromDays)
{
readExceptionDay(calendar, day);
}
}
else
{
readNormalDay(calendar, day);
}
}
}
|
java
|
private void readDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day, boolean readExceptionsFromDays)
{
BigInteger dayType = day.getDayType();
if (dayType != null)
{
if (dayType.intValue() == 0)
{
if (readExceptionsFromDays)
{
readExceptionDay(calendar, day);
}
}
else
{
readNormalDay(calendar, day);
}
}
}
|
[
"private",
"void",
"readDay",
"(",
"ProjectCalendar",
"calendar",
",",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
"day",
",",
"boolean",
"readExceptionsFromDays",
")",
"{",
"BigInteger",
"dayType",
"=",
"day",
".",
"getDayType",
"(",
")",
";",
"if",
"(",
"dayType",
"!=",
"null",
")",
"{",
"if",
"(",
"dayType",
".",
"intValue",
"(",
")",
"==",
"0",
")",
"{",
"if",
"(",
"readExceptionsFromDays",
")",
"{",
"readExceptionDay",
"(",
"calendar",
",",
"day",
")",
";",
"}",
"}",
"else",
"{",
"readNormalDay",
"(",
"calendar",
",",
"day",
")",
";",
"}",
"}",
"}"
] |
This method extracts data for a single day from an MSPDI file.
@param calendar Calendar data
@param day Day data
@param readExceptionsFromDays read exceptions form day definitions
|
[
"This",
"method",
"extracts",
"data",
"for",
"a",
"single",
"day",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L491-L508
|
157,329
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readNormalDay
|
private void readNormalDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay weekDay)
{
int dayNumber = weekDay.getDayType().intValue();
Day day = Day.getInstance(dayNumber);
calendar.setWorkingDay(day, BooleanHelper.getBoolean(weekDay.isDayWorking()));
ProjectCalendarHours hours = calendar.addCalendarHours(day);
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = weekDay.getWorkingTimes();
if (times != null)
{
for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime())
{
Date startTime = period.getFromTime();
Date endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
hours.addRange(new DateRange(startTime, endTime));
}
}
}
}
|
java
|
private void readNormalDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay weekDay)
{
int dayNumber = weekDay.getDayType().intValue();
Day day = Day.getInstance(dayNumber);
calendar.setWorkingDay(day, BooleanHelper.getBoolean(weekDay.isDayWorking()));
ProjectCalendarHours hours = calendar.addCalendarHours(day);
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = weekDay.getWorkingTimes();
if (times != null)
{
for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime())
{
Date startTime = period.getFromTime();
Date endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
hours.addRange(new DateRange(startTime, endTime));
}
}
}
}
|
[
"private",
"void",
"readNormalDay",
"(",
"ProjectCalendar",
"calendar",
",",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
"weekDay",
")",
"{",
"int",
"dayNumber",
"=",
"weekDay",
".",
"getDayType",
"(",
")",
".",
"intValue",
"(",
")",
";",
"Day",
"day",
"=",
"Day",
".",
"getInstance",
"(",
"dayNumber",
")",
";",
"calendar",
".",
"setWorkingDay",
"(",
"day",
",",
"BooleanHelper",
".",
"getBoolean",
"(",
"weekDay",
".",
"isDayWorking",
"(",
")",
")",
")",
";",
"ProjectCalendarHours",
"hours",
"=",
"calendar",
".",
"addCalendarHours",
"(",
"day",
")",
";",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
"times",
"=",
"weekDay",
".",
"getWorkingTimes",
"(",
")",
";",
"if",
"(",
"times",
"!=",
"null",
")",
"{",
"for",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
".",
"WorkingTime",
"period",
":",
"times",
".",
"getWorkingTime",
"(",
")",
")",
"{",
"Date",
"startTime",
"=",
"period",
".",
"getFromTime",
"(",
")",
";",
"Date",
"endTime",
"=",
"period",
".",
"getToTime",
"(",
")",
";",
"if",
"(",
"startTime",
"!=",
"null",
"&&",
"endTime",
"!=",
"null",
")",
"{",
"if",
"(",
"startTime",
".",
"getTime",
"(",
")",
">=",
"endTime",
".",
"getTime",
"(",
")",
")",
"{",
"endTime",
"=",
"DateHelper",
".",
"addDays",
"(",
"endTime",
",",
"1",
")",
";",
"}",
"hours",
".",
"addRange",
"(",
"new",
"DateRange",
"(",
"startTime",
",",
"endTime",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
This method extracts data for a normal working day from an MSPDI file.
@param calendar Calendar data
@param weekDay Day data
|
[
"This",
"method",
"extracts",
"data",
"for",
"a",
"normal",
"working",
"day",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L516-L542
|
157,330
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readExceptionDay
|
private void readExceptionDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day)
{
Project.Calendars.Calendar.WeekDays.WeekDay.TimePeriod timePeriod = day.getTimePeriod();
Date fromDate = timePeriod.getFromDate();
Date toDate = timePeriod.getToDate();
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = day.getWorkingTimes();
ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate);
if (times != null)
{
List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> time = times.getWorkingTime();
for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : time)
{
Date startTime = period.getFromTime();
Date endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
exception.addRange(new DateRange(startTime, endTime));
}
}
}
}
|
java
|
private void readExceptionDay(ProjectCalendar calendar, Project.Calendars.Calendar.WeekDays.WeekDay day)
{
Project.Calendars.Calendar.WeekDays.WeekDay.TimePeriod timePeriod = day.getTimePeriod();
Date fromDate = timePeriod.getFromDate();
Date toDate = timePeriod.getToDate();
Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes times = day.getWorkingTimes();
ProjectCalendarException exception = calendar.addCalendarException(fromDate, toDate);
if (times != null)
{
List<Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime> time = times.getWorkingTime();
for (Project.Calendars.Calendar.WeekDays.WeekDay.WorkingTimes.WorkingTime period : time)
{
Date startTime = period.getFromTime();
Date endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
exception.addRange(new DateRange(startTime, endTime));
}
}
}
}
|
[
"private",
"void",
"readExceptionDay",
"(",
"ProjectCalendar",
"calendar",
",",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
"day",
")",
"{",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
".",
"TimePeriod",
"timePeriod",
"=",
"day",
".",
"getTimePeriod",
"(",
")",
";",
"Date",
"fromDate",
"=",
"timePeriod",
".",
"getFromDate",
"(",
")",
";",
"Date",
"toDate",
"=",
"timePeriod",
".",
"getToDate",
"(",
")",
";",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
"times",
"=",
"day",
".",
"getWorkingTimes",
"(",
")",
";",
"ProjectCalendarException",
"exception",
"=",
"calendar",
".",
"addCalendarException",
"(",
"fromDate",
",",
"toDate",
")",
";",
"if",
"(",
"times",
"!=",
"null",
")",
"{",
"List",
"<",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
".",
"WorkingTime",
">",
"time",
"=",
"times",
".",
"getWorkingTime",
"(",
")",
";",
"for",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
".",
"WorkingTime",
"period",
":",
"time",
")",
"{",
"Date",
"startTime",
"=",
"period",
".",
"getFromTime",
"(",
")",
";",
"Date",
"endTime",
"=",
"period",
".",
"getToTime",
"(",
")",
";",
"if",
"(",
"startTime",
"!=",
"null",
"&&",
"endTime",
"!=",
"null",
")",
"{",
"if",
"(",
"startTime",
".",
"getTime",
"(",
")",
">=",
"endTime",
".",
"getTime",
"(",
")",
")",
"{",
"endTime",
"=",
"DateHelper",
".",
"addDays",
"(",
"endTime",
",",
"1",
")",
";",
"}",
"exception",
".",
"addRange",
"(",
"new",
"DateRange",
"(",
"startTime",
",",
"endTime",
")",
")",
";",
"}",
"}",
"}",
"}"
] |
This method extracts data for an exception day from an MSPDI file.
@param calendar Calendar data
@param day Day data
|
[
"This",
"method",
"extracts",
"data",
"for",
"an",
"exception",
"day",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L550-L577
|
157,331
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readExceptions
|
private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc)
{
Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions();
if (exceptions != null)
{
for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException())
{
readException(bc, exception);
}
}
}
|
java
|
private void readExceptions(Project.Calendars.Calendar calendar, ProjectCalendar bc)
{
Project.Calendars.Calendar.Exceptions exceptions = calendar.getExceptions();
if (exceptions != null)
{
for (Project.Calendars.Calendar.Exceptions.Exception exception : exceptions.getException())
{
readException(bc, exception);
}
}
}
|
[
"private",
"void",
"readExceptions",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"calendar",
",",
"ProjectCalendar",
"bc",
")",
"{",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
"exceptions",
"=",
"calendar",
".",
"getExceptions",
"(",
")",
";",
"if",
"(",
"exceptions",
"!=",
"null",
")",
"{",
"for",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
".",
"Exception",
"exception",
":",
"exceptions",
".",
"getException",
"(",
")",
")",
"{",
"readException",
"(",
"bc",
",",
"exception",
")",
";",
"}",
"}",
"}"
] |
Reads any exceptions present in the file. This is only used in MSPDI
file versions saved by Project 2007 and later.
@param calendar XML calendar
@param bc MPXJ calendar
|
[
"Reads",
"any",
"exceptions",
"present",
"in",
"the",
"file",
".",
"This",
"is",
"only",
"used",
"in",
"MSPDI",
"file",
"versions",
"saved",
"by",
"Project",
"2007",
"and",
"later",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L586-L596
|
157,332
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readException
|
private void readException(ProjectCalendar bc, Project.Calendars.Calendar.Exceptions.Exception exception)
{
Date fromDate = exception.getTimePeriod().getFromDate();
Date toDate = exception.getTimePeriod().getToDate();
// Vico Schedule Planner seems to write start and end dates to FromTime and ToTime
// rather than FromDate and ToDate. This is plain wrong, and appears to be ignored by MS Project
// so we will ignore it too!
if (fromDate != null && toDate != null)
{
ProjectCalendarException bce = bc.addCalendarException(fromDate, toDate);
bce.setName(exception.getName());
readRecurringData(bce, exception);
Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = exception.getWorkingTimes();
if (times != null)
{
List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> time = times.getWorkingTime();
for (Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime period : time)
{
Date startTime = period.getFromTime();
Date endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
bce.addRange(new DateRange(startTime, endTime));
}
}
}
}
}
|
java
|
private void readException(ProjectCalendar bc, Project.Calendars.Calendar.Exceptions.Exception exception)
{
Date fromDate = exception.getTimePeriod().getFromDate();
Date toDate = exception.getTimePeriod().getToDate();
// Vico Schedule Planner seems to write start and end dates to FromTime and ToTime
// rather than FromDate and ToDate. This is plain wrong, and appears to be ignored by MS Project
// so we will ignore it too!
if (fromDate != null && toDate != null)
{
ProjectCalendarException bce = bc.addCalendarException(fromDate, toDate);
bce.setName(exception.getName());
readRecurringData(bce, exception);
Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes times = exception.getWorkingTimes();
if (times != null)
{
List<Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime> time = times.getWorkingTime();
for (Project.Calendars.Calendar.Exceptions.Exception.WorkingTimes.WorkingTime period : time)
{
Date startTime = period.getFromTime();
Date endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
bce.addRange(new DateRange(startTime, endTime));
}
}
}
}
}
|
[
"private",
"void",
"readException",
"(",
"ProjectCalendar",
"bc",
",",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
".",
"Exception",
"exception",
")",
"{",
"Date",
"fromDate",
"=",
"exception",
".",
"getTimePeriod",
"(",
")",
".",
"getFromDate",
"(",
")",
";",
"Date",
"toDate",
"=",
"exception",
".",
"getTimePeriod",
"(",
")",
".",
"getToDate",
"(",
")",
";",
"// Vico Schedule Planner seems to write start and end dates to FromTime and ToTime",
"// rather than FromDate and ToDate. This is plain wrong, and appears to be ignored by MS Project",
"// so we will ignore it too!",
"if",
"(",
"fromDate",
"!=",
"null",
"&&",
"toDate",
"!=",
"null",
")",
"{",
"ProjectCalendarException",
"bce",
"=",
"bc",
".",
"addCalendarException",
"(",
"fromDate",
",",
"toDate",
")",
";",
"bce",
".",
"setName",
"(",
"exception",
".",
"getName",
"(",
")",
")",
";",
"readRecurringData",
"(",
"bce",
",",
"exception",
")",
";",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
".",
"Exception",
".",
"WorkingTimes",
"times",
"=",
"exception",
".",
"getWorkingTimes",
"(",
")",
";",
"if",
"(",
"times",
"!=",
"null",
")",
"{",
"List",
"<",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
".",
"Exception",
".",
"WorkingTimes",
".",
"WorkingTime",
">",
"time",
"=",
"times",
".",
"getWorkingTime",
"(",
")",
";",
"for",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
".",
"Exception",
".",
"WorkingTimes",
".",
"WorkingTime",
"period",
":",
"time",
")",
"{",
"Date",
"startTime",
"=",
"period",
".",
"getFromTime",
"(",
")",
";",
"Date",
"endTime",
"=",
"period",
".",
"getToTime",
"(",
")",
";",
"if",
"(",
"startTime",
"!=",
"null",
"&&",
"endTime",
"!=",
"null",
")",
"{",
"if",
"(",
"startTime",
".",
"getTime",
"(",
")",
">=",
"endTime",
".",
"getTime",
"(",
")",
")",
"{",
"endTime",
"=",
"DateHelper",
".",
"addDays",
"(",
"endTime",
",",
"1",
")",
";",
"}",
"bce",
".",
"addRange",
"(",
"new",
"DateRange",
"(",
"startTime",
",",
"endTime",
")",
")",
";",
"}",
"}",
"}",
"}",
"}"
] |
Read a single calendar exception.
@param bc parent calendar
@param exception exception data
|
[
"Read",
"a",
"single",
"calendar",
"exception",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L604-L638
|
157,333
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readRecurringData
|
private void readRecurringData(ProjectCalendarException bce, Project.Calendars.Calendar.Exceptions.Exception exception)
{
RecurrenceType rt = getRecurrenceType(NumberHelper.getInt(exception.getType()));
if (rt != null)
{
RecurringData rd = new RecurringData();
rd.setStartDate(bce.getFromDate());
rd.setFinishDate(bce.getToDate());
rd.setRecurrenceType(rt);
rd.setRelative(getRelative(NumberHelper.getInt(exception.getType())));
rd.setOccurrences(NumberHelper.getInteger(exception.getOccurrences()));
switch (rd.getRecurrenceType())
{
case DAILY:
{
rd.setFrequency(getFrequency(exception));
break;
}
case WEEKLY:
{
rd.setWeeklyDaysFromBitmap(NumberHelper.getInteger(exception.getDaysOfWeek()), DAY_MASKS);
rd.setFrequency(getFrequency(exception));
break;
}
case MONTHLY:
{
if (rd.getRelative())
{
rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2));
rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1));
}
else
{
rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay()));
}
rd.setFrequency(getFrequency(exception));
break;
}
case YEARLY:
{
if (rd.getRelative())
{
rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2));
rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1));
}
else
{
rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay()));
}
rd.setMonthNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonth()) + 1));
break;
}
}
if (rd.getRecurrenceType() != RecurrenceType.DAILY || rd.getDates().length > 1)
{
bce.setRecurring(rd);
}
}
}
|
java
|
private void readRecurringData(ProjectCalendarException bce, Project.Calendars.Calendar.Exceptions.Exception exception)
{
RecurrenceType rt = getRecurrenceType(NumberHelper.getInt(exception.getType()));
if (rt != null)
{
RecurringData rd = new RecurringData();
rd.setStartDate(bce.getFromDate());
rd.setFinishDate(bce.getToDate());
rd.setRecurrenceType(rt);
rd.setRelative(getRelative(NumberHelper.getInt(exception.getType())));
rd.setOccurrences(NumberHelper.getInteger(exception.getOccurrences()));
switch (rd.getRecurrenceType())
{
case DAILY:
{
rd.setFrequency(getFrequency(exception));
break;
}
case WEEKLY:
{
rd.setWeeklyDaysFromBitmap(NumberHelper.getInteger(exception.getDaysOfWeek()), DAY_MASKS);
rd.setFrequency(getFrequency(exception));
break;
}
case MONTHLY:
{
if (rd.getRelative())
{
rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2));
rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1));
}
else
{
rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay()));
}
rd.setFrequency(getFrequency(exception));
break;
}
case YEARLY:
{
if (rd.getRelative())
{
rd.setDayOfWeek(Day.getInstance(NumberHelper.getInt(exception.getMonthItem()) - 2));
rd.setDayNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonthPosition()) + 1));
}
else
{
rd.setDayNumber(NumberHelper.getInteger(exception.getMonthDay()));
}
rd.setMonthNumber(Integer.valueOf(NumberHelper.getInt(exception.getMonth()) + 1));
break;
}
}
if (rd.getRecurrenceType() != RecurrenceType.DAILY || rd.getDates().length > 1)
{
bce.setRecurring(rd);
}
}
}
|
[
"private",
"void",
"readRecurringData",
"(",
"ProjectCalendarException",
"bce",
",",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
".",
"Exception",
"exception",
")",
"{",
"RecurrenceType",
"rt",
"=",
"getRecurrenceType",
"(",
"NumberHelper",
".",
"getInt",
"(",
"exception",
".",
"getType",
"(",
")",
")",
")",
";",
"if",
"(",
"rt",
"!=",
"null",
")",
"{",
"RecurringData",
"rd",
"=",
"new",
"RecurringData",
"(",
")",
";",
"rd",
".",
"setStartDate",
"(",
"bce",
".",
"getFromDate",
"(",
")",
")",
";",
"rd",
".",
"setFinishDate",
"(",
"bce",
".",
"getToDate",
"(",
")",
")",
";",
"rd",
".",
"setRecurrenceType",
"(",
"rt",
")",
";",
"rd",
".",
"setRelative",
"(",
"getRelative",
"(",
"NumberHelper",
".",
"getInt",
"(",
"exception",
".",
"getType",
"(",
")",
")",
")",
")",
";",
"rd",
".",
"setOccurrences",
"(",
"NumberHelper",
".",
"getInteger",
"(",
"exception",
".",
"getOccurrences",
"(",
")",
")",
")",
";",
"switch",
"(",
"rd",
".",
"getRecurrenceType",
"(",
")",
")",
"{",
"case",
"DAILY",
":",
"{",
"rd",
".",
"setFrequency",
"(",
"getFrequency",
"(",
"exception",
")",
")",
";",
"break",
";",
"}",
"case",
"WEEKLY",
":",
"{",
"rd",
".",
"setWeeklyDaysFromBitmap",
"(",
"NumberHelper",
".",
"getInteger",
"(",
"exception",
".",
"getDaysOfWeek",
"(",
")",
")",
",",
"DAY_MASKS",
")",
";",
"rd",
".",
"setFrequency",
"(",
"getFrequency",
"(",
"exception",
")",
")",
";",
"break",
";",
"}",
"case",
"MONTHLY",
":",
"{",
"if",
"(",
"rd",
".",
"getRelative",
"(",
")",
")",
"{",
"rd",
".",
"setDayOfWeek",
"(",
"Day",
".",
"getInstance",
"(",
"NumberHelper",
".",
"getInt",
"(",
"exception",
".",
"getMonthItem",
"(",
")",
")",
"-",
"2",
")",
")",
";",
"rd",
".",
"setDayNumber",
"(",
"Integer",
".",
"valueOf",
"(",
"NumberHelper",
".",
"getInt",
"(",
"exception",
".",
"getMonthPosition",
"(",
")",
")",
"+",
"1",
")",
")",
";",
"}",
"else",
"{",
"rd",
".",
"setDayNumber",
"(",
"NumberHelper",
".",
"getInteger",
"(",
"exception",
".",
"getMonthDay",
"(",
")",
")",
")",
";",
"}",
"rd",
".",
"setFrequency",
"(",
"getFrequency",
"(",
"exception",
")",
")",
";",
"break",
";",
"}",
"case",
"YEARLY",
":",
"{",
"if",
"(",
"rd",
".",
"getRelative",
"(",
")",
")",
"{",
"rd",
".",
"setDayOfWeek",
"(",
"Day",
".",
"getInstance",
"(",
"NumberHelper",
".",
"getInt",
"(",
"exception",
".",
"getMonthItem",
"(",
")",
")",
"-",
"2",
")",
")",
";",
"rd",
".",
"setDayNumber",
"(",
"Integer",
".",
"valueOf",
"(",
"NumberHelper",
".",
"getInt",
"(",
"exception",
".",
"getMonthPosition",
"(",
")",
")",
"+",
"1",
")",
")",
";",
"}",
"else",
"{",
"rd",
".",
"setDayNumber",
"(",
"NumberHelper",
".",
"getInteger",
"(",
"exception",
".",
"getMonthDay",
"(",
")",
")",
")",
";",
"}",
"rd",
".",
"setMonthNumber",
"(",
"Integer",
".",
"valueOf",
"(",
"NumberHelper",
".",
"getInt",
"(",
"exception",
".",
"getMonth",
"(",
")",
")",
"+",
"1",
")",
")",
";",
"break",
";",
"}",
"}",
"if",
"(",
"rd",
".",
"getRecurrenceType",
"(",
")",
"!=",
"RecurrenceType",
".",
"DAILY",
"||",
"rd",
".",
"getDates",
"(",
")",
".",
"length",
">",
"1",
")",
"{",
"bce",
".",
"setRecurring",
"(",
"rd",
")",
";",
"}",
"}",
"}"
] |
Read recurring data for a calendar exception.
@param bce MPXJ calendar exception
@param exception XML calendar exception
|
[
"Read",
"recurring",
"data",
"for",
"a",
"calendar",
"exception",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L646-L709
|
157,334
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.getFrequency
|
private Integer getFrequency(Project.Calendars.Calendar.Exceptions.Exception exception)
{
Integer period = NumberHelper.getInteger(exception.getPeriod());
if (period == null)
{
period = Integer.valueOf(1);
}
return period;
}
|
java
|
private Integer getFrequency(Project.Calendars.Calendar.Exceptions.Exception exception)
{
Integer period = NumberHelper.getInteger(exception.getPeriod());
if (period == null)
{
period = Integer.valueOf(1);
}
return period;
}
|
[
"private",
"Integer",
"getFrequency",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"Exceptions",
".",
"Exception",
"exception",
")",
"{",
"Integer",
"period",
"=",
"NumberHelper",
".",
"getInteger",
"(",
"exception",
".",
"getPeriod",
"(",
")",
")",
";",
"if",
"(",
"period",
"==",
"null",
")",
"{",
"period",
"=",
"Integer",
".",
"valueOf",
"(",
"1",
")",
";",
"}",
"return",
"period",
";",
"}"
] |
Retrieve the frequency of an exception.
@param exception XML calendar exception
@return frequency
|
[
"Retrieve",
"the",
"frequency",
"of",
"an",
"exception",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L759-L767
|
157,335
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readWorkWeeks
|
private void readWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar)
{
WorkWeeks ww = xmlCalendar.getWorkWeeks();
if (ww != null)
{
for (WorkWeek xmlWeek : ww.getWorkWeek())
{
ProjectCalendarWeek week = mpxjCalendar.addWorkWeek();
week.setName(xmlWeek.getName());
Date startTime = xmlWeek.getTimePeriod().getFromDate();
Date endTime = xmlWeek.getTimePeriod().getToDate();
week.setDateRange(new DateRange(startTime, endTime));
WeekDays xmlWeekDays = xmlWeek.getWeekDays();
if (xmlWeekDays != null)
{
for (WeekDay xmlWeekDay : xmlWeekDays.getWeekDay())
{
int dayNumber = xmlWeekDay.getDayType().intValue();
Day day = Day.getInstance(dayNumber);
week.setWorkingDay(day, BooleanHelper.getBoolean(xmlWeekDay.isDayWorking()));
ProjectCalendarHours hours = week.addCalendarHours(day);
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = xmlWeekDay.getWorkingTimes();
if (times != null)
{
for (Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime())
{
startTime = period.getFromTime();
endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
hours.addRange(new DateRange(startTime, endTime));
}
}
}
}
}
}
}
}
|
java
|
private void readWorkWeeks(Project.Calendars.Calendar xmlCalendar, ProjectCalendar mpxjCalendar)
{
WorkWeeks ww = xmlCalendar.getWorkWeeks();
if (ww != null)
{
for (WorkWeek xmlWeek : ww.getWorkWeek())
{
ProjectCalendarWeek week = mpxjCalendar.addWorkWeek();
week.setName(xmlWeek.getName());
Date startTime = xmlWeek.getTimePeriod().getFromDate();
Date endTime = xmlWeek.getTimePeriod().getToDate();
week.setDateRange(new DateRange(startTime, endTime));
WeekDays xmlWeekDays = xmlWeek.getWeekDays();
if (xmlWeekDays != null)
{
for (WeekDay xmlWeekDay : xmlWeekDays.getWeekDay())
{
int dayNumber = xmlWeekDay.getDayType().intValue();
Day day = Day.getInstance(dayNumber);
week.setWorkingDay(day, BooleanHelper.getBoolean(xmlWeekDay.isDayWorking()));
ProjectCalendarHours hours = week.addCalendarHours(day);
Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes times = xmlWeekDay.getWorkingTimes();
if (times != null)
{
for (Project.Calendars.Calendar.WorkWeeks.WorkWeek.WeekDays.WeekDay.WorkingTimes.WorkingTime period : times.getWorkingTime())
{
startTime = period.getFromTime();
endTime = period.getToTime();
if (startTime != null && endTime != null)
{
if (startTime.getTime() >= endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
hours.addRange(new DateRange(startTime, endTime));
}
}
}
}
}
}
}
}
|
[
"private",
"void",
"readWorkWeeks",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
"xmlCalendar",
",",
"ProjectCalendar",
"mpxjCalendar",
")",
"{",
"WorkWeeks",
"ww",
"=",
"xmlCalendar",
".",
"getWorkWeeks",
"(",
")",
";",
"if",
"(",
"ww",
"!=",
"null",
")",
"{",
"for",
"(",
"WorkWeek",
"xmlWeek",
":",
"ww",
".",
"getWorkWeek",
"(",
")",
")",
"{",
"ProjectCalendarWeek",
"week",
"=",
"mpxjCalendar",
".",
"addWorkWeek",
"(",
")",
";",
"week",
".",
"setName",
"(",
"xmlWeek",
".",
"getName",
"(",
")",
")",
";",
"Date",
"startTime",
"=",
"xmlWeek",
".",
"getTimePeriod",
"(",
")",
".",
"getFromDate",
"(",
")",
";",
"Date",
"endTime",
"=",
"xmlWeek",
".",
"getTimePeriod",
"(",
")",
".",
"getToDate",
"(",
")",
";",
"week",
".",
"setDateRange",
"(",
"new",
"DateRange",
"(",
"startTime",
",",
"endTime",
")",
")",
";",
"WeekDays",
"xmlWeekDays",
"=",
"xmlWeek",
".",
"getWeekDays",
"(",
")",
";",
"if",
"(",
"xmlWeekDays",
"!=",
"null",
")",
"{",
"for",
"(",
"WeekDay",
"xmlWeekDay",
":",
"xmlWeekDays",
".",
"getWeekDay",
"(",
")",
")",
"{",
"int",
"dayNumber",
"=",
"xmlWeekDay",
".",
"getDayType",
"(",
")",
".",
"intValue",
"(",
")",
";",
"Day",
"day",
"=",
"Day",
".",
"getInstance",
"(",
"dayNumber",
")",
";",
"week",
".",
"setWorkingDay",
"(",
"day",
",",
"BooleanHelper",
".",
"getBoolean",
"(",
"xmlWeekDay",
".",
"isDayWorking",
"(",
")",
")",
")",
";",
"ProjectCalendarHours",
"hours",
"=",
"week",
".",
"addCalendarHours",
"(",
"day",
")",
";",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WorkWeeks",
".",
"WorkWeek",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
"times",
"=",
"xmlWeekDay",
".",
"getWorkingTimes",
"(",
")",
";",
"if",
"(",
"times",
"!=",
"null",
")",
"{",
"for",
"(",
"Project",
".",
"Calendars",
".",
"Calendar",
".",
"WorkWeeks",
".",
"WorkWeek",
".",
"WeekDays",
".",
"WeekDay",
".",
"WorkingTimes",
".",
"WorkingTime",
"period",
":",
"times",
".",
"getWorkingTime",
"(",
")",
")",
"{",
"startTime",
"=",
"period",
".",
"getFromTime",
"(",
")",
";",
"endTime",
"=",
"period",
".",
"getToTime",
"(",
")",
";",
"if",
"(",
"startTime",
"!=",
"null",
"&&",
"endTime",
"!=",
"null",
")",
"{",
"if",
"(",
"startTime",
".",
"getTime",
"(",
")",
">=",
"endTime",
".",
"getTime",
"(",
")",
")",
"{",
"endTime",
"=",
"DateHelper",
".",
"addDays",
"(",
"endTime",
",",
"1",
")",
";",
"}",
"hours",
".",
"addRange",
"(",
"new",
"DateRange",
"(",
"startTime",
",",
"endTime",
")",
")",
";",
"}",
"}",
"}",
"}",
"}",
"}",
"}",
"}"
] |
Read the work weeks associated with this calendar.
@param xmlCalendar XML calendar object
@param mpxjCalendar MPXJ calendar object
|
[
"Read",
"the",
"work",
"weeks",
"associated",
"with",
"this",
"calendar",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L775-L821
|
157,336
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readProjectExtendedAttributes
|
private void readProjectExtendedAttributes(Project project)
{
Project.ExtendedAttributes attributes = project.getExtendedAttributes();
if (attributes != null)
{
for (Project.ExtendedAttributes.ExtendedAttribute ea : attributes.getExtendedAttribute())
{
readFieldAlias(ea);
}
}
}
|
java
|
private void readProjectExtendedAttributes(Project project)
{
Project.ExtendedAttributes attributes = project.getExtendedAttributes();
if (attributes != null)
{
for (Project.ExtendedAttributes.ExtendedAttribute ea : attributes.getExtendedAttribute())
{
readFieldAlias(ea);
}
}
}
|
[
"private",
"void",
"readProjectExtendedAttributes",
"(",
"Project",
"project",
")",
"{",
"Project",
".",
"ExtendedAttributes",
"attributes",
"=",
"project",
".",
"getExtendedAttributes",
"(",
")",
";",
"if",
"(",
"attributes",
"!=",
"null",
")",
"{",
"for",
"(",
"Project",
".",
"ExtendedAttributes",
".",
"ExtendedAttribute",
"ea",
":",
"attributes",
".",
"getExtendedAttribute",
"(",
")",
")",
"{",
"readFieldAlias",
"(",
"ea",
")",
";",
"}",
"}",
"}"
] |
This method extracts project extended attribute data from an MSPDI file.
@param project Root node of the MSPDI file
|
[
"This",
"method",
"extracts",
"project",
"extended",
"attribute",
"data",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L828-L838
|
157,337
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readFieldAlias
|
private void readFieldAlias(Project.ExtendedAttributes.ExtendedAttribute attribute)
{
String alias = attribute.getAlias();
if (alias != null && alias.length() != 0)
{
FieldType field = FieldTypeHelper.getInstance(Integer.parseInt(attribute.getFieldID()));
m_projectFile.getCustomFields().getCustomField(field).setAlias(attribute.getAlias());
}
}
|
java
|
private void readFieldAlias(Project.ExtendedAttributes.ExtendedAttribute attribute)
{
String alias = attribute.getAlias();
if (alias != null && alias.length() != 0)
{
FieldType field = FieldTypeHelper.getInstance(Integer.parseInt(attribute.getFieldID()));
m_projectFile.getCustomFields().getCustomField(field).setAlias(attribute.getAlias());
}
}
|
[
"private",
"void",
"readFieldAlias",
"(",
"Project",
".",
"ExtendedAttributes",
".",
"ExtendedAttribute",
"attribute",
")",
"{",
"String",
"alias",
"=",
"attribute",
".",
"getAlias",
"(",
")",
";",
"if",
"(",
"alias",
"!=",
"null",
"&&",
"alias",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"FieldType",
"field",
"=",
"FieldTypeHelper",
".",
"getInstance",
"(",
"Integer",
".",
"parseInt",
"(",
"attribute",
".",
"getFieldID",
"(",
")",
")",
")",
";",
"m_projectFile",
".",
"getCustomFields",
"(",
")",
".",
"getCustomField",
"(",
"field",
")",
".",
"setAlias",
"(",
"attribute",
".",
"getAlias",
"(",
")",
")",
";",
"}",
"}"
] |
Read a single field alias from an extended attribute.
@param attribute extended attribute
|
[
"Read",
"a",
"single",
"field",
"alias",
"from",
"an",
"extended",
"attribute",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L845-L853
|
157,338
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readResources
|
private void readResources(Project project, HashMap<BigInteger, ProjectCalendar> calendarMap)
{
Project.Resources resources = project.getResources();
if (resources != null)
{
for (Project.Resources.Resource resource : resources.getResource())
{
readResource(resource, calendarMap);
}
}
}
|
java
|
private void readResources(Project project, HashMap<BigInteger, ProjectCalendar> calendarMap)
{
Project.Resources resources = project.getResources();
if (resources != null)
{
for (Project.Resources.Resource resource : resources.getResource())
{
readResource(resource, calendarMap);
}
}
}
|
[
"private",
"void",
"readResources",
"(",
"Project",
"project",
",",
"HashMap",
"<",
"BigInteger",
",",
"ProjectCalendar",
">",
"calendarMap",
")",
"{",
"Project",
".",
"Resources",
"resources",
"=",
"project",
".",
"getResources",
"(",
")",
";",
"if",
"(",
"resources",
"!=",
"null",
")",
"{",
"for",
"(",
"Project",
".",
"Resources",
".",
"Resource",
"resource",
":",
"resources",
".",
"getResource",
"(",
")",
")",
"{",
"readResource",
"(",
"resource",
",",
"calendarMap",
")",
";",
"}",
"}",
"}"
] |
This method extracts resource data from an MSPDI file.
@param project Root node of the MSPDI file
@param calendarMap Map of calendar UIDs to names
|
[
"This",
"method",
"extracts",
"resource",
"data",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L861-L871
|
157,339
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readResourceBaselines
|
private void readResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource)
{
for (Project.Resources.Resource.Baseline baseline : xmlResource.getBaseline())
{
int number = NumberHelper.getInt(baseline.getNumber());
Double cost = DatatypeConverter.parseCurrency(baseline.getCost());
Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());
if (number == 0)
{
mpxjResource.setBaselineCost(cost);
mpxjResource.setBaselineWork(work);
}
else
{
mpxjResource.setBaselineCost(number, cost);
mpxjResource.setBaselineWork(number, work);
}
}
}
|
java
|
private void readResourceBaselines(Project.Resources.Resource xmlResource, Resource mpxjResource)
{
for (Project.Resources.Resource.Baseline baseline : xmlResource.getBaseline())
{
int number = NumberHelper.getInt(baseline.getNumber());
Double cost = DatatypeConverter.parseCurrency(baseline.getCost());
Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());
if (number == 0)
{
mpxjResource.setBaselineCost(cost);
mpxjResource.setBaselineWork(work);
}
else
{
mpxjResource.setBaselineCost(number, cost);
mpxjResource.setBaselineWork(number, work);
}
}
}
|
[
"private",
"void",
"readResourceBaselines",
"(",
"Project",
".",
"Resources",
".",
"Resource",
"xmlResource",
",",
"Resource",
"mpxjResource",
")",
"{",
"for",
"(",
"Project",
".",
"Resources",
".",
"Resource",
".",
"Baseline",
"baseline",
":",
"xmlResource",
".",
"getBaseline",
"(",
")",
")",
"{",
"int",
"number",
"=",
"NumberHelper",
".",
"getInt",
"(",
"baseline",
".",
"getNumber",
"(",
")",
")",
";",
"Double",
"cost",
"=",
"DatatypeConverter",
".",
"parseCurrency",
"(",
"baseline",
".",
"getCost",
"(",
")",
")",
";",
"Duration",
"work",
"=",
"DatatypeConverter",
".",
"parseDuration",
"(",
"m_projectFile",
",",
"TimeUnit",
".",
"HOURS",
",",
"baseline",
".",
"getWork",
"(",
")",
")",
";",
"if",
"(",
"number",
"==",
"0",
")",
"{",
"mpxjResource",
".",
"setBaselineCost",
"(",
"cost",
")",
";",
"mpxjResource",
".",
"setBaselineWork",
"(",
"work",
")",
";",
"}",
"else",
"{",
"mpxjResource",
".",
"setBaselineCost",
"(",
"number",
",",
"cost",
")",
";",
"mpxjResource",
".",
"setBaselineWork",
"(",
"number",
",",
"work",
")",
";",
"}",
"}",
"}"
] |
Reads baseline values for the current resource.
@param xmlResource MSPDI resource instance
@param mpxjResource MPXJ resource instance
|
[
"Reads",
"baseline",
"values",
"for",
"the",
"current",
"resource",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L978-L998
|
157,340
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readResourceExtendedAttributes
|
private void readResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx)
{
for (Project.Resources.Resource.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
ResourceField mpxFieldID = MPPResourceField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
}
|
java
|
private void readResourceExtendedAttributes(Project.Resources.Resource xml, Resource mpx)
{
for (Project.Resources.Resource.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
ResourceField mpxFieldID = MPPResourceField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
}
|
[
"private",
"void",
"readResourceExtendedAttributes",
"(",
"Project",
".",
"Resources",
".",
"Resource",
"xml",
",",
"Resource",
"mpx",
")",
"{",
"for",
"(",
"Project",
".",
"Resources",
".",
"Resource",
".",
"ExtendedAttribute",
"attrib",
":",
"xml",
".",
"getExtendedAttribute",
"(",
")",
")",
"{",
"int",
"xmlFieldID",
"=",
"Integer",
".",
"parseInt",
"(",
"attrib",
".",
"getFieldID",
"(",
")",
")",
"&",
"0x0000FFFF",
";",
"ResourceField",
"mpxFieldID",
"=",
"MPPResourceField",
".",
"getInstance",
"(",
"xmlFieldID",
")",
";",
"TimeUnit",
"durationFormat",
"=",
"DatatypeConverter",
".",
"parseDurationTimeUnits",
"(",
"attrib",
".",
"getDurationFormat",
"(",
")",
",",
"null",
")",
";",
"DatatypeConverter",
".",
"parseExtendedAttribute",
"(",
"m_projectFile",
",",
"mpx",
",",
"attrib",
".",
"getValue",
"(",
")",
",",
"mpxFieldID",
",",
"durationFormat",
")",
";",
"}",
"}"
] |
This method processes any extended attributes associated with a resource.
@param xml MSPDI resource instance
@param mpx MPX resource instance
|
[
"This",
"method",
"processes",
"any",
"extended",
"attributes",
"associated",
"with",
"a",
"resource",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1006-L1015
|
157,341
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readCostRateTables
|
private void readCostRateTables(Resource resource, Rates rates)
{
if (rates == null)
{
CostRateTable table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(0, table);
table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(1, table);
table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(2, table);
table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(3, table);
table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(4, table);
}
else
{
Set<CostRateTable> tables = new HashSet<CostRateTable>();
for (net.sf.mpxj.mspdi.schema.Project.Resources.Resource.Rates.Rate rate : rates.getRate())
{
Rate standardRate = DatatypeConverter.parseRate(rate.getStandardRate());
TimeUnit standardRateFormat = DatatypeConverter.parseTimeUnit(rate.getStandardRateFormat());
Rate overtimeRate = DatatypeConverter.parseRate(rate.getOvertimeRate());
TimeUnit overtimeRateFormat = DatatypeConverter.parseTimeUnit(rate.getOvertimeRateFormat());
Double costPerUse = DatatypeConverter.parseCurrency(rate.getCostPerUse());
Date endDate = rate.getRatesTo();
CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate);
int tableIndex = rate.getRateTable().intValue();
CostRateTable table = resource.getCostRateTable(tableIndex);
if (table == null)
{
table = new CostRateTable();
resource.setCostRateTable(tableIndex, table);
}
table.add(entry);
tables.add(table);
}
for (CostRateTable table : tables)
{
Collections.sort(table);
}
}
}
|
java
|
private void readCostRateTables(Resource resource, Rates rates)
{
if (rates == null)
{
CostRateTable table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(0, table);
table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(1, table);
table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(2, table);
table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(3, table);
table = new CostRateTable();
table.add(CostRateTableEntry.DEFAULT_ENTRY);
resource.setCostRateTable(4, table);
}
else
{
Set<CostRateTable> tables = new HashSet<CostRateTable>();
for (net.sf.mpxj.mspdi.schema.Project.Resources.Resource.Rates.Rate rate : rates.getRate())
{
Rate standardRate = DatatypeConverter.parseRate(rate.getStandardRate());
TimeUnit standardRateFormat = DatatypeConverter.parseTimeUnit(rate.getStandardRateFormat());
Rate overtimeRate = DatatypeConverter.parseRate(rate.getOvertimeRate());
TimeUnit overtimeRateFormat = DatatypeConverter.parseTimeUnit(rate.getOvertimeRateFormat());
Double costPerUse = DatatypeConverter.parseCurrency(rate.getCostPerUse());
Date endDate = rate.getRatesTo();
CostRateTableEntry entry = new CostRateTableEntry(standardRate, standardRateFormat, overtimeRate, overtimeRateFormat, costPerUse, endDate);
int tableIndex = rate.getRateTable().intValue();
CostRateTable table = resource.getCostRateTable(tableIndex);
if (table == null)
{
table = new CostRateTable();
resource.setCostRateTable(tableIndex, table);
}
table.add(entry);
tables.add(table);
}
for (CostRateTable table : tables)
{
Collections.sort(table);
}
}
}
|
[
"private",
"void",
"readCostRateTables",
"(",
"Resource",
"resource",
",",
"Rates",
"rates",
")",
"{",
"if",
"(",
"rates",
"==",
"null",
")",
"{",
"CostRateTable",
"table",
"=",
"new",
"CostRateTable",
"(",
")",
";",
"table",
".",
"add",
"(",
"CostRateTableEntry",
".",
"DEFAULT_ENTRY",
")",
";",
"resource",
".",
"setCostRateTable",
"(",
"0",
",",
"table",
")",
";",
"table",
"=",
"new",
"CostRateTable",
"(",
")",
";",
"table",
".",
"add",
"(",
"CostRateTableEntry",
".",
"DEFAULT_ENTRY",
")",
";",
"resource",
".",
"setCostRateTable",
"(",
"1",
",",
"table",
")",
";",
"table",
"=",
"new",
"CostRateTable",
"(",
")",
";",
"table",
".",
"add",
"(",
"CostRateTableEntry",
".",
"DEFAULT_ENTRY",
")",
";",
"resource",
".",
"setCostRateTable",
"(",
"2",
",",
"table",
")",
";",
"table",
"=",
"new",
"CostRateTable",
"(",
")",
";",
"table",
".",
"add",
"(",
"CostRateTableEntry",
".",
"DEFAULT_ENTRY",
")",
";",
"resource",
".",
"setCostRateTable",
"(",
"3",
",",
"table",
")",
";",
"table",
"=",
"new",
"CostRateTable",
"(",
")",
";",
"table",
".",
"add",
"(",
"CostRateTableEntry",
".",
"DEFAULT_ENTRY",
")",
";",
"resource",
".",
"setCostRateTable",
"(",
"4",
",",
"table",
")",
";",
"}",
"else",
"{",
"Set",
"<",
"CostRateTable",
">",
"tables",
"=",
"new",
"HashSet",
"<",
"CostRateTable",
">",
"(",
")",
";",
"for",
"(",
"net",
".",
"sf",
".",
"mpxj",
".",
"mspdi",
".",
"schema",
".",
"Project",
".",
"Resources",
".",
"Resource",
".",
"Rates",
".",
"Rate",
"rate",
":",
"rates",
".",
"getRate",
"(",
")",
")",
"{",
"Rate",
"standardRate",
"=",
"DatatypeConverter",
".",
"parseRate",
"(",
"rate",
".",
"getStandardRate",
"(",
")",
")",
";",
"TimeUnit",
"standardRateFormat",
"=",
"DatatypeConverter",
".",
"parseTimeUnit",
"(",
"rate",
".",
"getStandardRateFormat",
"(",
")",
")",
";",
"Rate",
"overtimeRate",
"=",
"DatatypeConverter",
".",
"parseRate",
"(",
"rate",
".",
"getOvertimeRate",
"(",
")",
")",
";",
"TimeUnit",
"overtimeRateFormat",
"=",
"DatatypeConverter",
".",
"parseTimeUnit",
"(",
"rate",
".",
"getOvertimeRateFormat",
"(",
")",
")",
";",
"Double",
"costPerUse",
"=",
"DatatypeConverter",
".",
"parseCurrency",
"(",
"rate",
".",
"getCostPerUse",
"(",
")",
")",
";",
"Date",
"endDate",
"=",
"rate",
".",
"getRatesTo",
"(",
")",
";",
"CostRateTableEntry",
"entry",
"=",
"new",
"CostRateTableEntry",
"(",
"standardRate",
",",
"standardRateFormat",
",",
"overtimeRate",
",",
"overtimeRateFormat",
",",
"costPerUse",
",",
"endDate",
")",
";",
"int",
"tableIndex",
"=",
"rate",
".",
"getRateTable",
"(",
")",
".",
"intValue",
"(",
")",
";",
"CostRateTable",
"table",
"=",
"resource",
".",
"getCostRateTable",
"(",
"tableIndex",
")",
";",
"if",
"(",
"table",
"==",
"null",
")",
"{",
"table",
"=",
"new",
"CostRateTable",
"(",
")",
";",
"resource",
".",
"setCostRateTable",
"(",
"tableIndex",
",",
"table",
")",
";",
"}",
"table",
".",
"add",
"(",
"entry",
")",
";",
"tables",
".",
"add",
"(",
"table",
")",
";",
"}",
"for",
"(",
"CostRateTable",
"table",
":",
"tables",
")",
"{",
"Collections",
".",
"sort",
"(",
"table",
")",
";",
"}",
"}",
"}"
] |
Reads the cost rate tables from the file.
@param resource parent resource
@param rates XML cot rate tables
|
[
"Reads",
"the",
"cost",
"rate",
"tables",
"from",
"the",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1023-L1078
|
157,342
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readAvailabilityTable
|
private void readAvailabilityTable(Resource resource, AvailabilityPeriods periods)
{
if (periods != null)
{
AvailabilityTable table = resource.getAvailability();
List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();
for (AvailabilityPeriod period : list)
{
Date start = period.getAvailableFrom();
Date end = period.getAvailableTo();
Number units = DatatypeConverter.parseUnits(period.getAvailableUnits());
Availability availability = new Availability(start, end, units);
table.add(availability);
}
Collections.sort(table);
}
}
|
java
|
private void readAvailabilityTable(Resource resource, AvailabilityPeriods periods)
{
if (periods != null)
{
AvailabilityTable table = resource.getAvailability();
List<AvailabilityPeriod> list = periods.getAvailabilityPeriod();
for (AvailabilityPeriod period : list)
{
Date start = period.getAvailableFrom();
Date end = period.getAvailableTo();
Number units = DatatypeConverter.parseUnits(period.getAvailableUnits());
Availability availability = new Availability(start, end, units);
table.add(availability);
}
Collections.sort(table);
}
}
|
[
"private",
"void",
"readAvailabilityTable",
"(",
"Resource",
"resource",
",",
"AvailabilityPeriods",
"periods",
")",
"{",
"if",
"(",
"periods",
"!=",
"null",
")",
"{",
"AvailabilityTable",
"table",
"=",
"resource",
".",
"getAvailability",
"(",
")",
";",
"List",
"<",
"AvailabilityPeriod",
">",
"list",
"=",
"periods",
".",
"getAvailabilityPeriod",
"(",
")",
";",
"for",
"(",
"AvailabilityPeriod",
"period",
":",
"list",
")",
"{",
"Date",
"start",
"=",
"period",
".",
"getAvailableFrom",
"(",
")",
";",
"Date",
"end",
"=",
"period",
".",
"getAvailableTo",
"(",
")",
";",
"Number",
"units",
"=",
"DatatypeConverter",
".",
"parseUnits",
"(",
"period",
".",
"getAvailableUnits",
"(",
")",
")",
";",
"Availability",
"availability",
"=",
"new",
"Availability",
"(",
"start",
",",
"end",
",",
"units",
")",
";",
"table",
".",
"add",
"(",
"availability",
")",
";",
"}",
"Collections",
".",
"sort",
"(",
"table",
")",
";",
"}",
"}"
] |
Reads the availability table from the file.
@param resource MPXJ resource instance
@param periods MSPDI availability periods
|
[
"Reads",
"the",
"availability",
"table",
"from",
"the",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1086-L1102
|
157,343
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readTasks
|
private void readTasks(Project project)
{
Project.Tasks tasks = project.getTasks();
if (tasks != null)
{
int tasksWithoutIDCount = 0;
for (Project.Tasks.Task task : tasks.getTask())
{
Task mpxjTask = readTask(task);
if (mpxjTask.getID() == null)
{
++tasksWithoutIDCount;
}
}
for (Project.Tasks.Task task : tasks.getTask())
{
readPredecessors(task);
}
//
// MS Project will happily read tasks from an MSPDI file without IDs,
// it will just generate ID values based on the task order in the file.
// If we find that there are no ID values present, we'll do the same.
//
if (tasksWithoutIDCount == tasks.getTask().size())
{
m_projectFile.getTasks().renumberIDs();
}
}
m_projectFile.updateStructure();
}
|
java
|
private void readTasks(Project project)
{
Project.Tasks tasks = project.getTasks();
if (tasks != null)
{
int tasksWithoutIDCount = 0;
for (Project.Tasks.Task task : tasks.getTask())
{
Task mpxjTask = readTask(task);
if (mpxjTask.getID() == null)
{
++tasksWithoutIDCount;
}
}
for (Project.Tasks.Task task : tasks.getTask())
{
readPredecessors(task);
}
//
// MS Project will happily read tasks from an MSPDI file without IDs,
// it will just generate ID values based on the task order in the file.
// If we find that there are no ID values present, we'll do the same.
//
if (tasksWithoutIDCount == tasks.getTask().size())
{
m_projectFile.getTasks().renumberIDs();
}
}
m_projectFile.updateStructure();
}
|
[
"private",
"void",
"readTasks",
"(",
"Project",
"project",
")",
"{",
"Project",
".",
"Tasks",
"tasks",
"=",
"project",
".",
"getTasks",
"(",
")",
";",
"if",
"(",
"tasks",
"!=",
"null",
")",
"{",
"int",
"tasksWithoutIDCount",
"=",
"0",
";",
"for",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"task",
":",
"tasks",
".",
"getTask",
"(",
")",
")",
"{",
"Task",
"mpxjTask",
"=",
"readTask",
"(",
"task",
")",
";",
"if",
"(",
"mpxjTask",
".",
"getID",
"(",
")",
"==",
"null",
")",
"{",
"++",
"tasksWithoutIDCount",
";",
"}",
"}",
"for",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"task",
":",
"tasks",
".",
"getTask",
"(",
")",
")",
"{",
"readPredecessors",
"(",
"task",
")",
";",
"}",
"//",
"// MS Project will happily read tasks from an MSPDI file without IDs,",
"// it will just generate ID values based on the task order in the file.",
"// If we find that there are no ID values present, we'll do the same.",
"//",
"if",
"(",
"tasksWithoutIDCount",
"==",
"tasks",
".",
"getTask",
"(",
")",
".",
"size",
"(",
")",
")",
"{",
"m_projectFile",
".",
"getTasks",
"(",
")",
".",
"renumberIDs",
"(",
")",
";",
"}",
"}",
"m_projectFile",
".",
"updateStructure",
"(",
")",
";",
"}"
] |
This method extracts task data from an MSPDI file.
@param project Root node of the MSPDI file
|
[
"This",
"method",
"extracts",
"task",
"data",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1109-L1142
|
157,344
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.updateProjectProperties
|
private void updateProjectProperties(Task task)
{
ProjectProperties props = m_projectFile.getProjectProperties();
props.setComments(task.getNotes());
}
|
java
|
private void updateProjectProperties(Task task)
{
ProjectProperties props = m_projectFile.getProjectProperties();
props.setComments(task.getNotes());
}
|
[
"private",
"void",
"updateProjectProperties",
"(",
"Task",
"task",
")",
"{",
"ProjectProperties",
"props",
"=",
"m_projectFile",
".",
"getProjectProperties",
"(",
")",
";",
"props",
".",
"setComments",
"(",
"task",
".",
"getNotes",
"(",
")",
")",
";",
"}"
] |
Update the project properties from the project summary task.
@param task project summary task
|
[
"Update",
"the",
"project",
"properties",
"from",
"the",
"project",
"summary",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1363-L1367
|
157,345
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readTaskBaselines
|
private void readTaskBaselines(Project.Tasks.Task xmlTask, Task mpxjTask, TimeUnit durationFormat)
{
for (Project.Tasks.Task.Baseline baseline : xmlTask.getBaseline())
{
int number = NumberHelper.getInt(baseline.getNumber());
Double cost = DatatypeConverter.parseCurrency(baseline.getCost());
Duration duration = DatatypeConverter.parseDuration(m_projectFile, durationFormat, baseline.getDuration());
Date finish = baseline.getFinish();
Date start = baseline.getStart();
Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());
if (number == 0)
{
mpxjTask.setBaselineCost(cost);
mpxjTask.setBaselineDuration(duration);
mpxjTask.setBaselineFinish(finish);
mpxjTask.setBaselineStart(start);
mpxjTask.setBaselineWork(work);
}
else
{
mpxjTask.setBaselineCost(number, cost);
mpxjTask.setBaselineDuration(number, duration);
mpxjTask.setBaselineFinish(number, finish);
mpxjTask.setBaselineStart(number, start);
mpxjTask.setBaselineWork(number, work);
}
}
}
|
java
|
private void readTaskBaselines(Project.Tasks.Task xmlTask, Task mpxjTask, TimeUnit durationFormat)
{
for (Project.Tasks.Task.Baseline baseline : xmlTask.getBaseline())
{
int number = NumberHelper.getInt(baseline.getNumber());
Double cost = DatatypeConverter.parseCurrency(baseline.getCost());
Duration duration = DatatypeConverter.parseDuration(m_projectFile, durationFormat, baseline.getDuration());
Date finish = baseline.getFinish();
Date start = baseline.getStart();
Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());
if (number == 0)
{
mpxjTask.setBaselineCost(cost);
mpxjTask.setBaselineDuration(duration);
mpxjTask.setBaselineFinish(finish);
mpxjTask.setBaselineStart(start);
mpxjTask.setBaselineWork(work);
}
else
{
mpxjTask.setBaselineCost(number, cost);
mpxjTask.setBaselineDuration(number, duration);
mpxjTask.setBaselineFinish(number, finish);
mpxjTask.setBaselineStart(number, start);
mpxjTask.setBaselineWork(number, work);
}
}
}
|
[
"private",
"void",
"readTaskBaselines",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"xmlTask",
",",
"Task",
"mpxjTask",
",",
"TimeUnit",
"durationFormat",
")",
"{",
"for",
"(",
"Project",
".",
"Tasks",
".",
"Task",
".",
"Baseline",
"baseline",
":",
"xmlTask",
".",
"getBaseline",
"(",
")",
")",
"{",
"int",
"number",
"=",
"NumberHelper",
".",
"getInt",
"(",
"baseline",
".",
"getNumber",
"(",
")",
")",
";",
"Double",
"cost",
"=",
"DatatypeConverter",
".",
"parseCurrency",
"(",
"baseline",
".",
"getCost",
"(",
")",
")",
";",
"Duration",
"duration",
"=",
"DatatypeConverter",
".",
"parseDuration",
"(",
"m_projectFile",
",",
"durationFormat",
",",
"baseline",
".",
"getDuration",
"(",
")",
")",
";",
"Date",
"finish",
"=",
"baseline",
".",
"getFinish",
"(",
")",
";",
"Date",
"start",
"=",
"baseline",
".",
"getStart",
"(",
")",
";",
"Duration",
"work",
"=",
"DatatypeConverter",
".",
"parseDuration",
"(",
"m_projectFile",
",",
"TimeUnit",
".",
"HOURS",
",",
"baseline",
".",
"getWork",
"(",
")",
")",
";",
"if",
"(",
"number",
"==",
"0",
")",
"{",
"mpxjTask",
".",
"setBaselineCost",
"(",
"cost",
")",
";",
"mpxjTask",
".",
"setBaselineDuration",
"(",
"duration",
")",
";",
"mpxjTask",
".",
"setBaselineFinish",
"(",
"finish",
")",
";",
"mpxjTask",
".",
"setBaselineStart",
"(",
"start",
")",
";",
"mpxjTask",
".",
"setBaselineWork",
"(",
"work",
")",
";",
"}",
"else",
"{",
"mpxjTask",
".",
"setBaselineCost",
"(",
"number",
",",
"cost",
")",
";",
"mpxjTask",
".",
"setBaselineDuration",
"(",
"number",
",",
"duration",
")",
";",
"mpxjTask",
".",
"setBaselineFinish",
"(",
"number",
",",
"finish",
")",
";",
"mpxjTask",
".",
"setBaselineStart",
"(",
"number",
",",
"start",
")",
";",
"mpxjTask",
".",
"setBaselineWork",
"(",
"number",
",",
"work",
")",
";",
"}",
"}",
"}"
] |
Reads baseline values for the current task.
@param xmlTask MSPDI task instance
@param mpxjTask MPXJ task instance
@param durationFormat duration format to use
|
[
"Reads",
"baseline",
"values",
"for",
"the",
"current",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1407-L1436
|
157,346
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readTaskExtendedAttributes
|
private void readTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx)
{
for (Project.Tasks.Task.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
TaskField mpxFieldID = MPPTaskField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
}
|
java
|
private void readTaskExtendedAttributes(Project.Tasks.Task xml, Task mpx)
{
for (Project.Tasks.Task.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
TaskField mpxFieldID = MPPTaskField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
}
|
[
"private",
"void",
"readTaskExtendedAttributes",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"xml",
",",
"Task",
"mpx",
")",
"{",
"for",
"(",
"Project",
".",
"Tasks",
".",
"Task",
".",
"ExtendedAttribute",
"attrib",
":",
"xml",
".",
"getExtendedAttribute",
"(",
")",
")",
"{",
"int",
"xmlFieldID",
"=",
"Integer",
".",
"parseInt",
"(",
"attrib",
".",
"getFieldID",
"(",
")",
")",
"&",
"0x0000FFFF",
";",
"TaskField",
"mpxFieldID",
"=",
"MPPTaskField",
".",
"getInstance",
"(",
"xmlFieldID",
")",
";",
"TimeUnit",
"durationFormat",
"=",
"DatatypeConverter",
".",
"parseDurationTimeUnits",
"(",
"attrib",
".",
"getDurationFormat",
"(",
")",
",",
"null",
")",
";",
"DatatypeConverter",
".",
"parseExtendedAttribute",
"(",
"m_projectFile",
",",
"mpx",
",",
"attrib",
".",
"getValue",
"(",
")",
",",
"mpxFieldID",
",",
"durationFormat",
")",
";",
"}",
"}"
] |
This method processes any extended attributes associated with a task.
@param xml MSPDI task instance
@param mpx MPX task instance
|
[
"This",
"method",
"processes",
"any",
"extended",
"attributes",
"associated",
"with",
"a",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1444-L1453
|
157,347
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.getTaskCalendar
|
private ProjectCalendar getTaskCalendar(Project.Tasks.Task task)
{
ProjectCalendar calendar = null;
BigInteger calendarID = task.getCalendarUID();
if (calendarID != null)
{
calendar = m_projectFile.getCalendarByUniqueID(Integer.valueOf(calendarID.intValue()));
}
return (calendar);
}
|
java
|
private ProjectCalendar getTaskCalendar(Project.Tasks.Task task)
{
ProjectCalendar calendar = null;
BigInteger calendarID = task.getCalendarUID();
if (calendarID != null)
{
calendar = m_projectFile.getCalendarByUniqueID(Integer.valueOf(calendarID.intValue()));
}
return (calendar);
}
|
[
"private",
"ProjectCalendar",
"getTaskCalendar",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"task",
")",
"{",
"ProjectCalendar",
"calendar",
"=",
"null",
";",
"BigInteger",
"calendarID",
"=",
"task",
".",
"getCalendarUID",
"(",
")",
";",
"if",
"(",
"calendarID",
"!=",
"null",
")",
"{",
"calendar",
"=",
"m_projectFile",
".",
"getCalendarByUniqueID",
"(",
"Integer",
".",
"valueOf",
"(",
"calendarID",
".",
"intValue",
"(",
")",
")",
")",
";",
"}",
"return",
"(",
"calendar",
")",
";",
"}"
] |
This method is used to retrieve the calendar associated
with a task. If no calendar is associated with a task, this method
returns null.
@param task MSPDI task
@return calendar instance
|
[
"This",
"method",
"is",
"used",
"to",
"retrieve",
"the",
"calendar",
"associated",
"with",
"a",
"task",
".",
"If",
"no",
"calendar",
"is",
"associated",
"with",
"a",
"task",
"this",
"method",
"returns",
"null",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1463-L1474
|
157,348
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readPredecessors
|
private void readPredecessors(Project.Tasks.Task task)
{
Integer uid = task.getUID();
if (uid != null)
{
Task currTask = m_projectFile.getTaskByUniqueID(uid);
if (currTask != null)
{
for (Project.Tasks.Task.PredecessorLink link : task.getPredecessorLink())
{
readPredecessor(currTask, link);
}
}
}
}
|
java
|
private void readPredecessors(Project.Tasks.Task task)
{
Integer uid = task.getUID();
if (uid != null)
{
Task currTask = m_projectFile.getTaskByUniqueID(uid);
if (currTask != null)
{
for (Project.Tasks.Task.PredecessorLink link : task.getPredecessorLink())
{
readPredecessor(currTask, link);
}
}
}
}
|
[
"private",
"void",
"readPredecessors",
"(",
"Project",
".",
"Tasks",
".",
"Task",
"task",
")",
"{",
"Integer",
"uid",
"=",
"task",
".",
"getUID",
"(",
")",
";",
"if",
"(",
"uid",
"!=",
"null",
")",
"{",
"Task",
"currTask",
"=",
"m_projectFile",
".",
"getTaskByUniqueID",
"(",
"uid",
")",
";",
"if",
"(",
"currTask",
"!=",
"null",
")",
"{",
"for",
"(",
"Project",
".",
"Tasks",
".",
"Task",
".",
"PredecessorLink",
"link",
":",
"task",
".",
"getPredecessorLink",
"(",
")",
")",
"{",
"readPredecessor",
"(",
"currTask",
",",
"link",
")",
";",
"}",
"}",
"}",
"}"
] |
This method extracts predecessor data from an MSPDI file.
@param task Task data
|
[
"This",
"method",
"extracts",
"predecessor",
"data",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1481-L1495
|
157,349
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readPredecessor
|
private void readPredecessor(Task currTask, Project.Tasks.Task.PredecessorLink link)
{
BigInteger uid = link.getPredecessorUID();
if (uid != null)
{
Task prevTask = m_projectFile.getTaskByUniqueID(Integer.valueOf(uid.intValue()));
if (prevTask != null)
{
RelationType type;
if (link.getType() != null)
{
type = RelationType.getInstance(link.getType().intValue());
}
else
{
type = RelationType.FINISH_START;
}
TimeUnit lagUnits = DatatypeConverter.parseDurationTimeUnits(link.getLagFormat());
Duration lagDuration;
int lag = NumberHelper.getInt(link.getLinkLag());
if (lag == 0)
{
lagDuration = Duration.getInstance(0, lagUnits);
}
else
{
if (lagUnits == TimeUnit.PERCENT || lagUnits == TimeUnit.ELAPSED_PERCENT)
{
lagDuration = Duration.getInstance(lag, lagUnits);
}
else
{
lagDuration = Duration.convertUnits(lag / 10.0, TimeUnit.MINUTES, lagUnits, m_projectFile.getProjectProperties());
}
}
Relation relation = currTask.addPredecessor(prevTask, type, lagDuration);
m_eventManager.fireRelationReadEvent(relation);
}
}
}
|
java
|
private void readPredecessor(Task currTask, Project.Tasks.Task.PredecessorLink link)
{
BigInteger uid = link.getPredecessorUID();
if (uid != null)
{
Task prevTask = m_projectFile.getTaskByUniqueID(Integer.valueOf(uid.intValue()));
if (prevTask != null)
{
RelationType type;
if (link.getType() != null)
{
type = RelationType.getInstance(link.getType().intValue());
}
else
{
type = RelationType.FINISH_START;
}
TimeUnit lagUnits = DatatypeConverter.parseDurationTimeUnits(link.getLagFormat());
Duration lagDuration;
int lag = NumberHelper.getInt(link.getLinkLag());
if (lag == 0)
{
lagDuration = Duration.getInstance(0, lagUnits);
}
else
{
if (lagUnits == TimeUnit.PERCENT || lagUnits == TimeUnit.ELAPSED_PERCENT)
{
lagDuration = Duration.getInstance(lag, lagUnits);
}
else
{
lagDuration = Duration.convertUnits(lag / 10.0, TimeUnit.MINUTES, lagUnits, m_projectFile.getProjectProperties());
}
}
Relation relation = currTask.addPredecessor(prevTask, type, lagDuration);
m_eventManager.fireRelationReadEvent(relation);
}
}
}
|
[
"private",
"void",
"readPredecessor",
"(",
"Task",
"currTask",
",",
"Project",
".",
"Tasks",
".",
"Task",
".",
"PredecessorLink",
"link",
")",
"{",
"BigInteger",
"uid",
"=",
"link",
".",
"getPredecessorUID",
"(",
")",
";",
"if",
"(",
"uid",
"!=",
"null",
")",
"{",
"Task",
"prevTask",
"=",
"m_projectFile",
".",
"getTaskByUniqueID",
"(",
"Integer",
".",
"valueOf",
"(",
"uid",
".",
"intValue",
"(",
")",
")",
")",
";",
"if",
"(",
"prevTask",
"!=",
"null",
")",
"{",
"RelationType",
"type",
";",
"if",
"(",
"link",
".",
"getType",
"(",
")",
"!=",
"null",
")",
"{",
"type",
"=",
"RelationType",
".",
"getInstance",
"(",
"link",
".",
"getType",
"(",
")",
".",
"intValue",
"(",
")",
")",
";",
"}",
"else",
"{",
"type",
"=",
"RelationType",
".",
"FINISH_START",
";",
"}",
"TimeUnit",
"lagUnits",
"=",
"DatatypeConverter",
".",
"parseDurationTimeUnits",
"(",
"link",
".",
"getLagFormat",
"(",
")",
")",
";",
"Duration",
"lagDuration",
";",
"int",
"lag",
"=",
"NumberHelper",
".",
"getInt",
"(",
"link",
".",
"getLinkLag",
"(",
")",
")",
";",
"if",
"(",
"lag",
"==",
"0",
")",
"{",
"lagDuration",
"=",
"Duration",
".",
"getInstance",
"(",
"0",
",",
"lagUnits",
")",
";",
"}",
"else",
"{",
"if",
"(",
"lagUnits",
"==",
"TimeUnit",
".",
"PERCENT",
"||",
"lagUnits",
"==",
"TimeUnit",
".",
"ELAPSED_PERCENT",
")",
"{",
"lagDuration",
"=",
"Duration",
".",
"getInstance",
"(",
"lag",
",",
"lagUnits",
")",
";",
"}",
"else",
"{",
"lagDuration",
"=",
"Duration",
".",
"convertUnits",
"(",
"lag",
"/",
"10.0",
",",
"TimeUnit",
".",
"MINUTES",
",",
"lagUnits",
",",
"m_projectFile",
".",
"getProjectProperties",
"(",
")",
")",
";",
"}",
"}",
"Relation",
"relation",
"=",
"currTask",
".",
"addPredecessor",
"(",
"prevTask",
",",
"type",
",",
"lagDuration",
")",
";",
"m_eventManager",
".",
"fireRelationReadEvent",
"(",
"relation",
")",
";",
"}",
"}",
"}"
] |
This method extracts data for a single predecessor from an MSPDI file.
@param currTask Current task object
@param link Predecessor data
|
[
"This",
"method",
"extracts",
"data",
"for",
"a",
"single",
"predecessor",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1503-L1545
|
157,350
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readAssignments
|
private void readAssignments(Project project)
{
Project.Assignments assignments = project.getAssignments();
if (assignments != null)
{
SplitTaskFactory splitFactory = new SplitTaskFactory();
TimephasedWorkNormaliser normaliser = new MSPDITimephasedWorkNormaliser();
for (Project.Assignments.Assignment assignment : assignments.getAssignment())
{
readAssignment(assignment, splitFactory, normaliser);
}
}
}
|
java
|
private void readAssignments(Project project)
{
Project.Assignments assignments = project.getAssignments();
if (assignments != null)
{
SplitTaskFactory splitFactory = new SplitTaskFactory();
TimephasedWorkNormaliser normaliser = new MSPDITimephasedWorkNormaliser();
for (Project.Assignments.Assignment assignment : assignments.getAssignment())
{
readAssignment(assignment, splitFactory, normaliser);
}
}
}
|
[
"private",
"void",
"readAssignments",
"(",
"Project",
"project",
")",
"{",
"Project",
".",
"Assignments",
"assignments",
"=",
"project",
".",
"getAssignments",
"(",
")",
";",
"if",
"(",
"assignments",
"!=",
"null",
")",
"{",
"SplitTaskFactory",
"splitFactory",
"=",
"new",
"SplitTaskFactory",
"(",
")",
";",
"TimephasedWorkNormaliser",
"normaliser",
"=",
"new",
"MSPDITimephasedWorkNormaliser",
"(",
")",
";",
"for",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
"assignment",
":",
"assignments",
".",
"getAssignment",
"(",
")",
")",
"{",
"readAssignment",
"(",
"assignment",
",",
"splitFactory",
",",
"normaliser",
")",
";",
"}",
"}",
"}"
] |
This method extracts assignment data from an MSPDI file.
@param project Root node of the MSPDI file
|
[
"This",
"method",
"extracts",
"assignment",
"data",
"from",
"an",
"MSPDI",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1552-L1564
|
157,351
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readAssignmentBaselines
|
private void readAssignmentBaselines(Project.Assignments.Assignment assignment, ResourceAssignment mpx)
{
for (Project.Assignments.Assignment.Baseline baseline : assignment.getBaseline())
{
int number = NumberHelper.getInt(baseline.getNumber());
//baseline.getBCWP()
//baseline.getBCWS()
Number cost = DatatypeConverter.parseExtendedAttributeCurrency(baseline.getCost());
Date finish = DatatypeConverter.parseExtendedAttributeDate(baseline.getFinish());
//baseline.getNumber()
Date start = DatatypeConverter.parseExtendedAttributeDate(baseline.getStart());
Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());
if (number == 0)
{
mpx.setBaselineCost(cost);
mpx.setBaselineFinish(finish);
mpx.setBaselineStart(start);
mpx.setBaselineWork(work);
}
else
{
mpx.setBaselineCost(number, cost);
mpx.setBaselineWork(number, work);
mpx.setBaselineStart(number, start);
mpx.setBaselineFinish(number, finish);
}
}
}
|
java
|
private void readAssignmentBaselines(Project.Assignments.Assignment assignment, ResourceAssignment mpx)
{
for (Project.Assignments.Assignment.Baseline baseline : assignment.getBaseline())
{
int number = NumberHelper.getInt(baseline.getNumber());
//baseline.getBCWP()
//baseline.getBCWS()
Number cost = DatatypeConverter.parseExtendedAttributeCurrency(baseline.getCost());
Date finish = DatatypeConverter.parseExtendedAttributeDate(baseline.getFinish());
//baseline.getNumber()
Date start = DatatypeConverter.parseExtendedAttributeDate(baseline.getStart());
Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.HOURS, baseline.getWork());
if (number == 0)
{
mpx.setBaselineCost(cost);
mpx.setBaselineFinish(finish);
mpx.setBaselineStart(start);
mpx.setBaselineWork(work);
}
else
{
mpx.setBaselineCost(number, cost);
mpx.setBaselineWork(number, work);
mpx.setBaselineStart(number, start);
mpx.setBaselineFinish(number, finish);
}
}
}
|
[
"private",
"void",
"readAssignmentBaselines",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
"assignment",
",",
"ResourceAssignment",
"mpx",
")",
"{",
"for",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
".",
"Baseline",
"baseline",
":",
"assignment",
".",
"getBaseline",
"(",
")",
")",
"{",
"int",
"number",
"=",
"NumberHelper",
".",
"getInt",
"(",
"baseline",
".",
"getNumber",
"(",
")",
")",
";",
"//baseline.getBCWP()",
"//baseline.getBCWS()",
"Number",
"cost",
"=",
"DatatypeConverter",
".",
"parseExtendedAttributeCurrency",
"(",
"baseline",
".",
"getCost",
"(",
")",
")",
";",
"Date",
"finish",
"=",
"DatatypeConverter",
".",
"parseExtendedAttributeDate",
"(",
"baseline",
".",
"getFinish",
"(",
")",
")",
";",
"//baseline.getNumber()",
"Date",
"start",
"=",
"DatatypeConverter",
".",
"parseExtendedAttributeDate",
"(",
"baseline",
".",
"getStart",
"(",
")",
")",
";",
"Duration",
"work",
"=",
"DatatypeConverter",
".",
"parseDuration",
"(",
"m_projectFile",
",",
"TimeUnit",
".",
"HOURS",
",",
"baseline",
".",
"getWork",
"(",
")",
")",
";",
"if",
"(",
"number",
"==",
"0",
")",
"{",
"mpx",
".",
"setBaselineCost",
"(",
"cost",
")",
";",
"mpx",
".",
"setBaselineFinish",
"(",
"finish",
")",
";",
"mpx",
".",
"setBaselineStart",
"(",
"start",
")",
";",
"mpx",
".",
"setBaselineWork",
"(",
"work",
")",
";",
"}",
"else",
"{",
"mpx",
".",
"setBaselineCost",
"(",
"number",
",",
"cost",
")",
";",
"mpx",
".",
"setBaselineWork",
"(",
"number",
",",
"work",
")",
";",
"mpx",
".",
"setBaselineStart",
"(",
"number",
",",
"start",
")",
";",
"mpx",
".",
"setBaselineFinish",
"(",
"number",
",",
"finish",
")",
";",
"}",
"}",
"}"
] |
Extracts assignment baseline data.
@param assignment xml assignment
@param mpx mpxj assignment
|
[
"Extracts",
"assignment",
"baseline",
"data",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1683-L1712
|
157,352
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readAssignmentExtendedAttributes
|
private void readAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx)
{
for (Project.Assignments.Assignment.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
AssignmentField mpxFieldID = MPPAssignmentField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
}
|
java
|
private void readAssignmentExtendedAttributes(Project.Assignments.Assignment xml, ResourceAssignment mpx)
{
for (Project.Assignments.Assignment.ExtendedAttribute attrib : xml.getExtendedAttribute())
{
int xmlFieldID = Integer.parseInt(attrib.getFieldID()) & 0x0000FFFF;
AssignmentField mpxFieldID = MPPAssignmentField.getInstance(xmlFieldID);
TimeUnit durationFormat = DatatypeConverter.parseDurationTimeUnits(attrib.getDurationFormat(), null);
DatatypeConverter.parseExtendedAttribute(m_projectFile, mpx, attrib.getValue(), mpxFieldID, durationFormat);
}
}
|
[
"private",
"void",
"readAssignmentExtendedAttributes",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
"xml",
",",
"ResourceAssignment",
"mpx",
")",
"{",
"for",
"(",
"Project",
".",
"Assignments",
".",
"Assignment",
".",
"ExtendedAttribute",
"attrib",
":",
"xml",
".",
"getExtendedAttribute",
"(",
")",
")",
"{",
"int",
"xmlFieldID",
"=",
"Integer",
".",
"parseInt",
"(",
"attrib",
".",
"getFieldID",
"(",
")",
")",
"&",
"0x0000FFFF",
";",
"AssignmentField",
"mpxFieldID",
"=",
"MPPAssignmentField",
".",
"getInstance",
"(",
"xmlFieldID",
")",
";",
"TimeUnit",
"durationFormat",
"=",
"DatatypeConverter",
".",
"parseDurationTimeUnits",
"(",
"attrib",
".",
"getDurationFormat",
"(",
")",
",",
"null",
")",
";",
"DatatypeConverter",
".",
"parseExtendedAttribute",
"(",
"m_projectFile",
",",
"mpx",
",",
"attrib",
".",
"getValue",
"(",
")",
",",
"mpxFieldID",
",",
"durationFormat",
")",
";",
"}",
"}"
] |
This method processes any extended attributes associated with a
resource assignment.
@param xml MSPDI resource assignment instance
@param mpx MPX task instance
|
[
"This",
"method",
"processes",
"any",
"extended",
"attributes",
"associated",
"with",
"a",
"resource",
"assignment",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1721-L1730
|
157,353
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.isSplit
|
private boolean isSplit(ProjectCalendar calendar, List<TimephasedWork> list)
{
boolean result = false;
for (TimephasedWork assignment : list)
{
if (calendar != null && assignment.getTotalAmount().getDuration() == 0)
{
Duration calendarWork = calendar.getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.MINUTES);
if (calendarWork.getDuration() != 0)
{
result = true;
break;
}
}
}
return result;
}
|
java
|
private boolean isSplit(ProjectCalendar calendar, List<TimephasedWork> list)
{
boolean result = false;
for (TimephasedWork assignment : list)
{
if (calendar != null && assignment.getTotalAmount().getDuration() == 0)
{
Duration calendarWork = calendar.getWork(assignment.getStart(), assignment.getFinish(), TimeUnit.MINUTES);
if (calendarWork.getDuration() != 0)
{
result = true;
break;
}
}
}
return result;
}
|
[
"private",
"boolean",
"isSplit",
"(",
"ProjectCalendar",
"calendar",
",",
"List",
"<",
"TimephasedWork",
">",
"list",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"for",
"(",
"TimephasedWork",
"assignment",
":",
"list",
")",
"{",
"if",
"(",
"calendar",
"!=",
"null",
"&&",
"assignment",
".",
"getTotalAmount",
"(",
")",
".",
"getDuration",
"(",
")",
"==",
"0",
")",
"{",
"Duration",
"calendarWork",
"=",
"calendar",
".",
"getWork",
"(",
"assignment",
".",
"getStart",
"(",
")",
",",
"assignment",
".",
"getFinish",
"(",
")",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"if",
"(",
"calendarWork",
".",
"getDuration",
"(",
")",
"!=",
"0",
")",
"{",
"result",
"=",
"true",
";",
"break",
";",
"}",
"}",
"}",
"return",
"result",
";",
"}"
] |
Test to determine if this is a split task.
@param calendar current calendar
@param list timephased resource assignment list
@return boolean flag
|
[
"Test",
"to",
"determine",
"if",
"this",
"is",
"a",
"split",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1739-L1755
|
157,354
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java
|
MSPDIReader.readTimephasedAssignment
|
private LinkedList<TimephasedWork> readTimephasedAssignment(ProjectCalendar calendar, Project.Assignments.Assignment assignment, int type)
{
LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>();
for (TimephasedDataType item : assignment.getTimephasedData())
{
if (NumberHelper.getInt(item.getType()) != type)
{
continue;
}
Date startDate = item.getStart();
Date finishDate = item.getFinish();
// Exclude ranges which don't have a start and end date.
// These seem to be generated by Synchro and have a zero duration.
if (startDate == null && finishDate == null)
{
continue;
}
Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.MINUTES, item.getValue());
if (work == null)
{
work = Duration.getInstance(0, TimeUnit.MINUTES);
}
else
{
work = Duration.getInstance(NumberHelper.round(work.getDuration(), 2), TimeUnit.MINUTES);
}
TimephasedWork tra = new TimephasedWork();
tra.setStart(startDate);
tra.setFinish(finishDate);
tra.setTotalAmount(work);
result.add(tra);
}
return result;
}
|
java
|
private LinkedList<TimephasedWork> readTimephasedAssignment(ProjectCalendar calendar, Project.Assignments.Assignment assignment, int type)
{
LinkedList<TimephasedWork> result = new LinkedList<TimephasedWork>();
for (TimephasedDataType item : assignment.getTimephasedData())
{
if (NumberHelper.getInt(item.getType()) != type)
{
continue;
}
Date startDate = item.getStart();
Date finishDate = item.getFinish();
// Exclude ranges which don't have a start and end date.
// These seem to be generated by Synchro and have a zero duration.
if (startDate == null && finishDate == null)
{
continue;
}
Duration work = DatatypeConverter.parseDuration(m_projectFile, TimeUnit.MINUTES, item.getValue());
if (work == null)
{
work = Duration.getInstance(0, TimeUnit.MINUTES);
}
else
{
work = Duration.getInstance(NumberHelper.round(work.getDuration(), 2), TimeUnit.MINUTES);
}
TimephasedWork tra = new TimephasedWork();
tra.setStart(startDate);
tra.setFinish(finishDate);
tra.setTotalAmount(work);
result.add(tra);
}
return result;
}
|
[
"private",
"LinkedList",
"<",
"TimephasedWork",
">",
"readTimephasedAssignment",
"(",
"ProjectCalendar",
"calendar",
",",
"Project",
".",
"Assignments",
".",
"Assignment",
"assignment",
",",
"int",
"type",
")",
"{",
"LinkedList",
"<",
"TimephasedWork",
">",
"result",
"=",
"new",
"LinkedList",
"<",
"TimephasedWork",
">",
"(",
")",
";",
"for",
"(",
"TimephasedDataType",
"item",
":",
"assignment",
".",
"getTimephasedData",
"(",
")",
")",
"{",
"if",
"(",
"NumberHelper",
".",
"getInt",
"(",
"item",
".",
"getType",
"(",
")",
")",
"!=",
"type",
")",
"{",
"continue",
";",
"}",
"Date",
"startDate",
"=",
"item",
".",
"getStart",
"(",
")",
";",
"Date",
"finishDate",
"=",
"item",
".",
"getFinish",
"(",
")",
";",
"// Exclude ranges which don't have a start and end date.",
"// These seem to be generated by Synchro and have a zero duration.",
"if",
"(",
"startDate",
"==",
"null",
"&&",
"finishDate",
"==",
"null",
")",
"{",
"continue",
";",
"}",
"Duration",
"work",
"=",
"DatatypeConverter",
".",
"parseDuration",
"(",
"m_projectFile",
",",
"TimeUnit",
".",
"MINUTES",
",",
"item",
".",
"getValue",
"(",
")",
")",
";",
"if",
"(",
"work",
"==",
"null",
")",
"{",
"work",
"=",
"Duration",
".",
"getInstance",
"(",
"0",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"}",
"else",
"{",
"work",
"=",
"Duration",
".",
"getInstance",
"(",
"NumberHelper",
".",
"round",
"(",
"work",
".",
"getDuration",
"(",
")",
",",
"2",
")",
",",
"TimeUnit",
".",
"MINUTES",
")",
";",
"}",
"TimephasedWork",
"tra",
"=",
"new",
"TimephasedWork",
"(",
")",
";",
"tra",
".",
"setStart",
"(",
"startDate",
")",
";",
"tra",
".",
"setFinish",
"(",
"finishDate",
")",
";",
"tra",
".",
"setTotalAmount",
"(",
"work",
")",
";",
"result",
".",
"add",
"(",
"tra",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Reads timephased assignment data.
@param calendar current calendar
@param assignment assignment data
@param type flag indicating if this is planned or complete work
@return list of timephased resource assignment instances
|
[
"Reads",
"timephased",
"assignment",
"data",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mspdi/MSPDIReader.java#L1765-L1805
|
157,355
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.deriveResourceCalendar
|
private ProjectCalendar deriveResourceCalendar(Integer parentCalendarID)
{
ProjectCalendar calendar = m_project.addDefaultDerivedCalendar();
calendar.setUniqueID(Integer.valueOf(m_project.getProjectConfig().getNextCalendarUniqueID()));
calendar.setParent(m_project.getCalendarByUniqueID(parentCalendarID));
return calendar;
}
|
java
|
private ProjectCalendar deriveResourceCalendar(Integer parentCalendarID)
{
ProjectCalendar calendar = m_project.addDefaultDerivedCalendar();
calendar.setUniqueID(Integer.valueOf(m_project.getProjectConfig().getNextCalendarUniqueID()));
calendar.setParent(m_project.getCalendarByUniqueID(parentCalendarID));
return calendar;
}
|
[
"private",
"ProjectCalendar",
"deriveResourceCalendar",
"(",
"Integer",
"parentCalendarID",
")",
"{",
"ProjectCalendar",
"calendar",
"=",
"m_project",
".",
"addDefaultDerivedCalendar",
"(",
")",
";",
"calendar",
".",
"setUniqueID",
"(",
"Integer",
".",
"valueOf",
"(",
"m_project",
".",
"getProjectConfig",
"(",
")",
".",
"getNextCalendarUniqueID",
"(",
")",
")",
")",
";",
"calendar",
".",
"setParent",
"(",
"m_project",
".",
"getCalendarByUniqueID",
"(",
"parentCalendarID",
")",
")",
";",
"return",
"calendar",
";",
"}"
] |
Derive a calendar for a resource.
@param parentCalendarID calendar from which resource calendar is derived
@return new calendar for a resource
|
[
"Derive",
"a",
"calendar",
"for",
"a",
"resource",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L182-L188
|
157,356
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.processTasks
|
public void processTasks(List<Row> bars, List<Row> expandedTasks, List<Row> tasks, List<Row> milestones)
{
List<Row> parentBars = buildRowHierarchy(bars, expandedTasks, tasks, milestones);
createTasks(m_project, "", parentBars);
deriveProjectCalendar();
updateStructure();
}
|
java
|
public void processTasks(List<Row> bars, List<Row> expandedTasks, List<Row> tasks, List<Row> milestones)
{
List<Row> parentBars = buildRowHierarchy(bars, expandedTasks, tasks, milestones);
createTasks(m_project, "", parentBars);
deriveProjectCalendar();
updateStructure();
}
|
[
"public",
"void",
"processTasks",
"(",
"List",
"<",
"Row",
">",
"bars",
",",
"List",
"<",
"Row",
">",
"expandedTasks",
",",
"List",
"<",
"Row",
">",
"tasks",
",",
"List",
"<",
"Row",
">",
"milestones",
")",
"{",
"List",
"<",
"Row",
">",
"parentBars",
"=",
"buildRowHierarchy",
"(",
"bars",
",",
"expandedTasks",
",",
"tasks",
",",
"milestones",
")",
";",
"createTasks",
"(",
"m_project",
",",
"\"\"",
",",
"parentBars",
")",
";",
"deriveProjectCalendar",
"(",
")",
";",
"updateStructure",
"(",
")",
";",
"}"
] |
Organises the data from Asta into a hierarchy and converts this into tasks.
@param bars bar data
@param expandedTasks expanded task data
@param tasks task data
@param milestones milestone data
|
[
"Organises",
"the",
"data",
"from",
"Asta",
"into",
"a",
"hierarchy",
"and",
"converts",
"this",
"into",
"tasks",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L198-L204
|
157,357
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.buildRowHierarchy
|
private List<Row> buildRowHierarchy(List<Row> bars, List<Row> expandedTasks, List<Row> tasks, List<Row> milestones)
{
//
// Create a list of leaf nodes by merging the task and milestone lists
//
List<Row> leaves = new ArrayList<Row>();
leaves.addAll(tasks);
leaves.addAll(milestones);
//
// Sort the bars and the leaves
//
Collections.sort(bars, BAR_COMPARATOR);
Collections.sort(leaves, LEAF_COMPARATOR);
//
// Map bar IDs to bars
//
Map<Integer, Row> barIdToBarMap = new HashMap<Integer, Row>();
for (Row bar : bars)
{
barIdToBarMap.put(bar.getInteger("BARID"), bar);
}
//
// Merge expanded task attributes with parent bars
// and create an expanded task ID to bar map.
//
Map<Integer, Row> expandedTaskIdToBarMap = new HashMap<Integer, Row>();
for (Row expandedTask : expandedTasks)
{
Row bar = barIdToBarMap.get(expandedTask.getInteger("BAR"));
bar.merge(expandedTask, "_");
Integer expandedTaskID = bar.getInteger("_EXPANDED_TASKID");
expandedTaskIdToBarMap.put(expandedTaskID, bar);
}
//
// Build the hierarchy
//
List<Row> parentBars = new ArrayList<Row>();
for (Row bar : bars)
{
Integer expandedTaskID = bar.getInteger("EXPANDED_TASK");
Row parentBar = expandedTaskIdToBarMap.get(expandedTaskID);
if (parentBar == null)
{
parentBars.add(bar);
}
else
{
parentBar.addChild(bar);
}
}
//
// Attach the leaves
//
for (Row leaf : leaves)
{
Integer barID = leaf.getInteger("BAR");
Row bar = barIdToBarMap.get(barID);
bar.addChild(leaf);
}
//
// Prune any "displaced items" from the top level.
// We're using a heuristic here as this is the only thing I
// can see which differs between bars that we want to include
// and bars that we want to exclude.
//
Iterator<Row> iter = parentBars.iterator();
while (iter.hasNext())
{
Row bar = iter.next();
String barName = bar.getString("NAMH");
if (barName == null || barName.isEmpty() || barName.equals("Displaced Items"))
{
iter.remove();
}
}
//
// If we only have a single top level node (effectively a summary task) prune that too.
//
if (parentBars.size() == 1)
{
parentBars = parentBars.get(0).getChildRows();
}
return parentBars;
}
|
java
|
private List<Row> buildRowHierarchy(List<Row> bars, List<Row> expandedTasks, List<Row> tasks, List<Row> milestones)
{
//
// Create a list of leaf nodes by merging the task and milestone lists
//
List<Row> leaves = new ArrayList<Row>();
leaves.addAll(tasks);
leaves.addAll(milestones);
//
// Sort the bars and the leaves
//
Collections.sort(bars, BAR_COMPARATOR);
Collections.sort(leaves, LEAF_COMPARATOR);
//
// Map bar IDs to bars
//
Map<Integer, Row> barIdToBarMap = new HashMap<Integer, Row>();
for (Row bar : bars)
{
barIdToBarMap.put(bar.getInteger("BARID"), bar);
}
//
// Merge expanded task attributes with parent bars
// and create an expanded task ID to bar map.
//
Map<Integer, Row> expandedTaskIdToBarMap = new HashMap<Integer, Row>();
for (Row expandedTask : expandedTasks)
{
Row bar = barIdToBarMap.get(expandedTask.getInteger("BAR"));
bar.merge(expandedTask, "_");
Integer expandedTaskID = bar.getInteger("_EXPANDED_TASKID");
expandedTaskIdToBarMap.put(expandedTaskID, bar);
}
//
// Build the hierarchy
//
List<Row> parentBars = new ArrayList<Row>();
for (Row bar : bars)
{
Integer expandedTaskID = bar.getInteger("EXPANDED_TASK");
Row parentBar = expandedTaskIdToBarMap.get(expandedTaskID);
if (parentBar == null)
{
parentBars.add(bar);
}
else
{
parentBar.addChild(bar);
}
}
//
// Attach the leaves
//
for (Row leaf : leaves)
{
Integer barID = leaf.getInteger("BAR");
Row bar = barIdToBarMap.get(barID);
bar.addChild(leaf);
}
//
// Prune any "displaced items" from the top level.
// We're using a heuristic here as this is the only thing I
// can see which differs between bars that we want to include
// and bars that we want to exclude.
//
Iterator<Row> iter = parentBars.iterator();
while (iter.hasNext())
{
Row bar = iter.next();
String barName = bar.getString("NAMH");
if (barName == null || barName.isEmpty() || barName.equals("Displaced Items"))
{
iter.remove();
}
}
//
// If we only have a single top level node (effectively a summary task) prune that too.
//
if (parentBars.size() == 1)
{
parentBars = parentBars.get(0).getChildRows();
}
return parentBars;
}
|
[
"private",
"List",
"<",
"Row",
">",
"buildRowHierarchy",
"(",
"List",
"<",
"Row",
">",
"bars",
",",
"List",
"<",
"Row",
">",
"expandedTasks",
",",
"List",
"<",
"Row",
">",
"tasks",
",",
"List",
"<",
"Row",
">",
"milestones",
")",
"{",
"//",
"// Create a list of leaf nodes by merging the task and milestone lists",
"//",
"List",
"<",
"Row",
">",
"leaves",
"=",
"new",
"ArrayList",
"<",
"Row",
">",
"(",
")",
";",
"leaves",
".",
"addAll",
"(",
"tasks",
")",
";",
"leaves",
".",
"addAll",
"(",
"milestones",
")",
";",
"//",
"// Sort the bars and the leaves",
"//",
"Collections",
".",
"sort",
"(",
"bars",
",",
"BAR_COMPARATOR",
")",
";",
"Collections",
".",
"sort",
"(",
"leaves",
",",
"LEAF_COMPARATOR",
")",
";",
"//",
"// Map bar IDs to bars",
"//",
"Map",
"<",
"Integer",
",",
"Row",
">",
"barIdToBarMap",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Row",
">",
"(",
")",
";",
"for",
"(",
"Row",
"bar",
":",
"bars",
")",
"{",
"barIdToBarMap",
".",
"put",
"(",
"bar",
".",
"getInteger",
"(",
"\"BARID\"",
")",
",",
"bar",
")",
";",
"}",
"//",
"// Merge expanded task attributes with parent bars",
"// and create an expanded task ID to bar map.",
"//",
"Map",
"<",
"Integer",
",",
"Row",
">",
"expandedTaskIdToBarMap",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Row",
">",
"(",
")",
";",
"for",
"(",
"Row",
"expandedTask",
":",
"expandedTasks",
")",
"{",
"Row",
"bar",
"=",
"barIdToBarMap",
".",
"get",
"(",
"expandedTask",
".",
"getInteger",
"(",
"\"BAR\"",
")",
")",
";",
"bar",
".",
"merge",
"(",
"expandedTask",
",",
"\"_\"",
")",
";",
"Integer",
"expandedTaskID",
"=",
"bar",
".",
"getInteger",
"(",
"\"_EXPANDED_TASKID\"",
")",
";",
"expandedTaskIdToBarMap",
".",
"put",
"(",
"expandedTaskID",
",",
"bar",
")",
";",
"}",
"//",
"// Build the hierarchy",
"//",
"List",
"<",
"Row",
">",
"parentBars",
"=",
"new",
"ArrayList",
"<",
"Row",
">",
"(",
")",
";",
"for",
"(",
"Row",
"bar",
":",
"bars",
")",
"{",
"Integer",
"expandedTaskID",
"=",
"bar",
".",
"getInteger",
"(",
"\"EXPANDED_TASK\"",
")",
";",
"Row",
"parentBar",
"=",
"expandedTaskIdToBarMap",
".",
"get",
"(",
"expandedTaskID",
")",
";",
"if",
"(",
"parentBar",
"==",
"null",
")",
"{",
"parentBars",
".",
"add",
"(",
"bar",
")",
";",
"}",
"else",
"{",
"parentBar",
".",
"addChild",
"(",
"bar",
")",
";",
"}",
"}",
"//",
"// Attach the leaves",
"//",
"for",
"(",
"Row",
"leaf",
":",
"leaves",
")",
"{",
"Integer",
"barID",
"=",
"leaf",
".",
"getInteger",
"(",
"\"BAR\"",
")",
";",
"Row",
"bar",
"=",
"barIdToBarMap",
".",
"get",
"(",
"barID",
")",
";",
"bar",
".",
"addChild",
"(",
"leaf",
")",
";",
"}",
"//",
"// Prune any \"displaced items\" from the top level.",
"// We're using a heuristic here as this is the only thing I",
"// can see which differs between bars that we want to include",
"// and bars that we want to exclude.",
"//",
"Iterator",
"<",
"Row",
">",
"iter",
"=",
"parentBars",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"iter",
".",
"hasNext",
"(",
")",
")",
"{",
"Row",
"bar",
"=",
"iter",
".",
"next",
"(",
")",
";",
"String",
"barName",
"=",
"bar",
".",
"getString",
"(",
"\"NAMH\"",
")",
";",
"if",
"(",
"barName",
"==",
"null",
"||",
"barName",
".",
"isEmpty",
"(",
")",
"||",
"barName",
".",
"equals",
"(",
"\"Displaced Items\"",
")",
")",
"{",
"iter",
".",
"remove",
"(",
")",
";",
"}",
"}",
"//",
"// If we only have a single top level node (effectively a summary task) prune that too.",
"//",
"if",
"(",
"parentBars",
".",
"size",
"(",
")",
"==",
"1",
")",
"{",
"parentBars",
"=",
"parentBars",
".",
"get",
"(",
"0",
")",
".",
"getChildRows",
"(",
")",
";",
"}",
"return",
"parentBars",
";",
"}"
] |
Builds the task hierarchy.
Note that there are two distinct levels of organisation going on here. The first is the
Asta "summary" organisation, where the user organises bars into summary groups. We are using this
to create our hierarchy of tasks.
The second level displayed within a summary group (or at the project level if the user has not
created summary groups) is the WBS. At the moment we are not including the WBS in the hierarchy.
@param bars bar data
@param expandedTasks expanded task data
@param tasks task data
@param milestones milestone data
@return list containing the top level tasks
|
[
"Builds",
"the",
"task",
"hierarchy",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L222-L313
|
157,358
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.createTasks
|
private void createTasks(ChildTaskContainer parent, String parentName, List<Row> rows)
{
for (Row row : rows)
{
boolean rowIsBar = (row.getInteger("BARID") != null);
//
// Don't export hammock tasks.
//
if (rowIsBar && row.getChildRows().isEmpty())
{
continue;
}
Task task = parent.addTask();
//
// Do we have a bar, task, or milestone?
//
if (rowIsBar)
{
//
// If the bar only has one child task, we skip it and add the task directly
//
if (skipBar(row))
{
populateLeaf(row.getString("NAMH"), row.getChildRows().get(0), task);
}
else
{
populateBar(row, task);
createTasks(task, task.getName(), row.getChildRows());
}
}
else
{
populateLeaf(parentName, row, task);
}
m_eventManager.fireTaskReadEvent(task);
}
}
|
java
|
private void createTasks(ChildTaskContainer parent, String parentName, List<Row> rows)
{
for (Row row : rows)
{
boolean rowIsBar = (row.getInteger("BARID") != null);
//
// Don't export hammock tasks.
//
if (rowIsBar && row.getChildRows().isEmpty())
{
continue;
}
Task task = parent.addTask();
//
// Do we have a bar, task, or milestone?
//
if (rowIsBar)
{
//
// If the bar only has one child task, we skip it and add the task directly
//
if (skipBar(row))
{
populateLeaf(row.getString("NAMH"), row.getChildRows().get(0), task);
}
else
{
populateBar(row, task);
createTasks(task, task.getName(), row.getChildRows());
}
}
else
{
populateLeaf(parentName, row, task);
}
m_eventManager.fireTaskReadEvent(task);
}
}
|
[
"private",
"void",
"createTasks",
"(",
"ChildTaskContainer",
"parent",
",",
"String",
"parentName",
",",
"List",
"<",
"Row",
">",
"rows",
")",
"{",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"boolean",
"rowIsBar",
"=",
"(",
"row",
".",
"getInteger",
"(",
"\"BARID\"",
")",
"!=",
"null",
")",
";",
"//",
"// Don't export hammock tasks.",
"//",
"if",
"(",
"rowIsBar",
"&&",
"row",
".",
"getChildRows",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"continue",
";",
"}",
"Task",
"task",
"=",
"parent",
".",
"addTask",
"(",
")",
";",
"//",
"// Do we have a bar, task, or milestone?",
"//",
"if",
"(",
"rowIsBar",
")",
"{",
"//",
"// If the bar only has one child task, we skip it and add the task directly",
"//",
"if",
"(",
"skipBar",
"(",
"row",
")",
")",
"{",
"populateLeaf",
"(",
"row",
".",
"getString",
"(",
"\"NAMH\"",
")",
",",
"row",
".",
"getChildRows",
"(",
")",
".",
"get",
"(",
"0",
")",
",",
"task",
")",
";",
"}",
"else",
"{",
"populateBar",
"(",
"row",
",",
"task",
")",
";",
"createTasks",
"(",
"task",
",",
"task",
".",
"getName",
"(",
")",
",",
"row",
".",
"getChildRows",
"(",
")",
")",
";",
"}",
"}",
"else",
"{",
"populateLeaf",
"(",
"parentName",
",",
"row",
",",
"task",
")",
";",
"}",
"m_eventManager",
".",
"fireTaskReadEvent",
"(",
"task",
")",
";",
"}",
"}"
] |
Recursively descend through the hierarchy creating tasks.
@param parent parent task
@param parentName parent name
@param rows rows to add as tasks to this parent
|
[
"Recursively",
"descend",
"through",
"the",
"hierarchy",
"creating",
"tasks",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L322-L363
|
157,359
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.skipBar
|
private boolean skipBar(Row row)
{
List<Row> childRows = row.getChildRows();
return childRows.size() == 1 && childRows.get(0).getChildRows().isEmpty();
}
|
java
|
private boolean skipBar(Row row)
{
List<Row> childRows = row.getChildRows();
return childRows.size() == 1 && childRows.get(0).getChildRows().isEmpty();
}
|
[
"private",
"boolean",
"skipBar",
"(",
"Row",
"row",
")",
"{",
"List",
"<",
"Row",
">",
"childRows",
"=",
"row",
".",
"getChildRows",
"(",
")",
";",
"return",
"childRows",
".",
"size",
"(",
")",
"==",
"1",
"&&",
"childRows",
".",
"get",
"(",
"0",
")",
".",
"getChildRows",
"(",
")",
".",
"isEmpty",
"(",
")",
";",
"}"
] |
Returns true if we should skip this bar, i.e. the bar only has a single child task.
@param row bar row to test
@return true if this bar should be skipped
|
[
"Returns",
"true",
"if",
"we",
"should",
"skip",
"this",
"bar",
"i",
".",
"e",
".",
"the",
"bar",
"only",
"has",
"a",
"single",
"child",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L371-L375
|
157,360
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.populateLeaf
|
private void populateLeaf(String parentName, Row row, Task task)
{
if (row.getInteger("TASKID") != null)
{
populateTask(row, task);
}
else
{
populateMilestone(row, task);
}
String name = task.getName();
if (name == null || name.isEmpty())
{
task.setName(parentName);
}
}
|
java
|
private void populateLeaf(String parentName, Row row, Task task)
{
if (row.getInteger("TASKID") != null)
{
populateTask(row, task);
}
else
{
populateMilestone(row, task);
}
String name = task.getName();
if (name == null || name.isEmpty())
{
task.setName(parentName);
}
}
|
[
"private",
"void",
"populateLeaf",
"(",
"String",
"parentName",
",",
"Row",
"row",
",",
"Task",
"task",
")",
"{",
"if",
"(",
"row",
".",
"getInteger",
"(",
"\"TASKID\"",
")",
"!=",
"null",
")",
"{",
"populateTask",
"(",
"row",
",",
"task",
")",
";",
"}",
"else",
"{",
"populateMilestone",
"(",
"row",
",",
"task",
")",
";",
"}",
"String",
"name",
"=",
"task",
".",
"getName",
"(",
")",
";",
"if",
"(",
"name",
"==",
"null",
"||",
"name",
".",
"isEmpty",
"(",
")",
")",
"{",
"task",
".",
"setName",
"(",
"parentName",
")",
";",
"}",
"}"
] |
Adds a leaf node, which could be a task or a milestone.
@param parentName parent bar name
@param row row to add
@param task task to populate with data from the row
|
[
"Adds",
"a",
"leaf",
"node",
"which",
"could",
"be",
"a",
"task",
"or",
"a",
"milestone",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L384-L400
|
157,361
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.populateTask
|
private void populateTask(Row row, Task task)
{
//"PROJID"
task.setUniqueID(row.getInteger("TASKID"));
//GIVEN_DURATIONTYPF
//GIVEN_DURATIONELA_MONTHS
task.setDuration(row.getDuration("GIVEN_DURATIONHOURS"));
task.setResume(row.getDate("RESUME"));
//task.setStart(row.getDate("GIVEN_START"));
//LATEST_PROGRESS_PERIOD
//TASK_WORK_RATE_TIME_UNIT
//TASK_WORK_RATE
//PLACEMENT
//BEEN_SPLIT
//INTERRUPTIBLE
//HOLDING_PIN
///ACTUAL_DURATIONTYPF
//ACTUAL_DURATIONELA_MONTHS
task.setActualDuration(row.getDuration("ACTUAL_DURATIONHOURS"));
task.setEarlyStart(row.getDate("EARLY_START_DATE"));
task.setLateStart(row.getDate("LATE_START_DATE"));
//FREE_START_DATE
//START_CONSTRAINT_DATE
//END_CONSTRAINT_DATE
//task.setBaselineWork(row.getDuration("EFFORT_BUDGET"));
//NATURAO_ORDER
//LOGICAL_PRECEDENCE
//SPAVE_INTEGER
//SWIM_LANE
//USER_PERCENT_COMPLETE
task.setPercentageComplete(row.getDouble("OVERALL_PERCENV_COMPLETE"));
//OVERALL_PERCENT_COMPL_WEIGHT
task.setName(row.getString("NARE"));
task.setNotes(getNotes(row));
task.setText(1, row.getString("UNIQUE_TASK_ID"));
task.setCalendar(m_project.getCalendarByUniqueID(row.getInteger("CALENDAU")));
//EFFORT_TIMI_UNIT
//WORL_UNIT
//LATEST_ALLOC_PROGRESS_PERIOD
//WORN
//BAR
//CONSTRAINU
//PRIORITB
//CRITICAM
//USE_PARENU_CALENDAR
//BUFFER_TASK
//MARK_FOS_HIDING
//OWNED_BY_TIMESHEEV_X
//START_ON_NEX_DAY
//LONGEST_PATH
//DURATIOTTYPF
//DURATIOTELA_MONTHS
//DURATIOTHOURS
task.setStart(row.getDate("STARZ"));
task.setFinish(row.getDate("ENJ"));
//DURATION_TIMJ_UNIT
//UNSCHEDULABLG
//SUBPROJECT_ID
//ALT_ID
//LAST_EDITED_DATE
//LAST_EDITED_BY
processConstraints(row, task);
if (NumberHelper.getInt(task.getPercentageComplete()) != 0)
{
task.setActualStart(task.getStart());
if (task.getPercentageComplete().intValue() == 100)
{
task.setActualFinish(task.getFinish());
task.setDuration(task.getActualDuration());
}
}
}
|
java
|
private void populateTask(Row row, Task task)
{
//"PROJID"
task.setUniqueID(row.getInteger("TASKID"));
//GIVEN_DURATIONTYPF
//GIVEN_DURATIONELA_MONTHS
task.setDuration(row.getDuration("GIVEN_DURATIONHOURS"));
task.setResume(row.getDate("RESUME"));
//task.setStart(row.getDate("GIVEN_START"));
//LATEST_PROGRESS_PERIOD
//TASK_WORK_RATE_TIME_UNIT
//TASK_WORK_RATE
//PLACEMENT
//BEEN_SPLIT
//INTERRUPTIBLE
//HOLDING_PIN
///ACTUAL_DURATIONTYPF
//ACTUAL_DURATIONELA_MONTHS
task.setActualDuration(row.getDuration("ACTUAL_DURATIONHOURS"));
task.setEarlyStart(row.getDate("EARLY_START_DATE"));
task.setLateStart(row.getDate("LATE_START_DATE"));
//FREE_START_DATE
//START_CONSTRAINT_DATE
//END_CONSTRAINT_DATE
//task.setBaselineWork(row.getDuration("EFFORT_BUDGET"));
//NATURAO_ORDER
//LOGICAL_PRECEDENCE
//SPAVE_INTEGER
//SWIM_LANE
//USER_PERCENT_COMPLETE
task.setPercentageComplete(row.getDouble("OVERALL_PERCENV_COMPLETE"));
//OVERALL_PERCENT_COMPL_WEIGHT
task.setName(row.getString("NARE"));
task.setNotes(getNotes(row));
task.setText(1, row.getString("UNIQUE_TASK_ID"));
task.setCalendar(m_project.getCalendarByUniqueID(row.getInteger("CALENDAU")));
//EFFORT_TIMI_UNIT
//WORL_UNIT
//LATEST_ALLOC_PROGRESS_PERIOD
//WORN
//BAR
//CONSTRAINU
//PRIORITB
//CRITICAM
//USE_PARENU_CALENDAR
//BUFFER_TASK
//MARK_FOS_HIDING
//OWNED_BY_TIMESHEEV_X
//START_ON_NEX_DAY
//LONGEST_PATH
//DURATIOTTYPF
//DURATIOTELA_MONTHS
//DURATIOTHOURS
task.setStart(row.getDate("STARZ"));
task.setFinish(row.getDate("ENJ"));
//DURATION_TIMJ_UNIT
//UNSCHEDULABLG
//SUBPROJECT_ID
//ALT_ID
//LAST_EDITED_DATE
//LAST_EDITED_BY
processConstraints(row, task);
if (NumberHelper.getInt(task.getPercentageComplete()) != 0)
{
task.setActualStart(task.getStart());
if (task.getPercentageComplete().intValue() == 100)
{
task.setActualFinish(task.getFinish());
task.setDuration(task.getActualDuration());
}
}
}
|
[
"private",
"void",
"populateTask",
"(",
"Row",
"row",
",",
"Task",
"task",
")",
"{",
"//\"PROJID\"",
"task",
".",
"setUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"TASKID\"",
")",
")",
";",
"//GIVEN_DURATIONTYPF",
"//GIVEN_DURATIONELA_MONTHS",
"task",
".",
"setDuration",
"(",
"row",
".",
"getDuration",
"(",
"\"GIVEN_DURATIONHOURS\"",
")",
")",
";",
"task",
".",
"setResume",
"(",
"row",
".",
"getDate",
"(",
"\"RESUME\"",
")",
")",
";",
"//task.setStart(row.getDate(\"GIVEN_START\"));",
"//LATEST_PROGRESS_PERIOD",
"//TASK_WORK_RATE_TIME_UNIT",
"//TASK_WORK_RATE",
"//PLACEMENT",
"//BEEN_SPLIT",
"//INTERRUPTIBLE",
"//HOLDING_PIN",
"///ACTUAL_DURATIONTYPF",
"//ACTUAL_DURATIONELA_MONTHS",
"task",
".",
"setActualDuration",
"(",
"row",
".",
"getDuration",
"(",
"\"ACTUAL_DURATIONHOURS\"",
")",
")",
";",
"task",
".",
"setEarlyStart",
"(",
"row",
".",
"getDate",
"(",
"\"EARLY_START_DATE\"",
")",
")",
";",
"task",
".",
"setLateStart",
"(",
"row",
".",
"getDate",
"(",
"\"LATE_START_DATE\"",
")",
")",
";",
"//FREE_START_DATE",
"//START_CONSTRAINT_DATE",
"//END_CONSTRAINT_DATE",
"//task.setBaselineWork(row.getDuration(\"EFFORT_BUDGET\"));",
"//NATURAO_ORDER",
"//LOGICAL_PRECEDENCE",
"//SPAVE_INTEGER",
"//SWIM_LANE",
"//USER_PERCENT_COMPLETE",
"task",
".",
"setPercentageComplete",
"(",
"row",
".",
"getDouble",
"(",
"\"OVERALL_PERCENV_COMPLETE\"",
")",
")",
";",
"//OVERALL_PERCENT_COMPL_WEIGHT",
"task",
".",
"setName",
"(",
"row",
".",
"getString",
"(",
"\"NARE\"",
")",
")",
";",
"task",
".",
"setNotes",
"(",
"getNotes",
"(",
"row",
")",
")",
";",
"task",
".",
"setText",
"(",
"1",
",",
"row",
".",
"getString",
"(",
"\"UNIQUE_TASK_ID\"",
")",
")",
";",
"task",
".",
"setCalendar",
"(",
"m_project",
".",
"getCalendarByUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"CALENDAU\"",
")",
")",
")",
";",
"//EFFORT_TIMI_UNIT",
"//WORL_UNIT",
"//LATEST_ALLOC_PROGRESS_PERIOD",
"//WORN",
"//BAR",
"//CONSTRAINU",
"//PRIORITB",
"//CRITICAM",
"//USE_PARENU_CALENDAR",
"//BUFFER_TASK",
"//MARK_FOS_HIDING",
"//OWNED_BY_TIMESHEEV_X",
"//START_ON_NEX_DAY",
"//LONGEST_PATH",
"//DURATIOTTYPF",
"//DURATIOTELA_MONTHS",
"//DURATIOTHOURS",
"task",
".",
"setStart",
"(",
"row",
".",
"getDate",
"(",
"\"STARZ\"",
")",
")",
";",
"task",
".",
"setFinish",
"(",
"row",
".",
"getDate",
"(",
"\"ENJ\"",
")",
")",
";",
"//DURATION_TIMJ_UNIT",
"//UNSCHEDULABLG",
"//SUBPROJECT_ID",
"//ALT_ID",
"//LAST_EDITED_DATE",
"//LAST_EDITED_BY",
"processConstraints",
"(",
"row",
",",
"task",
")",
";",
"if",
"(",
"NumberHelper",
".",
"getInt",
"(",
"task",
".",
"getPercentageComplete",
"(",
")",
")",
"!=",
"0",
")",
"{",
"task",
".",
"setActualStart",
"(",
"task",
".",
"getStart",
"(",
")",
")",
";",
"if",
"(",
"task",
".",
"getPercentageComplete",
"(",
")",
".",
"intValue",
"(",
")",
"==",
"100",
")",
"{",
"task",
".",
"setActualFinish",
"(",
"task",
".",
"getFinish",
"(",
")",
")",
";",
"task",
".",
"setDuration",
"(",
"task",
".",
"getActualDuration",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
Populate a task from a Row instance.
@param row Row instance
@param task Task instance
|
[
"Populate",
"a",
"task",
"from",
"a",
"Row",
"instance",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L408-L481
|
157,362
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.populateBar
|
private void populateBar(Row row, Task task)
{
Integer calendarID = row.getInteger("CALENDAU");
ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
//PROJID
task.setUniqueID(row.getInteger("BARID"));
task.setStart(row.getDate("STARV"));
task.setFinish(row.getDate("ENF"));
//NATURAL_ORDER
//SPARI_INTEGER
task.setName(row.getString("NAMH"));
//EXPANDED_TASK
//PRIORITY
//UNSCHEDULABLE
//MARK_FOR_HIDING
//TASKS_MAY_OVERLAP
//SUBPROJECT_ID
//ALT_ID
//LAST_EDITED_DATE
//LAST_EDITED_BY
//Proc_Approve
//Proc_Design_info
//Proc_Proc_Dur
//Proc_Procurement
//Proc_SC_design
//Proc_Select_SC
//Proc_Tender
//QA Checked
//Related_Documents
task.setCalendar(calendar);
}
|
java
|
private void populateBar(Row row, Task task)
{
Integer calendarID = row.getInteger("CALENDAU");
ProjectCalendar calendar = m_project.getCalendarByUniqueID(calendarID);
//PROJID
task.setUniqueID(row.getInteger("BARID"));
task.setStart(row.getDate("STARV"));
task.setFinish(row.getDate("ENF"));
//NATURAL_ORDER
//SPARI_INTEGER
task.setName(row.getString("NAMH"));
//EXPANDED_TASK
//PRIORITY
//UNSCHEDULABLE
//MARK_FOR_HIDING
//TASKS_MAY_OVERLAP
//SUBPROJECT_ID
//ALT_ID
//LAST_EDITED_DATE
//LAST_EDITED_BY
//Proc_Approve
//Proc_Design_info
//Proc_Proc_Dur
//Proc_Procurement
//Proc_SC_design
//Proc_Select_SC
//Proc_Tender
//QA Checked
//Related_Documents
task.setCalendar(calendar);
}
|
[
"private",
"void",
"populateBar",
"(",
"Row",
"row",
",",
"Task",
"task",
")",
"{",
"Integer",
"calendarID",
"=",
"row",
".",
"getInteger",
"(",
"\"CALENDAU\"",
")",
";",
"ProjectCalendar",
"calendar",
"=",
"m_project",
".",
"getCalendarByUniqueID",
"(",
"calendarID",
")",
";",
"//PROJID",
"task",
".",
"setUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"BARID\"",
")",
")",
";",
"task",
".",
"setStart",
"(",
"row",
".",
"getDate",
"(",
"\"STARV\"",
")",
")",
";",
"task",
".",
"setFinish",
"(",
"row",
".",
"getDate",
"(",
"\"ENF\"",
")",
")",
";",
"//NATURAL_ORDER",
"//SPARI_INTEGER",
"task",
".",
"setName",
"(",
"row",
".",
"getString",
"(",
"\"NAMH\"",
")",
")",
";",
"//EXPANDED_TASK",
"//PRIORITY",
"//UNSCHEDULABLE",
"//MARK_FOR_HIDING",
"//TASKS_MAY_OVERLAP",
"//SUBPROJECT_ID",
"//ALT_ID",
"//LAST_EDITED_DATE",
"//LAST_EDITED_BY",
"//Proc_Approve",
"//Proc_Design_info",
"//Proc_Proc_Dur",
"//Proc_Procurement",
"//Proc_SC_design",
"//Proc_Select_SC",
"//Proc_Tender",
"//QA Checked",
"//Related_Documents",
"task",
".",
"setCalendar",
"(",
"calendar",
")",
";",
"}"
] |
Uses data from a bar to populate a task.
@param row bar data
@param task task to populate
|
[
"Uses",
"data",
"from",
"a",
"bar",
"to",
"populate",
"a",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L489-L520
|
157,363
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.populateMilestone
|
private void populateMilestone(Row row, Task task)
{
task.setMilestone(true);
//PROJID
task.setUniqueID(row.getInteger("MILESTONEID"));
task.setStart(row.getDate("GIVEN_DATE_TIME"));
task.setFinish(row.getDate("GIVEN_DATE_TIME"));
//PROGREST_PERIOD
//SYMBOL_APPEARANCE
//MILESTONE_TYPE
//PLACEMENU
task.setPercentageComplete(row.getBoolean("COMPLETED") ? COMPLETE : INCOMPLETE);
//INTERRUPTIBLE_X
//ACTUAL_DURATIONTYPF
//ACTUAL_DURATIONELA_MONTHS
//ACTUAL_DURATIONHOURS
task.setEarlyStart(row.getDate("EARLY_START_DATE"));
task.setLateStart(row.getDate("LATE_START_DATE"));
//FREE_START_DATE
//START_CONSTRAINT_DATE
//END_CONSTRAINT_DATE
//EFFORT_BUDGET
//NATURAO_ORDER
//LOGICAL_PRECEDENCE
//SPAVE_INTEGER
//SWIM_LANE
//USER_PERCENT_COMPLETE
//OVERALL_PERCENV_COMPLETE
//OVERALL_PERCENT_COMPL_WEIGHT
task.setName(row.getString("NARE"));
//NOTET
task.setText(1, row.getString("UNIQUE_TASK_ID"));
task.setCalendar(m_project.getCalendarByUniqueID(row.getInteger("CALENDAU")));
//EFFORT_TIMI_UNIT
//WORL_UNIT
//LATEST_ALLOC_PROGRESS_PERIOD
//WORN
//CONSTRAINU
//PRIORITB
//CRITICAM
//USE_PARENU_CALENDAR
//BUFFER_TASK
//MARK_FOS_HIDING
//OWNED_BY_TIMESHEEV_X
//START_ON_NEX_DAY
//LONGEST_PATH
//DURATIOTTYPF
//DURATIOTELA_MONTHS
//DURATIOTHOURS
//STARZ
//ENJ
//DURATION_TIMJ_UNIT
//UNSCHEDULABLG
//SUBPROJECT_ID
//ALT_ID
//LAST_EDITED_DATE
//LAST_EDITED_BY
task.setDuration(Duration.getInstance(0, TimeUnit.HOURS));
}
|
java
|
private void populateMilestone(Row row, Task task)
{
task.setMilestone(true);
//PROJID
task.setUniqueID(row.getInteger("MILESTONEID"));
task.setStart(row.getDate("GIVEN_DATE_TIME"));
task.setFinish(row.getDate("GIVEN_DATE_TIME"));
//PROGREST_PERIOD
//SYMBOL_APPEARANCE
//MILESTONE_TYPE
//PLACEMENU
task.setPercentageComplete(row.getBoolean("COMPLETED") ? COMPLETE : INCOMPLETE);
//INTERRUPTIBLE_X
//ACTUAL_DURATIONTYPF
//ACTUAL_DURATIONELA_MONTHS
//ACTUAL_DURATIONHOURS
task.setEarlyStart(row.getDate("EARLY_START_DATE"));
task.setLateStart(row.getDate("LATE_START_DATE"));
//FREE_START_DATE
//START_CONSTRAINT_DATE
//END_CONSTRAINT_DATE
//EFFORT_BUDGET
//NATURAO_ORDER
//LOGICAL_PRECEDENCE
//SPAVE_INTEGER
//SWIM_LANE
//USER_PERCENT_COMPLETE
//OVERALL_PERCENV_COMPLETE
//OVERALL_PERCENT_COMPL_WEIGHT
task.setName(row.getString("NARE"));
//NOTET
task.setText(1, row.getString("UNIQUE_TASK_ID"));
task.setCalendar(m_project.getCalendarByUniqueID(row.getInteger("CALENDAU")));
//EFFORT_TIMI_UNIT
//WORL_UNIT
//LATEST_ALLOC_PROGRESS_PERIOD
//WORN
//CONSTRAINU
//PRIORITB
//CRITICAM
//USE_PARENU_CALENDAR
//BUFFER_TASK
//MARK_FOS_HIDING
//OWNED_BY_TIMESHEEV_X
//START_ON_NEX_DAY
//LONGEST_PATH
//DURATIOTTYPF
//DURATIOTELA_MONTHS
//DURATIOTHOURS
//STARZ
//ENJ
//DURATION_TIMJ_UNIT
//UNSCHEDULABLG
//SUBPROJECT_ID
//ALT_ID
//LAST_EDITED_DATE
//LAST_EDITED_BY
task.setDuration(Duration.getInstance(0, TimeUnit.HOURS));
}
|
[
"private",
"void",
"populateMilestone",
"(",
"Row",
"row",
",",
"Task",
"task",
")",
"{",
"task",
".",
"setMilestone",
"(",
"true",
")",
";",
"//PROJID",
"task",
".",
"setUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"MILESTONEID\"",
")",
")",
";",
"task",
".",
"setStart",
"(",
"row",
".",
"getDate",
"(",
"\"GIVEN_DATE_TIME\"",
")",
")",
";",
"task",
".",
"setFinish",
"(",
"row",
".",
"getDate",
"(",
"\"GIVEN_DATE_TIME\"",
")",
")",
";",
"//PROGREST_PERIOD",
"//SYMBOL_APPEARANCE",
"//MILESTONE_TYPE",
"//PLACEMENU",
"task",
".",
"setPercentageComplete",
"(",
"row",
".",
"getBoolean",
"(",
"\"COMPLETED\"",
")",
"?",
"COMPLETE",
":",
"INCOMPLETE",
")",
";",
"//INTERRUPTIBLE_X",
"//ACTUAL_DURATIONTYPF",
"//ACTUAL_DURATIONELA_MONTHS",
"//ACTUAL_DURATIONHOURS",
"task",
".",
"setEarlyStart",
"(",
"row",
".",
"getDate",
"(",
"\"EARLY_START_DATE\"",
")",
")",
";",
"task",
".",
"setLateStart",
"(",
"row",
".",
"getDate",
"(",
"\"LATE_START_DATE\"",
")",
")",
";",
"//FREE_START_DATE",
"//START_CONSTRAINT_DATE",
"//END_CONSTRAINT_DATE",
"//EFFORT_BUDGET",
"//NATURAO_ORDER",
"//LOGICAL_PRECEDENCE",
"//SPAVE_INTEGER",
"//SWIM_LANE",
"//USER_PERCENT_COMPLETE",
"//OVERALL_PERCENV_COMPLETE",
"//OVERALL_PERCENT_COMPL_WEIGHT",
"task",
".",
"setName",
"(",
"row",
".",
"getString",
"(",
"\"NARE\"",
")",
")",
";",
"//NOTET",
"task",
".",
"setText",
"(",
"1",
",",
"row",
".",
"getString",
"(",
"\"UNIQUE_TASK_ID\"",
")",
")",
";",
"task",
".",
"setCalendar",
"(",
"m_project",
".",
"getCalendarByUniqueID",
"(",
"row",
".",
"getInteger",
"(",
"\"CALENDAU\"",
")",
")",
")",
";",
"//EFFORT_TIMI_UNIT",
"//WORL_UNIT",
"//LATEST_ALLOC_PROGRESS_PERIOD",
"//WORN",
"//CONSTRAINU",
"//PRIORITB",
"//CRITICAM",
"//USE_PARENU_CALENDAR",
"//BUFFER_TASK",
"//MARK_FOS_HIDING",
"//OWNED_BY_TIMESHEEV_X",
"//START_ON_NEX_DAY",
"//LONGEST_PATH",
"//DURATIOTTYPF",
"//DURATIOTELA_MONTHS",
"//DURATIOTHOURS",
"//STARZ",
"//ENJ",
"//DURATION_TIMJ_UNIT",
"//UNSCHEDULABLG",
"//SUBPROJECT_ID",
"//ALT_ID",
"//LAST_EDITED_DATE",
"//LAST_EDITED_BY",
"task",
".",
"setDuration",
"(",
"Duration",
".",
"getInstance",
"(",
"0",
",",
"TimeUnit",
".",
"HOURS",
")",
")",
";",
"}"
] |
Populate a milestone from a Row instance.
@param row Row instance
@param task Task instance
|
[
"Populate",
"a",
"milestone",
"from",
"a",
"Row",
"instance",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L528-L586
|
157,364
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.getInitials
|
private String getInitials(String name)
{
String result = null;
if (name != null && name.length() != 0)
{
StringBuilder sb = new StringBuilder();
sb.append(name.charAt(0));
int index = 1;
while (true)
{
index = name.indexOf(' ', index);
if (index == -1)
{
break;
}
++index;
if (index < name.length() && name.charAt(index) != ' ')
{
sb.append(name.charAt(index));
}
++index;
}
result = sb.toString();
}
return result;
}
|
java
|
private String getInitials(String name)
{
String result = null;
if (name != null && name.length() != 0)
{
StringBuilder sb = new StringBuilder();
sb.append(name.charAt(0));
int index = 1;
while (true)
{
index = name.indexOf(' ', index);
if (index == -1)
{
break;
}
++index;
if (index < name.length() && name.charAt(index) != ' ')
{
sb.append(name.charAt(index));
}
++index;
}
result = sb.toString();
}
return result;
}
|
[
"private",
"String",
"getInitials",
"(",
"String",
"name",
")",
"{",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"name",
"!=",
"null",
"&&",
"name",
".",
"length",
"(",
")",
"!=",
"0",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"name",
".",
"charAt",
"(",
"0",
")",
")",
";",
"int",
"index",
"=",
"1",
";",
"while",
"(",
"true",
")",
"{",
"index",
"=",
"name",
".",
"indexOf",
"(",
"'",
"'",
",",
"index",
")",
";",
"if",
"(",
"index",
"==",
"-",
"1",
")",
"{",
"break",
";",
"}",
"++",
"index",
";",
"if",
"(",
"index",
"<",
"name",
".",
"length",
"(",
")",
"&&",
"name",
".",
"charAt",
"(",
"index",
")",
"!=",
"'",
"'",
")",
"{",
"sb",
".",
"append",
"(",
"name",
".",
"charAt",
"(",
"index",
")",
")",
";",
"}",
"++",
"index",
";",
"}",
"result",
"=",
"sb",
".",
"toString",
"(",
")",
";",
"}",
"return",
"result",
";",
"}"
] |
Convert a name into initials.
@param name source name
@return initials
|
[
"Convert",
"a",
"name",
"into",
"initials",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L886-L916
|
157,365
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.deriveProjectCalendar
|
private void deriveProjectCalendar()
{
//
// Count the number of times each calendar is used
//
Map<ProjectCalendar, Integer> map = new HashMap<ProjectCalendar, Integer>();
for (Task task : m_project.getTasks())
{
ProjectCalendar calendar = task.getCalendar();
Integer count = map.get(calendar);
if (count == null)
{
count = Integer.valueOf(1);
}
else
{
count = Integer.valueOf(count.intValue() + 1);
}
map.put(calendar, count);
}
//
// Find the most frequently used calendar
//
int maxCount = 0;
ProjectCalendar defaultCalendar = null;
for (Entry<ProjectCalendar, Integer> entry : map.entrySet())
{
if (entry.getValue().intValue() > maxCount)
{
maxCount = entry.getValue().intValue();
defaultCalendar = entry.getKey();
}
}
//
// Set the default calendar for the project
// and remove it's use as a task-specific calendar.
//
if (defaultCalendar != null)
{
m_project.setDefaultCalendar(defaultCalendar);
for (Task task : m_project.getTasks())
{
if (task.getCalendar() == defaultCalendar)
{
task.setCalendar(null);
}
}
}
}
|
java
|
private void deriveProjectCalendar()
{
//
// Count the number of times each calendar is used
//
Map<ProjectCalendar, Integer> map = new HashMap<ProjectCalendar, Integer>();
for (Task task : m_project.getTasks())
{
ProjectCalendar calendar = task.getCalendar();
Integer count = map.get(calendar);
if (count == null)
{
count = Integer.valueOf(1);
}
else
{
count = Integer.valueOf(count.intValue() + 1);
}
map.put(calendar, count);
}
//
// Find the most frequently used calendar
//
int maxCount = 0;
ProjectCalendar defaultCalendar = null;
for (Entry<ProjectCalendar, Integer> entry : map.entrySet())
{
if (entry.getValue().intValue() > maxCount)
{
maxCount = entry.getValue().intValue();
defaultCalendar = entry.getKey();
}
}
//
// Set the default calendar for the project
// and remove it's use as a task-specific calendar.
//
if (defaultCalendar != null)
{
m_project.setDefaultCalendar(defaultCalendar);
for (Task task : m_project.getTasks())
{
if (task.getCalendar() == defaultCalendar)
{
task.setCalendar(null);
}
}
}
}
|
[
"private",
"void",
"deriveProjectCalendar",
"(",
")",
"{",
"//",
"// Count the number of times each calendar is used",
"//",
"Map",
"<",
"ProjectCalendar",
",",
"Integer",
">",
"map",
"=",
"new",
"HashMap",
"<",
"ProjectCalendar",
",",
"Integer",
">",
"(",
")",
";",
"for",
"(",
"Task",
"task",
":",
"m_project",
".",
"getTasks",
"(",
")",
")",
"{",
"ProjectCalendar",
"calendar",
"=",
"task",
".",
"getCalendar",
"(",
")",
";",
"Integer",
"count",
"=",
"map",
".",
"get",
"(",
"calendar",
")",
";",
"if",
"(",
"count",
"==",
"null",
")",
"{",
"count",
"=",
"Integer",
".",
"valueOf",
"(",
"1",
")",
";",
"}",
"else",
"{",
"count",
"=",
"Integer",
".",
"valueOf",
"(",
"count",
".",
"intValue",
"(",
")",
"+",
"1",
")",
";",
"}",
"map",
".",
"put",
"(",
"calendar",
",",
"count",
")",
";",
"}",
"//",
"// Find the most frequently used calendar",
"//",
"int",
"maxCount",
"=",
"0",
";",
"ProjectCalendar",
"defaultCalendar",
"=",
"null",
";",
"for",
"(",
"Entry",
"<",
"ProjectCalendar",
",",
"Integer",
">",
"entry",
":",
"map",
".",
"entrySet",
"(",
")",
")",
"{",
"if",
"(",
"entry",
".",
"getValue",
"(",
")",
".",
"intValue",
"(",
")",
">",
"maxCount",
")",
"{",
"maxCount",
"=",
"entry",
".",
"getValue",
"(",
")",
".",
"intValue",
"(",
")",
";",
"defaultCalendar",
"=",
"entry",
".",
"getKey",
"(",
")",
";",
"}",
"}",
"//",
"// Set the default calendar for the project",
"// and remove it's use as a task-specific calendar.",
"//",
"if",
"(",
"defaultCalendar",
"!=",
"null",
")",
"{",
"m_project",
".",
"setDefaultCalendar",
"(",
"defaultCalendar",
")",
";",
"for",
"(",
"Task",
"task",
":",
"m_project",
".",
"getTasks",
"(",
")",
")",
"{",
"if",
"(",
"task",
".",
"getCalendar",
"(",
")",
"==",
"defaultCalendar",
")",
"{",
"task",
".",
"setCalendar",
"(",
"null",
")",
";",
"}",
"}",
"}",
"}"
] |
Asta Powerproject assigns an explicit calendar for each task. This method
is used to find the most common calendar and use this as the default project
calendar. This allows the explicitly assigned task calendars to be removed.
|
[
"Asta",
"Powerproject",
"assigns",
"an",
"explicit",
"calendar",
"for",
"each",
"task",
".",
"This",
"method",
"is",
"used",
"to",
"find",
"the",
"most",
"common",
"calendar",
"and",
"use",
"this",
"as",
"the",
"default",
"project",
"calendar",
".",
"This",
"allows",
"the",
"explicitly",
"assigned",
"task",
"calendars",
"to",
"be",
"removed",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L923-L974
|
157,366
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.processConstraints
|
private void processConstraints(Row row, Task task)
{
ConstraintType constraintType = ConstraintType.AS_SOON_AS_POSSIBLE;
Date constraintDate = null;
switch (row.getInt("CONSTRAINU"))
{
case 0:
{
if (row.getInt("PLACEMENT") == 0)
{
constraintType = ConstraintType.AS_SOON_AS_POSSIBLE;
}
else
{
constraintType = ConstraintType.AS_LATE_AS_POSSIBLE;
}
break;
}
case 1:
{
constraintType = ConstraintType.MUST_START_ON;
constraintDate = row.getDate("START_CONSTRAINT_DATE");
break;
}
case 2:
{
constraintType = ConstraintType.START_NO_LATER_THAN;
constraintDate = row.getDate("START_CONSTRAINT_DATE");
break;
}
case 3:
{
constraintType = ConstraintType.START_NO_EARLIER_THAN;
constraintDate = row.getDate("START_CONSTRAINT_DATE");
break;
}
case 4:
{
constraintType = ConstraintType.MUST_FINISH_ON;
constraintDate = row.getDate("END_CONSTRAINT_DATE");
break;
}
case 5:
{
constraintType = ConstraintType.FINISH_NO_LATER_THAN;
constraintDate = row.getDate("END_CONSTRAINT_DATE");
break;
}
case 6:
{
constraintType = ConstraintType.FINISH_NO_EARLIER_THAN;
constraintDate = row.getDate("END_CONSTRAINT_DATE");
break;
}
case 8:
{
task.setDeadline(row.getDate("END_CONSTRAINT_DATE"));
break;
}
}
task.setConstraintType(constraintType);
task.setConstraintDate(constraintDate);
}
|
java
|
private void processConstraints(Row row, Task task)
{
ConstraintType constraintType = ConstraintType.AS_SOON_AS_POSSIBLE;
Date constraintDate = null;
switch (row.getInt("CONSTRAINU"))
{
case 0:
{
if (row.getInt("PLACEMENT") == 0)
{
constraintType = ConstraintType.AS_SOON_AS_POSSIBLE;
}
else
{
constraintType = ConstraintType.AS_LATE_AS_POSSIBLE;
}
break;
}
case 1:
{
constraintType = ConstraintType.MUST_START_ON;
constraintDate = row.getDate("START_CONSTRAINT_DATE");
break;
}
case 2:
{
constraintType = ConstraintType.START_NO_LATER_THAN;
constraintDate = row.getDate("START_CONSTRAINT_DATE");
break;
}
case 3:
{
constraintType = ConstraintType.START_NO_EARLIER_THAN;
constraintDate = row.getDate("START_CONSTRAINT_DATE");
break;
}
case 4:
{
constraintType = ConstraintType.MUST_FINISH_ON;
constraintDate = row.getDate("END_CONSTRAINT_DATE");
break;
}
case 5:
{
constraintType = ConstraintType.FINISH_NO_LATER_THAN;
constraintDate = row.getDate("END_CONSTRAINT_DATE");
break;
}
case 6:
{
constraintType = ConstraintType.FINISH_NO_EARLIER_THAN;
constraintDate = row.getDate("END_CONSTRAINT_DATE");
break;
}
case 8:
{
task.setDeadline(row.getDate("END_CONSTRAINT_DATE"));
break;
}
}
task.setConstraintType(constraintType);
task.setConstraintDate(constraintDate);
}
|
[
"private",
"void",
"processConstraints",
"(",
"Row",
"row",
",",
"Task",
"task",
")",
"{",
"ConstraintType",
"constraintType",
"=",
"ConstraintType",
".",
"AS_SOON_AS_POSSIBLE",
";",
"Date",
"constraintDate",
"=",
"null",
";",
"switch",
"(",
"row",
".",
"getInt",
"(",
"\"CONSTRAINU\"",
")",
")",
"{",
"case",
"0",
":",
"{",
"if",
"(",
"row",
".",
"getInt",
"(",
"\"PLACEMENT\"",
")",
"==",
"0",
")",
"{",
"constraintType",
"=",
"ConstraintType",
".",
"AS_SOON_AS_POSSIBLE",
";",
"}",
"else",
"{",
"constraintType",
"=",
"ConstraintType",
".",
"AS_LATE_AS_POSSIBLE",
";",
"}",
"break",
";",
"}",
"case",
"1",
":",
"{",
"constraintType",
"=",
"ConstraintType",
".",
"MUST_START_ON",
";",
"constraintDate",
"=",
"row",
".",
"getDate",
"(",
"\"START_CONSTRAINT_DATE\"",
")",
";",
"break",
";",
"}",
"case",
"2",
":",
"{",
"constraintType",
"=",
"ConstraintType",
".",
"START_NO_LATER_THAN",
";",
"constraintDate",
"=",
"row",
".",
"getDate",
"(",
"\"START_CONSTRAINT_DATE\"",
")",
";",
"break",
";",
"}",
"case",
"3",
":",
"{",
"constraintType",
"=",
"ConstraintType",
".",
"START_NO_EARLIER_THAN",
";",
"constraintDate",
"=",
"row",
".",
"getDate",
"(",
"\"START_CONSTRAINT_DATE\"",
")",
";",
"break",
";",
"}",
"case",
"4",
":",
"{",
"constraintType",
"=",
"ConstraintType",
".",
"MUST_FINISH_ON",
";",
"constraintDate",
"=",
"row",
".",
"getDate",
"(",
"\"END_CONSTRAINT_DATE\"",
")",
";",
"break",
";",
"}",
"case",
"5",
":",
"{",
"constraintType",
"=",
"ConstraintType",
".",
"FINISH_NO_LATER_THAN",
";",
"constraintDate",
"=",
"row",
".",
"getDate",
"(",
"\"END_CONSTRAINT_DATE\"",
")",
";",
"break",
";",
"}",
"case",
"6",
":",
"{",
"constraintType",
"=",
"ConstraintType",
".",
"FINISH_NO_EARLIER_THAN",
";",
"constraintDate",
"=",
"row",
".",
"getDate",
"(",
"\"END_CONSTRAINT_DATE\"",
")",
";",
"break",
";",
"}",
"case",
"8",
":",
"{",
"task",
".",
"setDeadline",
"(",
"row",
".",
"getDate",
"(",
"\"END_CONSTRAINT_DATE\"",
")",
")",
";",
"break",
";",
"}",
"}",
"task",
".",
"setConstraintType",
"(",
"constraintType",
")",
";",
"task",
".",
"setConstraintDate",
"(",
"constraintDate",
")",
";",
"}"
] |
Determines the constraints relating to a task.
@param row row data
@param task Task instance
|
[
"Determines",
"the",
"constraints",
"relating",
"to",
"a",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L982-L1053
|
157,367
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.createWorkPatternMap
|
public Map<Integer, Row> createWorkPatternMap(List<Row> rows)
{
Map<Integer, Row> map = new HashMap<Integer, Row>();
for (Row row : rows)
{
map.put(row.getInteger("WORK_PATTERNID"), row);
}
return map;
}
|
java
|
public Map<Integer, Row> createWorkPatternMap(List<Row> rows)
{
Map<Integer, Row> map = new HashMap<Integer, Row>();
for (Row row : rows)
{
map.put(row.getInteger("WORK_PATTERNID"), row);
}
return map;
}
|
[
"public",
"Map",
"<",
"Integer",
",",
"Row",
">",
"createWorkPatternMap",
"(",
"List",
"<",
"Row",
">",
"rows",
")",
"{",
"Map",
"<",
"Integer",
",",
"Row",
">",
"map",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"Row",
">",
"(",
")",
";",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"map",
".",
"put",
"(",
"row",
".",
"getInteger",
"(",
"\"WORK_PATTERNID\"",
")",
",",
"row",
")",
";",
"}",
"return",
"map",
";",
"}"
] |
Creates a map of work pattern rows indexed by the primary key.
@param rows work pattern rows
@return work pattern map
|
[
"Creates",
"a",
"map",
"of",
"work",
"pattern",
"rows",
"indexed",
"by",
"the",
"primary",
"key",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L1101-L1109
|
157,368
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.createWorkPatternAssignmentMap
|
public Map<Integer, List<Row>> createWorkPatternAssignmentMap(List<Row> rows)
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer calendarID = row.getInteger("WORK_PATTERN_ASSIGNMENTID");
List<Row> list = map.get(calendarID);
if (list == null)
{
list = new LinkedList<Row>();
map.put(calendarID, list);
}
list.add(row);
}
return map;
}
|
java
|
public Map<Integer, List<Row>> createWorkPatternAssignmentMap(List<Row> rows)
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer calendarID = row.getInteger("WORK_PATTERN_ASSIGNMENTID");
List<Row> list = map.get(calendarID);
if (list == null)
{
list = new LinkedList<Row>();
map.put(calendarID, list);
}
list.add(row);
}
return map;
}
|
[
"public",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"createWorkPatternAssignmentMap",
"(",
"List",
"<",
"Row",
">",
"rows",
")",
"{",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"map",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"(",
")",
";",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"Integer",
"calendarID",
"=",
"row",
".",
"getInteger",
"(",
"\"WORK_PATTERN_ASSIGNMENTID\"",
")",
";",
"List",
"<",
"Row",
">",
"list",
"=",
"map",
".",
"get",
"(",
"calendarID",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"LinkedList",
"<",
"Row",
">",
"(",
")",
";",
"map",
".",
"put",
"(",
"calendarID",
",",
"list",
")",
";",
"}",
"list",
".",
"add",
"(",
"row",
")",
";",
"}",
"return",
"map",
";",
"}"
] |
Creates a map between a calendar ID and a list of
work pattern assignment rows.
@param rows work pattern assignment rows
@return work pattern assignment map
|
[
"Creates",
"a",
"map",
"between",
"a",
"calendar",
"ID",
"and",
"a",
"list",
"of",
"work",
"pattern",
"assignment",
"rows",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L1118-L1133
|
157,369
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.createTimeEntryMap
|
public Map<Integer, List<Row>> createTimeEntryMap(List<Row> rows)
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer workPatternID = row.getInteger("TIME_ENTRYID");
List<Row> list = map.get(workPatternID);
if (list == null)
{
list = new LinkedList<Row>();
map.put(workPatternID, list);
}
list.add(row);
}
return map;
}
|
java
|
public Map<Integer, List<Row>> createTimeEntryMap(List<Row> rows)
{
Map<Integer, List<Row>> map = new HashMap<Integer, List<Row>>();
for (Row row : rows)
{
Integer workPatternID = row.getInteger("TIME_ENTRYID");
List<Row> list = map.get(workPatternID);
if (list == null)
{
list = new LinkedList<Row>();
map.put(workPatternID, list);
}
list.add(row);
}
return map;
}
|
[
"public",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"createTimeEntryMap",
"(",
"List",
"<",
"Row",
">",
"rows",
")",
"{",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"map",
"=",
"new",
"HashMap",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"(",
")",
";",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"Integer",
"workPatternID",
"=",
"row",
".",
"getInteger",
"(",
"\"TIME_ENTRYID\"",
")",
";",
"List",
"<",
"Row",
">",
"list",
"=",
"map",
".",
"get",
"(",
"workPatternID",
")",
";",
"if",
"(",
"list",
"==",
"null",
")",
"{",
"list",
"=",
"new",
"LinkedList",
"<",
"Row",
">",
"(",
")",
";",
"map",
".",
"put",
"(",
"workPatternID",
",",
"list",
")",
";",
"}",
"list",
".",
"add",
"(",
"row",
")",
";",
"}",
"return",
"map",
";",
"}"
] |
Creates a map between a work pattern ID and a list of time entry rows.
@param rows time entry rows
@return time entry map
|
[
"Creates",
"a",
"map",
"between",
"a",
"work",
"pattern",
"ID",
"and",
"a",
"list",
"of",
"time",
"entry",
"rows",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L1164-L1179
|
157,370
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.processCalendar
|
public void processCalendar(Row calendarRow, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> workPatternAssignmentMap, Map<Integer, List<Row>> exceptionAssignmentMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap)
{
//
// Create the calendar and add the default working hours
//
ProjectCalendar calendar = m_project.addCalendar();
Integer dominantWorkPatternID = calendarRow.getInteger("DOMINANT_WORK_PATTERN");
calendar.setUniqueID(calendarRow.getInteger("CALENDARID"));
processWorkPattern(calendar, dominantWorkPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
calendar.setName(calendarRow.getString("NAMK"));
//
// Add any additional working weeks
//
List<Row> rows = workPatternAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Integer workPatternID = row.getInteger("WORK_PATTERN");
if (!workPatternID.equals(dominantWorkPatternID))
{
ProjectCalendarWeek week = calendar.addWorkWeek();
week.setDateRange(new DateRange(row.getDate("START_DATE"), row.getDate("END_DATE")));
processWorkPattern(week, workPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
}
}
}
//
// Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?
//
rows = exceptionAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Date startDate = row.getDate("STARU_DATE");
Date endDate = row.getDate("ENE_DATE");
calendar.addCalendarException(startDate, endDate);
}
}
m_eventManager.fireCalendarReadEvent(calendar);
}
|
java
|
public void processCalendar(Row calendarRow, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> workPatternAssignmentMap, Map<Integer, List<Row>> exceptionAssignmentMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap)
{
//
// Create the calendar and add the default working hours
//
ProjectCalendar calendar = m_project.addCalendar();
Integer dominantWorkPatternID = calendarRow.getInteger("DOMINANT_WORK_PATTERN");
calendar.setUniqueID(calendarRow.getInteger("CALENDARID"));
processWorkPattern(calendar, dominantWorkPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
calendar.setName(calendarRow.getString("NAMK"));
//
// Add any additional working weeks
//
List<Row> rows = workPatternAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Integer workPatternID = row.getInteger("WORK_PATTERN");
if (!workPatternID.equals(dominantWorkPatternID))
{
ProjectCalendarWeek week = calendar.addWorkWeek();
week.setDateRange(new DateRange(row.getDate("START_DATE"), row.getDate("END_DATE")));
processWorkPattern(week, workPatternID, workPatternMap, timeEntryMap, exceptionTypeMap);
}
}
}
//
// Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?
//
rows = exceptionAssignmentMap.get(calendar.getUniqueID());
if (rows != null)
{
for (Row row : rows)
{
Date startDate = row.getDate("STARU_DATE");
Date endDate = row.getDate("ENE_DATE");
calendar.addCalendarException(startDate, endDate);
}
}
m_eventManager.fireCalendarReadEvent(calendar);
}
|
[
"public",
"void",
"processCalendar",
"(",
"Row",
"calendarRow",
",",
"Map",
"<",
"Integer",
",",
"Row",
">",
"workPatternMap",
",",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"workPatternAssignmentMap",
",",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"exceptionAssignmentMap",
",",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"timeEntryMap",
",",
"Map",
"<",
"Integer",
",",
"DayType",
">",
"exceptionTypeMap",
")",
"{",
"//",
"// Create the calendar and add the default working hours",
"//",
"ProjectCalendar",
"calendar",
"=",
"m_project",
".",
"addCalendar",
"(",
")",
";",
"Integer",
"dominantWorkPatternID",
"=",
"calendarRow",
".",
"getInteger",
"(",
"\"DOMINANT_WORK_PATTERN\"",
")",
";",
"calendar",
".",
"setUniqueID",
"(",
"calendarRow",
".",
"getInteger",
"(",
"\"CALENDARID\"",
")",
")",
";",
"processWorkPattern",
"(",
"calendar",
",",
"dominantWorkPatternID",
",",
"workPatternMap",
",",
"timeEntryMap",
",",
"exceptionTypeMap",
")",
";",
"calendar",
".",
"setName",
"(",
"calendarRow",
".",
"getString",
"(",
"\"NAMK\"",
")",
")",
";",
"//",
"// Add any additional working weeks",
"//",
"List",
"<",
"Row",
">",
"rows",
"=",
"workPatternAssignmentMap",
".",
"get",
"(",
"calendar",
".",
"getUniqueID",
"(",
")",
")",
";",
"if",
"(",
"rows",
"!=",
"null",
")",
"{",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"Integer",
"workPatternID",
"=",
"row",
".",
"getInteger",
"(",
"\"WORK_PATTERN\"",
")",
";",
"if",
"(",
"!",
"workPatternID",
".",
"equals",
"(",
"dominantWorkPatternID",
")",
")",
"{",
"ProjectCalendarWeek",
"week",
"=",
"calendar",
".",
"addWorkWeek",
"(",
")",
";",
"week",
".",
"setDateRange",
"(",
"new",
"DateRange",
"(",
"row",
".",
"getDate",
"(",
"\"START_DATE\"",
")",
",",
"row",
".",
"getDate",
"(",
"\"END_DATE\"",
")",
")",
")",
";",
"processWorkPattern",
"(",
"week",
",",
"workPatternID",
",",
"workPatternMap",
",",
"timeEntryMap",
",",
"exceptionTypeMap",
")",
";",
"}",
"}",
"}",
"//",
"// Add exceptions - not sure how exceptions which turn non-working days into working days are handled by Asta - if at all?",
"//",
"rows",
"=",
"exceptionAssignmentMap",
".",
"get",
"(",
"calendar",
".",
"getUniqueID",
"(",
")",
")",
";",
"if",
"(",
"rows",
"!=",
"null",
")",
"{",
"for",
"(",
"Row",
"row",
":",
"rows",
")",
"{",
"Date",
"startDate",
"=",
"row",
".",
"getDate",
"(",
"\"STARU_DATE\"",
")",
";",
"Date",
"endDate",
"=",
"row",
".",
"getDate",
"(",
"\"ENE_DATE\"",
")",
";",
"calendar",
".",
"addCalendarException",
"(",
"startDate",
",",
"endDate",
")",
";",
"}",
"}",
"m_eventManager",
".",
"fireCalendarReadEvent",
"(",
"calendar",
")",
";",
"}"
] |
Creates a ProjectCalendar instance from the Asta data.
@param calendarRow basic calendar data
@param workPatternMap work pattern map
@param workPatternAssignmentMap work pattern assignment map
@param exceptionAssignmentMap exception assignment map
@param timeEntryMap time entry map
@param exceptionTypeMap exception type map
|
[
"Creates",
"a",
"ProjectCalendar",
"instance",
"from",
"the",
"Asta",
"data",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L1191-L1235
|
157,371
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.processWorkPattern
|
private void processWorkPattern(ProjectCalendarWeek week, Integer workPatternID, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap)
{
Row workPatternRow = workPatternMap.get(workPatternID);
if (workPatternRow != null)
{
week.setName(workPatternRow.getString("NAMN"));
List<Row> timeEntryRows = timeEntryMap.get(workPatternID);
if (timeEntryRows != null)
{
long lastEndTime = Long.MIN_VALUE;
Day currentDay = Day.SUNDAY;
ProjectCalendarHours hours = week.addCalendarHours(currentDay);
Arrays.fill(week.getDays(), DayType.NON_WORKING);
for (Row row : timeEntryRows)
{
Date startTime = row.getDate("START_TIME");
Date endTime = row.getDate("END_TIME");
if (startTime == null)
{
startTime = DateHelper.getDayStartDate(new Date(0));
}
if (endTime == null)
{
endTime = DateHelper.getDayEndDate(new Date(0));
}
if (startTime.getTime() > endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
if (startTime.getTime() < lastEndTime)
{
currentDay = currentDay.getNextDay();
hours = week.addCalendarHours(currentDay);
}
DayType type = exceptionTypeMap.get(row.getInteger("EXCEPTIOP"));
if (type == DayType.WORKING)
{
hours.addRange(new DateRange(startTime, endTime));
week.setWorkingDay(currentDay, DayType.WORKING);
}
lastEndTime = endTime.getTime();
}
}
}
}
|
java
|
private void processWorkPattern(ProjectCalendarWeek week, Integer workPatternID, Map<Integer, Row> workPatternMap, Map<Integer, List<Row>> timeEntryMap, Map<Integer, DayType> exceptionTypeMap)
{
Row workPatternRow = workPatternMap.get(workPatternID);
if (workPatternRow != null)
{
week.setName(workPatternRow.getString("NAMN"));
List<Row> timeEntryRows = timeEntryMap.get(workPatternID);
if (timeEntryRows != null)
{
long lastEndTime = Long.MIN_VALUE;
Day currentDay = Day.SUNDAY;
ProjectCalendarHours hours = week.addCalendarHours(currentDay);
Arrays.fill(week.getDays(), DayType.NON_WORKING);
for (Row row : timeEntryRows)
{
Date startTime = row.getDate("START_TIME");
Date endTime = row.getDate("END_TIME");
if (startTime == null)
{
startTime = DateHelper.getDayStartDate(new Date(0));
}
if (endTime == null)
{
endTime = DateHelper.getDayEndDate(new Date(0));
}
if (startTime.getTime() > endTime.getTime())
{
endTime = DateHelper.addDays(endTime, 1);
}
if (startTime.getTime() < lastEndTime)
{
currentDay = currentDay.getNextDay();
hours = week.addCalendarHours(currentDay);
}
DayType type = exceptionTypeMap.get(row.getInteger("EXCEPTIOP"));
if (type == DayType.WORKING)
{
hours.addRange(new DateRange(startTime, endTime));
week.setWorkingDay(currentDay, DayType.WORKING);
}
lastEndTime = endTime.getTime();
}
}
}
}
|
[
"private",
"void",
"processWorkPattern",
"(",
"ProjectCalendarWeek",
"week",
",",
"Integer",
"workPatternID",
",",
"Map",
"<",
"Integer",
",",
"Row",
">",
"workPatternMap",
",",
"Map",
"<",
"Integer",
",",
"List",
"<",
"Row",
">",
">",
"timeEntryMap",
",",
"Map",
"<",
"Integer",
",",
"DayType",
">",
"exceptionTypeMap",
")",
"{",
"Row",
"workPatternRow",
"=",
"workPatternMap",
".",
"get",
"(",
"workPatternID",
")",
";",
"if",
"(",
"workPatternRow",
"!=",
"null",
")",
"{",
"week",
".",
"setName",
"(",
"workPatternRow",
".",
"getString",
"(",
"\"NAMN\"",
")",
")",
";",
"List",
"<",
"Row",
">",
"timeEntryRows",
"=",
"timeEntryMap",
".",
"get",
"(",
"workPatternID",
")",
";",
"if",
"(",
"timeEntryRows",
"!=",
"null",
")",
"{",
"long",
"lastEndTime",
"=",
"Long",
".",
"MIN_VALUE",
";",
"Day",
"currentDay",
"=",
"Day",
".",
"SUNDAY",
";",
"ProjectCalendarHours",
"hours",
"=",
"week",
".",
"addCalendarHours",
"(",
"currentDay",
")",
";",
"Arrays",
".",
"fill",
"(",
"week",
".",
"getDays",
"(",
")",
",",
"DayType",
".",
"NON_WORKING",
")",
";",
"for",
"(",
"Row",
"row",
":",
"timeEntryRows",
")",
"{",
"Date",
"startTime",
"=",
"row",
".",
"getDate",
"(",
"\"START_TIME\"",
")",
";",
"Date",
"endTime",
"=",
"row",
".",
"getDate",
"(",
"\"END_TIME\"",
")",
";",
"if",
"(",
"startTime",
"==",
"null",
")",
"{",
"startTime",
"=",
"DateHelper",
".",
"getDayStartDate",
"(",
"new",
"Date",
"(",
"0",
")",
")",
";",
"}",
"if",
"(",
"endTime",
"==",
"null",
")",
"{",
"endTime",
"=",
"DateHelper",
".",
"getDayEndDate",
"(",
"new",
"Date",
"(",
"0",
")",
")",
";",
"}",
"if",
"(",
"startTime",
".",
"getTime",
"(",
")",
">",
"endTime",
".",
"getTime",
"(",
")",
")",
"{",
"endTime",
"=",
"DateHelper",
".",
"addDays",
"(",
"endTime",
",",
"1",
")",
";",
"}",
"if",
"(",
"startTime",
".",
"getTime",
"(",
")",
"<",
"lastEndTime",
")",
"{",
"currentDay",
"=",
"currentDay",
".",
"getNextDay",
"(",
")",
";",
"hours",
"=",
"week",
".",
"addCalendarHours",
"(",
"currentDay",
")",
";",
"}",
"DayType",
"type",
"=",
"exceptionTypeMap",
".",
"get",
"(",
"row",
".",
"getInteger",
"(",
"\"EXCEPTIOP\"",
")",
")",
";",
"if",
"(",
"type",
"==",
"DayType",
".",
"WORKING",
")",
"{",
"hours",
".",
"addRange",
"(",
"new",
"DateRange",
"(",
"startTime",
",",
"endTime",
")",
")",
";",
"week",
".",
"setWorkingDay",
"(",
"currentDay",
",",
"DayType",
".",
"WORKING",
")",
";",
"}",
"lastEndTime",
"=",
"endTime",
".",
"getTime",
"(",
")",
";",
"}",
"}",
"}",
"}"
] |
Populates a ProjectCalendarWeek instance from Asta work pattern data.
@param week target ProjectCalendarWeek instance
@param workPatternID target work pattern ID
@param workPatternMap work pattern data
@param timeEntryMap time entry map
@param exceptionTypeMap exception type map
|
[
"Populates",
"a",
"ProjectCalendarWeek",
"instance",
"from",
"Asta",
"work",
"pattern",
"data",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L1246-L1297
|
157,372
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaReader.java
|
AstaReader.getNotes
|
private String getNotes(Row row)
{
String notes = row.getString("NOTET");
if (notes != null)
{
if (notes.isEmpty())
{
notes = null;
}
else
{
if (notes.indexOf(LINE_BREAK) != -1)
{
notes = notes.replace(LINE_BREAK, "\n");
}
}
}
return notes;
}
|
java
|
private String getNotes(Row row)
{
String notes = row.getString("NOTET");
if (notes != null)
{
if (notes.isEmpty())
{
notes = null;
}
else
{
if (notes.indexOf(LINE_BREAK) != -1)
{
notes = notes.replace(LINE_BREAK, "\n");
}
}
}
return notes;
}
|
[
"private",
"String",
"getNotes",
"(",
"Row",
"row",
")",
"{",
"String",
"notes",
"=",
"row",
".",
"getString",
"(",
"\"NOTET\"",
")",
";",
"if",
"(",
"notes",
"!=",
"null",
")",
"{",
"if",
"(",
"notes",
".",
"isEmpty",
"(",
")",
")",
"{",
"notes",
"=",
"null",
";",
"}",
"else",
"{",
"if",
"(",
"notes",
".",
"indexOf",
"(",
"LINE_BREAK",
")",
"!=",
"-",
"1",
")",
"{",
"notes",
"=",
"notes",
".",
"replace",
"(",
"LINE_BREAK",
",",
"\"\\n\"",
")",
";",
"}",
"}",
"}",
"return",
"notes",
";",
"}"
] |
Extract note text.
@param row task data
@return note text
|
[
"Extract",
"note",
"text",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaReader.java#L1305-L1323
|
157,373
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaFileReader.java
|
AstaFileReader.addListeners
|
private void addListeners(ProjectReader reader)
{
if (m_projectListeners != null)
{
for (ProjectListener listener : m_projectListeners)
{
reader.addProjectListener(listener);
}
}
}
|
java
|
private void addListeners(ProjectReader reader)
{
if (m_projectListeners != null)
{
for (ProjectListener listener : m_projectListeners)
{
reader.addProjectListener(listener);
}
}
}
|
[
"private",
"void",
"addListeners",
"(",
"ProjectReader",
"reader",
")",
"{",
"if",
"(",
"m_projectListeners",
"!=",
"null",
")",
"{",
"for",
"(",
"ProjectListener",
"listener",
":",
"m_projectListeners",
")",
"{",
"reader",
".",
"addProjectListener",
"(",
"listener",
")",
";",
"}",
"}",
"}"
] |
Adds any listeners attached to this reader to the reader created internally.
@param reader internal project reader
|
[
"Adds",
"any",
"listeners",
"attached",
"to",
"this",
"reader",
"to",
"the",
"reader",
"created",
"internally",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaFileReader.java#L93-L102
|
157,374
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaFileReader.java
|
AstaFileReader.readTextFile
|
private ProjectFile readTextFile(InputStream inputStream) throws MPXJException
{
ProjectReader reader = new AstaTextFileReader();
addListeners(reader);
return reader.read(inputStream);
}
|
java
|
private ProjectFile readTextFile(InputStream inputStream) throws MPXJException
{
ProjectReader reader = new AstaTextFileReader();
addListeners(reader);
return reader.read(inputStream);
}
|
[
"private",
"ProjectFile",
"readTextFile",
"(",
"InputStream",
"inputStream",
")",
"throws",
"MPXJException",
"{",
"ProjectReader",
"reader",
"=",
"new",
"AstaTextFileReader",
"(",
")",
";",
"addListeners",
"(",
"reader",
")",
";",
"return",
"reader",
".",
"read",
"(",
"inputStream",
")",
";",
"}"
] |
Process a text-based PP file.
@param inputStream file input stream
@return ProjectFile instance
|
[
"Process",
"a",
"text",
"-",
"based",
"PP",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaFileReader.java#L110-L115
|
157,375
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/asta/AstaFileReader.java
|
AstaFileReader.readDatabaseFile
|
private ProjectFile readDatabaseFile(InputStream inputStream) throws MPXJException
{
ProjectReader reader = new AstaDatabaseFileReader();
addListeners(reader);
return reader.read(inputStream);
}
|
java
|
private ProjectFile readDatabaseFile(InputStream inputStream) throws MPXJException
{
ProjectReader reader = new AstaDatabaseFileReader();
addListeners(reader);
return reader.read(inputStream);
}
|
[
"private",
"ProjectFile",
"readDatabaseFile",
"(",
"InputStream",
"inputStream",
")",
"throws",
"MPXJException",
"{",
"ProjectReader",
"reader",
"=",
"new",
"AstaDatabaseFileReader",
"(",
")",
";",
"addListeners",
"(",
"reader",
")",
";",
"return",
"reader",
".",
"read",
"(",
"inputStream",
")",
";",
"}"
] |
Process a SQLite database PP file.
@param inputStream file input stream
@return ProjectFile instance
|
[
"Process",
"a",
"SQLite",
"database",
"PP",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/asta/AstaFileReader.java#L123-L128
|
157,376
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPReader.java
|
MPPReader.getFileFormat
|
public static String getFileFormat(POIFSFileSystem fs) throws IOException
{
String fileFormat = "";
DirectoryEntry root = fs.getRoot();
if (root.getEntryNames().contains("\1CompObj"))
{
CompObj compObj = new CompObj(new DocumentInputStream((DocumentEntry) root.getEntry("\1CompObj")));
fileFormat = compObj.getFileFormat();
}
return fileFormat;
}
|
java
|
public static String getFileFormat(POIFSFileSystem fs) throws IOException
{
String fileFormat = "";
DirectoryEntry root = fs.getRoot();
if (root.getEntryNames().contains("\1CompObj"))
{
CompObj compObj = new CompObj(new DocumentInputStream((DocumentEntry) root.getEntry("\1CompObj")));
fileFormat = compObj.getFileFormat();
}
return fileFormat;
}
|
[
"public",
"static",
"String",
"getFileFormat",
"(",
"POIFSFileSystem",
"fs",
")",
"throws",
"IOException",
"{",
"String",
"fileFormat",
"=",
"\"\"",
";",
"DirectoryEntry",
"root",
"=",
"fs",
".",
"getRoot",
"(",
")",
";",
"if",
"(",
"root",
".",
"getEntryNames",
"(",
")",
".",
"contains",
"(",
"\"\\1CompObj\"",
")",
")",
"{",
"CompObj",
"compObj",
"=",
"new",
"CompObj",
"(",
"new",
"DocumentInputStream",
"(",
"(",
"DocumentEntry",
")",
"root",
".",
"getEntry",
"(",
"\"\\1CompObj\"",
")",
")",
")",
";",
"fileFormat",
"=",
"compObj",
".",
"getFileFormat",
"(",
")",
";",
"}",
"return",
"fileFormat",
";",
"}"
] |
This method allows us to peek into the OLE compound document to extract the file format.
This allows the UniversalProjectReader to determine if this is an MPP file, or if
it is another type of OLE compound document.
@param fs POIFSFileSystem instance
@return file format name
@throws IOException
|
[
"This",
"method",
"allows",
"us",
"to",
"peek",
"into",
"the",
"OLE",
"compound",
"document",
"to",
"extract",
"the",
"file",
"format",
".",
"This",
"allows",
"the",
"UniversalProjectReader",
"to",
"determine",
"if",
"this",
"is",
"an",
"MPP",
"file",
"or",
"if",
"it",
"is",
"another",
"type",
"of",
"OLE",
"compound",
"document",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPReader.java#L100-L110
|
157,377
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPReader.java
|
MPPReader.read
|
public ProjectFile read(POIFSFileSystem fs) throws MPXJException
{
try
{
ProjectFile projectFile = new ProjectFile();
ProjectConfig config = projectFile.getProjectConfig();
config.setAutoTaskID(false);
config.setAutoTaskUniqueID(false);
config.setAutoResourceID(false);
config.setAutoResourceUniqueID(false);
config.setAutoOutlineLevel(false);
config.setAutoOutlineNumber(false);
config.setAutoWBS(false);
config.setAutoCalendarUniqueID(false);
config.setAutoAssignmentUniqueID(false);
projectFile.getEventManager().addProjectListeners(m_projectListeners);
//
// Open the file system and retrieve the root directory
//
DirectoryEntry root = fs.getRoot();
//
// Retrieve the CompObj data, validate the file format and process
//
CompObj compObj = new CompObj(new DocumentInputStream((DocumentEntry) root.getEntry("\1CompObj")));
ProjectProperties projectProperties = projectFile.getProjectProperties();
projectProperties.setFullApplicationName(compObj.getApplicationName());
projectProperties.setApplicationVersion(compObj.getApplicationVersion());
String format = compObj.getFileFormat();
Class<? extends MPPVariantReader> readerClass = FILE_CLASS_MAP.get(format);
if (readerClass == null)
{
throw new MPXJException(MPXJException.INVALID_FILE + ": " + format);
}
MPPVariantReader reader = readerClass.newInstance();
reader.process(this, projectFile, root);
//
// Update the internal structure. We'll take this opportunity to
// generate outline numbers for the tasks as they don't appear to
// be present in the MPP file.
//
config.setAutoOutlineNumber(true);
projectFile.updateStructure();
config.setAutoOutlineNumber(false);
//
// Perform post-processing to set the summary flag and clean
// up any instances where a task has an empty splits list.
//
for (Task task : projectFile.getTasks())
{
task.setSummary(task.hasChildTasks());
List<DateRange> splits = task.getSplits();
if (splits != null && splits.isEmpty())
{
task.setSplits(null);
}
validationRelations(task);
}
//
// Ensure that the unique ID counters are correct
//
config.updateUniqueCounters();
//
// Add some analytics
//
String projectFilePath = projectFile.getProjectProperties().getProjectFilePath();
if (projectFilePath != null && projectFilePath.startsWith("<>\\"))
{
projectProperties.setFileApplication("Microsoft Project Server");
}
else
{
projectProperties.setFileApplication("Microsoft");
}
projectProperties.setFileType("MPP");
return (projectFile);
}
catch (IOException ex)
{
throw new MPXJException(MPXJException.READ_ERROR, ex);
}
catch (IllegalAccessException ex)
{
throw new MPXJException(MPXJException.READ_ERROR, ex);
}
catch (InstantiationException ex)
{
throw new MPXJException(MPXJException.READ_ERROR, ex);
}
}
|
java
|
public ProjectFile read(POIFSFileSystem fs) throws MPXJException
{
try
{
ProjectFile projectFile = new ProjectFile();
ProjectConfig config = projectFile.getProjectConfig();
config.setAutoTaskID(false);
config.setAutoTaskUniqueID(false);
config.setAutoResourceID(false);
config.setAutoResourceUniqueID(false);
config.setAutoOutlineLevel(false);
config.setAutoOutlineNumber(false);
config.setAutoWBS(false);
config.setAutoCalendarUniqueID(false);
config.setAutoAssignmentUniqueID(false);
projectFile.getEventManager().addProjectListeners(m_projectListeners);
//
// Open the file system and retrieve the root directory
//
DirectoryEntry root = fs.getRoot();
//
// Retrieve the CompObj data, validate the file format and process
//
CompObj compObj = new CompObj(new DocumentInputStream((DocumentEntry) root.getEntry("\1CompObj")));
ProjectProperties projectProperties = projectFile.getProjectProperties();
projectProperties.setFullApplicationName(compObj.getApplicationName());
projectProperties.setApplicationVersion(compObj.getApplicationVersion());
String format = compObj.getFileFormat();
Class<? extends MPPVariantReader> readerClass = FILE_CLASS_MAP.get(format);
if (readerClass == null)
{
throw new MPXJException(MPXJException.INVALID_FILE + ": " + format);
}
MPPVariantReader reader = readerClass.newInstance();
reader.process(this, projectFile, root);
//
// Update the internal structure. We'll take this opportunity to
// generate outline numbers for the tasks as they don't appear to
// be present in the MPP file.
//
config.setAutoOutlineNumber(true);
projectFile.updateStructure();
config.setAutoOutlineNumber(false);
//
// Perform post-processing to set the summary flag and clean
// up any instances where a task has an empty splits list.
//
for (Task task : projectFile.getTasks())
{
task.setSummary(task.hasChildTasks());
List<DateRange> splits = task.getSplits();
if (splits != null && splits.isEmpty())
{
task.setSplits(null);
}
validationRelations(task);
}
//
// Ensure that the unique ID counters are correct
//
config.updateUniqueCounters();
//
// Add some analytics
//
String projectFilePath = projectFile.getProjectProperties().getProjectFilePath();
if (projectFilePath != null && projectFilePath.startsWith("<>\\"))
{
projectProperties.setFileApplication("Microsoft Project Server");
}
else
{
projectProperties.setFileApplication("Microsoft");
}
projectProperties.setFileType("MPP");
return (projectFile);
}
catch (IOException ex)
{
throw new MPXJException(MPXJException.READ_ERROR, ex);
}
catch (IllegalAccessException ex)
{
throw new MPXJException(MPXJException.READ_ERROR, ex);
}
catch (InstantiationException ex)
{
throw new MPXJException(MPXJException.READ_ERROR, ex);
}
}
|
[
"public",
"ProjectFile",
"read",
"(",
"POIFSFileSystem",
"fs",
")",
"throws",
"MPXJException",
"{",
"try",
"{",
"ProjectFile",
"projectFile",
"=",
"new",
"ProjectFile",
"(",
")",
";",
"ProjectConfig",
"config",
"=",
"projectFile",
".",
"getProjectConfig",
"(",
")",
";",
"config",
".",
"setAutoTaskID",
"(",
"false",
")",
";",
"config",
".",
"setAutoTaskUniqueID",
"(",
"false",
")",
";",
"config",
".",
"setAutoResourceID",
"(",
"false",
")",
";",
"config",
".",
"setAutoResourceUniqueID",
"(",
"false",
")",
";",
"config",
".",
"setAutoOutlineLevel",
"(",
"false",
")",
";",
"config",
".",
"setAutoOutlineNumber",
"(",
"false",
")",
";",
"config",
".",
"setAutoWBS",
"(",
"false",
")",
";",
"config",
".",
"setAutoCalendarUniqueID",
"(",
"false",
")",
";",
"config",
".",
"setAutoAssignmentUniqueID",
"(",
"false",
")",
";",
"projectFile",
".",
"getEventManager",
"(",
")",
".",
"addProjectListeners",
"(",
"m_projectListeners",
")",
";",
"//",
"// Open the file system and retrieve the root directory",
"//",
"DirectoryEntry",
"root",
"=",
"fs",
".",
"getRoot",
"(",
")",
";",
"//",
"// Retrieve the CompObj data, validate the file format and process",
"//",
"CompObj",
"compObj",
"=",
"new",
"CompObj",
"(",
"new",
"DocumentInputStream",
"(",
"(",
"DocumentEntry",
")",
"root",
".",
"getEntry",
"(",
"\"\\1CompObj\"",
")",
")",
")",
";",
"ProjectProperties",
"projectProperties",
"=",
"projectFile",
".",
"getProjectProperties",
"(",
")",
";",
"projectProperties",
".",
"setFullApplicationName",
"(",
"compObj",
".",
"getApplicationName",
"(",
")",
")",
";",
"projectProperties",
".",
"setApplicationVersion",
"(",
"compObj",
".",
"getApplicationVersion",
"(",
")",
")",
";",
"String",
"format",
"=",
"compObj",
".",
"getFileFormat",
"(",
")",
";",
"Class",
"<",
"?",
"extends",
"MPPVariantReader",
">",
"readerClass",
"=",
"FILE_CLASS_MAP",
".",
"get",
"(",
"format",
")",
";",
"if",
"(",
"readerClass",
"==",
"null",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"MPXJException",
".",
"INVALID_FILE",
"+",
"\": \"",
"+",
"format",
")",
";",
"}",
"MPPVariantReader",
"reader",
"=",
"readerClass",
".",
"newInstance",
"(",
")",
";",
"reader",
".",
"process",
"(",
"this",
",",
"projectFile",
",",
"root",
")",
";",
"//",
"// Update the internal structure. We'll take this opportunity to",
"// generate outline numbers for the tasks as they don't appear to",
"// be present in the MPP file.",
"//",
"config",
".",
"setAutoOutlineNumber",
"(",
"true",
")",
";",
"projectFile",
".",
"updateStructure",
"(",
")",
";",
"config",
".",
"setAutoOutlineNumber",
"(",
"false",
")",
";",
"//",
"// Perform post-processing to set the summary flag and clean",
"// up any instances where a task has an empty splits list.",
"//",
"for",
"(",
"Task",
"task",
":",
"projectFile",
".",
"getTasks",
"(",
")",
")",
"{",
"task",
".",
"setSummary",
"(",
"task",
".",
"hasChildTasks",
"(",
")",
")",
";",
"List",
"<",
"DateRange",
">",
"splits",
"=",
"task",
".",
"getSplits",
"(",
")",
";",
"if",
"(",
"splits",
"!=",
"null",
"&&",
"splits",
".",
"isEmpty",
"(",
")",
")",
"{",
"task",
".",
"setSplits",
"(",
"null",
")",
";",
"}",
"validationRelations",
"(",
"task",
")",
";",
"}",
"//",
"// Ensure that the unique ID counters are correct",
"//",
"config",
".",
"updateUniqueCounters",
"(",
")",
";",
"//",
"// Add some analytics",
"//",
"String",
"projectFilePath",
"=",
"projectFile",
".",
"getProjectProperties",
"(",
")",
".",
"getProjectFilePath",
"(",
")",
";",
"if",
"(",
"projectFilePath",
"!=",
"null",
"&&",
"projectFilePath",
".",
"startsWith",
"(",
"\"<>\\\\\"",
")",
")",
"{",
"projectProperties",
".",
"setFileApplication",
"(",
"\"Microsoft Project Server\"",
")",
";",
"}",
"else",
"{",
"projectProperties",
".",
"setFileApplication",
"(",
"\"Microsoft\"",
")",
";",
"}",
"projectProperties",
".",
"setFileType",
"(",
"\"MPP\"",
")",
";",
"return",
"(",
"projectFile",
")",
";",
"}",
"catch",
"(",
"IOException",
"ex",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"MPXJException",
".",
"READ_ERROR",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"IllegalAccessException",
"ex",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"MPXJException",
".",
"READ_ERROR",
",",
"ex",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"ex",
")",
"{",
"throw",
"new",
"MPXJException",
"(",
"MPXJException",
".",
"READ_ERROR",
",",
"ex",
")",
";",
"}",
"}"
] |
Alternative entry point allowing an MPP file to be read from
a user-supplied POI file stream.
@param fs POI file stream
@return ProjectFile instance
@throws MPXJException
|
[
"Alternative",
"entry",
"point",
"allowing",
"an",
"MPP",
"file",
"to",
"be",
"read",
"from",
"a",
"user",
"-",
"supplied",
"POI",
"file",
"stream",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPReader.java#L120-L220
|
157,378
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpp/MPPReader.java
|
MPPReader.validationRelations
|
private void validationRelations(Task task)
{
List<Relation> predecessors = task.getPredecessors();
if (!predecessors.isEmpty())
{
ArrayList<Relation> invalid = new ArrayList<Relation>();
for (Relation relation : predecessors)
{
Task sourceTask = relation.getSourceTask();
Task targetTask = relation.getTargetTask();
String sourceOutlineNumber = sourceTask.getOutlineNumber();
String targetOutlineNumber = targetTask.getOutlineNumber();
if (sourceOutlineNumber != null && targetOutlineNumber != null && sourceOutlineNumber.startsWith(targetOutlineNumber + '.'))
{
invalid.add(relation);
}
}
for (Relation relation : invalid)
{
relation.getSourceTask().removePredecessor(relation.getTargetTask(), relation.getType(), relation.getLag());
}
}
}
|
java
|
private void validationRelations(Task task)
{
List<Relation> predecessors = task.getPredecessors();
if (!predecessors.isEmpty())
{
ArrayList<Relation> invalid = new ArrayList<Relation>();
for (Relation relation : predecessors)
{
Task sourceTask = relation.getSourceTask();
Task targetTask = relation.getTargetTask();
String sourceOutlineNumber = sourceTask.getOutlineNumber();
String targetOutlineNumber = targetTask.getOutlineNumber();
if (sourceOutlineNumber != null && targetOutlineNumber != null && sourceOutlineNumber.startsWith(targetOutlineNumber + '.'))
{
invalid.add(relation);
}
}
for (Relation relation : invalid)
{
relation.getSourceTask().removePredecessor(relation.getTargetTask(), relation.getType(), relation.getLag());
}
}
}
|
[
"private",
"void",
"validationRelations",
"(",
"Task",
"task",
")",
"{",
"List",
"<",
"Relation",
">",
"predecessors",
"=",
"task",
".",
"getPredecessors",
"(",
")",
";",
"if",
"(",
"!",
"predecessors",
".",
"isEmpty",
"(",
")",
")",
"{",
"ArrayList",
"<",
"Relation",
">",
"invalid",
"=",
"new",
"ArrayList",
"<",
"Relation",
">",
"(",
")",
";",
"for",
"(",
"Relation",
"relation",
":",
"predecessors",
")",
"{",
"Task",
"sourceTask",
"=",
"relation",
".",
"getSourceTask",
"(",
")",
";",
"Task",
"targetTask",
"=",
"relation",
".",
"getTargetTask",
"(",
")",
";",
"String",
"sourceOutlineNumber",
"=",
"sourceTask",
".",
"getOutlineNumber",
"(",
")",
";",
"String",
"targetOutlineNumber",
"=",
"targetTask",
".",
"getOutlineNumber",
"(",
")",
";",
"if",
"(",
"sourceOutlineNumber",
"!=",
"null",
"&&",
"targetOutlineNumber",
"!=",
"null",
"&&",
"sourceOutlineNumber",
".",
"startsWith",
"(",
"targetOutlineNumber",
"+",
"'",
"'",
")",
")",
"{",
"invalid",
".",
"add",
"(",
"relation",
")",
";",
"}",
"}",
"for",
"(",
"Relation",
"relation",
":",
"invalid",
")",
"{",
"relation",
".",
"getSourceTask",
"(",
")",
".",
"removePredecessor",
"(",
"relation",
".",
"getTargetTask",
"(",
")",
",",
"relation",
".",
"getType",
"(",
")",
",",
"relation",
".",
"getLag",
"(",
")",
")",
";",
"}",
"}",
"}"
] |
This method validates all relationships for a task, removing
any which have been incorrectly read from the MPP file and
point to a parent task.
@param task task under test
|
[
"This",
"method",
"validates",
"all",
"relationships",
"for",
"a",
"task",
"removing",
"any",
"which",
"have",
"been",
"incorrectly",
"read",
"from",
"the",
"MPP",
"file",
"and",
"point",
"to",
"a",
"parent",
"task",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpp/MPPReader.java#L229-L254
|
157,379
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/MPXTaskField.java
|
MPXTaskField.getMpxjField
|
public static TaskField getMpxjField(int value)
{
TaskField result = null;
if (value >= 0 && value < MPX_MPXJ_ARRAY.length)
{
result = MPX_MPXJ_ARRAY[value];
}
return (result);
}
|
java
|
public static TaskField getMpxjField(int value)
{
TaskField result = null;
if (value >= 0 && value < MPX_MPXJ_ARRAY.length)
{
result = MPX_MPXJ_ARRAY[value];
}
return (result);
}
|
[
"public",
"static",
"TaskField",
"getMpxjField",
"(",
"int",
"value",
")",
"{",
"TaskField",
"result",
"=",
"null",
";",
"if",
"(",
"value",
">=",
"0",
"&&",
"value",
"<",
"MPX_MPXJ_ARRAY",
".",
"length",
")",
"{",
"result",
"=",
"MPX_MPXJ_ARRAY",
"[",
"value",
"]",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Retrieve an instance of the TaskField class based on the data read from an
MPX file.
@param value value from an MS Project file
@return TaskField instance
|
[
"Retrieve",
"an",
"instance",
"of",
"the",
"TaskField",
"class",
"based",
"on",
"the",
"data",
"read",
"from",
"an",
"MPX",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXTaskField.java#L42-L52
|
157,380
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/mpx/MPXTaskField.java
|
MPXTaskField.getMpxField
|
public static int getMpxField(int value)
{
int result = 0;
if (value >= 0 && value < MPXJ_MPX_ARRAY.length)
{
result = MPXJ_MPX_ARRAY[value];
}
return (result);
}
|
java
|
public static int getMpxField(int value)
{
int result = 0;
if (value >= 0 && value < MPXJ_MPX_ARRAY.length)
{
result = MPXJ_MPX_ARRAY[value];
}
return (result);
}
|
[
"public",
"static",
"int",
"getMpxField",
"(",
"int",
"value",
")",
"{",
"int",
"result",
"=",
"0",
";",
"if",
"(",
"value",
">=",
"0",
"&&",
"value",
"<",
"MPXJ_MPX_ARRAY",
".",
"length",
")",
"{",
"result",
"=",
"MPXJ_MPX_ARRAY",
"[",
"value",
"]",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Retrieve the integer value used to represent a task field in an
MPX file.
@param value MPXJ task field value
@return MPX field value
|
[
"Retrieve",
"the",
"integer",
"value",
"used",
"to",
"represent",
"a",
"task",
"field",
"in",
"an",
"MPX",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/mpx/MPXTaskField.java#L61-L70
|
157,381
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/TaskContainer.java
|
TaskContainer.add
|
public Task add()
{
Task task = new Task(m_projectFile, (Task) null);
add(task);
m_projectFile.getChildTasks().add(task);
return task;
}
|
java
|
public Task add()
{
Task task = new Task(m_projectFile, (Task) null);
add(task);
m_projectFile.getChildTasks().add(task);
return task;
}
|
[
"public",
"Task",
"add",
"(",
")",
"{",
"Task",
"task",
"=",
"new",
"Task",
"(",
"m_projectFile",
",",
"(",
"Task",
")",
"null",
")",
";",
"add",
"(",
"task",
")",
";",
"m_projectFile",
".",
"getChildTasks",
"(",
")",
".",
"add",
"(",
"task",
")",
";",
"return",
"task",
";",
"}"
] |
Add a task to the project.
@return new task instance
|
[
"Add",
"a",
"task",
"to",
"the",
"project",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/TaskContainer.java#L52-L58
|
157,382
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/TaskContainer.java
|
TaskContainer.synchronizeTaskIDToHierarchy
|
public void synchronizeTaskIDToHierarchy()
{
clear();
int currentID = (getByID(Integer.valueOf(0)) == null ? 1 : 0);
for (Task task : m_projectFile.getChildTasks())
{
task.setID(Integer.valueOf(currentID++));
add(task);
currentID = synchroizeTaskIDToHierarchy(task, currentID);
}
}
|
java
|
public void synchronizeTaskIDToHierarchy()
{
clear();
int currentID = (getByID(Integer.valueOf(0)) == null ? 1 : 0);
for (Task task : m_projectFile.getChildTasks())
{
task.setID(Integer.valueOf(currentID++));
add(task);
currentID = synchroizeTaskIDToHierarchy(task, currentID);
}
}
|
[
"public",
"void",
"synchronizeTaskIDToHierarchy",
"(",
")",
"{",
"clear",
"(",
")",
";",
"int",
"currentID",
"=",
"(",
"getByID",
"(",
"Integer",
".",
"valueOf",
"(",
"0",
")",
")",
"==",
"null",
"?",
"1",
":",
"0",
")",
";",
"for",
"(",
"Task",
"task",
":",
"m_projectFile",
".",
"getChildTasks",
"(",
")",
")",
"{",
"task",
".",
"setID",
"(",
"Integer",
".",
"valueOf",
"(",
"currentID",
"++",
")",
")",
";",
"add",
"(",
"task",
")",
";",
"currentID",
"=",
"synchroizeTaskIDToHierarchy",
"(",
"task",
",",
"currentID",
")",
";",
"}",
"}"
] |
Microsoft Project bases the order of tasks displayed on their ID
value. This method takes the hierarchical structure of tasks
represented in MPXJ and renumbers the ID values to ensure that
this structure is displayed as expected in Microsoft Project. This
is typically used to deal with the case where a hierarchical task
structure has been created programmatically in MPXJ.
|
[
"Microsoft",
"Project",
"bases",
"the",
"order",
"of",
"tasks",
"displayed",
"on",
"their",
"ID",
"value",
".",
"This",
"method",
"takes",
"the",
"hierarchical",
"structure",
"of",
"tasks",
"represented",
"in",
"MPXJ",
"and",
"renumbers",
"the",
"ID",
"values",
"to",
"ensure",
"that",
"this",
"structure",
"is",
"displayed",
"as",
"expected",
"in",
"Microsoft",
"Project",
".",
"This",
"is",
"typically",
"used",
"to",
"deal",
"with",
"the",
"case",
"where",
"a",
"hierarchical",
"task",
"structure",
"has",
"been",
"created",
"programmatically",
"in",
"MPXJ",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/TaskContainer.java#L122-L133
|
157,383
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/TaskContainer.java
|
TaskContainer.synchroizeTaskIDToHierarchy
|
private int synchroizeTaskIDToHierarchy(Task parentTask, int currentID)
{
for (Task task : parentTask.getChildTasks())
{
task.setID(Integer.valueOf(currentID++));
add(task);
currentID = synchroizeTaskIDToHierarchy(task, currentID);
}
return currentID;
}
|
java
|
private int synchroizeTaskIDToHierarchy(Task parentTask, int currentID)
{
for (Task task : parentTask.getChildTasks())
{
task.setID(Integer.valueOf(currentID++));
add(task);
currentID = synchroizeTaskIDToHierarchy(task, currentID);
}
return currentID;
}
|
[
"private",
"int",
"synchroizeTaskIDToHierarchy",
"(",
"Task",
"parentTask",
",",
"int",
"currentID",
")",
"{",
"for",
"(",
"Task",
"task",
":",
"parentTask",
".",
"getChildTasks",
"(",
")",
")",
"{",
"task",
".",
"setID",
"(",
"Integer",
".",
"valueOf",
"(",
"currentID",
"++",
")",
")",
";",
"add",
"(",
"task",
")",
";",
"currentID",
"=",
"synchroizeTaskIDToHierarchy",
"(",
"task",
",",
"currentID",
")",
";",
"}",
"return",
"currentID",
";",
"}"
] |
Called recursively to renumber child task IDs.
@param parentTask parent task instance
@param currentID current task ID
@return updated current task ID
|
[
"Called",
"recursively",
"to",
"renumber",
"child",
"task",
"IDs",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/TaskContainer.java#L142-L151
|
157,384
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/TaskContainer.java
|
TaskContainer.updateStructure
|
public void updateStructure()
{
if (size() > 1)
{
Collections.sort(this);
m_projectFile.getChildTasks().clear();
Task lastTask = null;
int lastLevel = -1;
boolean autoWbs = m_projectFile.getProjectConfig().getAutoWBS();
boolean autoOutlineNumber = m_projectFile.getProjectConfig().getAutoOutlineNumber();
for (Task task : this)
{
task.clearChildTasks();
Task parent = null;
if (!task.getNull())
{
int level = NumberHelper.getInt(task.getOutlineLevel());
if (lastTask != null)
{
if (level == lastLevel || task.getNull())
{
parent = lastTask.getParentTask();
level = lastLevel;
}
else
{
if (level > lastLevel)
{
parent = lastTask;
}
else
{
while (level <= lastLevel)
{
parent = lastTask.getParentTask();
if (parent == null)
{
break;
}
lastLevel = NumberHelper.getInt(parent.getOutlineLevel());
lastTask = parent;
}
}
}
}
lastTask = task;
lastLevel = level;
if (autoWbs || task.getWBS() == null)
{
task.generateWBS(parent);
}
if (autoOutlineNumber)
{
task.generateOutlineNumber(parent);
}
}
if (parent == null)
{
m_projectFile.getChildTasks().add(task);
}
else
{
parent.addChildTask(task);
}
}
}
}
|
java
|
public void updateStructure()
{
if (size() > 1)
{
Collections.sort(this);
m_projectFile.getChildTasks().clear();
Task lastTask = null;
int lastLevel = -1;
boolean autoWbs = m_projectFile.getProjectConfig().getAutoWBS();
boolean autoOutlineNumber = m_projectFile.getProjectConfig().getAutoOutlineNumber();
for (Task task : this)
{
task.clearChildTasks();
Task parent = null;
if (!task.getNull())
{
int level = NumberHelper.getInt(task.getOutlineLevel());
if (lastTask != null)
{
if (level == lastLevel || task.getNull())
{
parent = lastTask.getParentTask();
level = lastLevel;
}
else
{
if (level > lastLevel)
{
parent = lastTask;
}
else
{
while (level <= lastLevel)
{
parent = lastTask.getParentTask();
if (parent == null)
{
break;
}
lastLevel = NumberHelper.getInt(parent.getOutlineLevel());
lastTask = parent;
}
}
}
}
lastTask = task;
lastLevel = level;
if (autoWbs || task.getWBS() == null)
{
task.generateWBS(parent);
}
if (autoOutlineNumber)
{
task.generateOutlineNumber(parent);
}
}
if (parent == null)
{
m_projectFile.getChildTasks().add(task);
}
else
{
parent.addChildTask(task);
}
}
}
}
|
[
"public",
"void",
"updateStructure",
"(",
")",
"{",
"if",
"(",
"size",
"(",
")",
">",
"1",
")",
"{",
"Collections",
".",
"sort",
"(",
"this",
")",
";",
"m_projectFile",
".",
"getChildTasks",
"(",
")",
".",
"clear",
"(",
")",
";",
"Task",
"lastTask",
"=",
"null",
";",
"int",
"lastLevel",
"=",
"-",
"1",
";",
"boolean",
"autoWbs",
"=",
"m_projectFile",
".",
"getProjectConfig",
"(",
")",
".",
"getAutoWBS",
"(",
")",
";",
"boolean",
"autoOutlineNumber",
"=",
"m_projectFile",
".",
"getProjectConfig",
"(",
")",
".",
"getAutoOutlineNumber",
"(",
")",
";",
"for",
"(",
"Task",
"task",
":",
"this",
")",
"{",
"task",
".",
"clearChildTasks",
"(",
")",
";",
"Task",
"parent",
"=",
"null",
";",
"if",
"(",
"!",
"task",
".",
"getNull",
"(",
")",
")",
"{",
"int",
"level",
"=",
"NumberHelper",
".",
"getInt",
"(",
"task",
".",
"getOutlineLevel",
"(",
")",
")",
";",
"if",
"(",
"lastTask",
"!=",
"null",
")",
"{",
"if",
"(",
"level",
"==",
"lastLevel",
"||",
"task",
".",
"getNull",
"(",
")",
")",
"{",
"parent",
"=",
"lastTask",
".",
"getParentTask",
"(",
")",
";",
"level",
"=",
"lastLevel",
";",
"}",
"else",
"{",
"if",
"(",
"level",
">",
"lastLevel",
")",
"{",
"parent",
"=",
"lastTask",
";",
"}",
"else",
"{",
"while",
"(",
"level",
"<=",
"lastLevel",
")",
"{",
"parent",
"=",
"lastTask",
".",
"getParentTask",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"break",
";",
"}",
"lastLevel",
"=",
"NumberHelper",
".",
"getInt",
"(",
"parent",
".",
"getOutlineLevel",
"(",
")",
")",
";",
"lastTask",
"=",
"parent",
";",
"}",
"}",
"}",
"}",
"lastTask",
"=",
"task",
";",
"lastLevel",
"=",
"level",
";",
"if",
"(",
"autoWbs",
"||",
"task",
".",
"getWBS",
"(",
")",
"==",
"null",
")",
"{",
"task",
".",
"generateWBS",
"(",
"parent",
")",
";",
"}",
"if",
"(",
"autoOutlineNumber",
")",
"{",
"task",
".",
"generateOutlineNumber",
"(",
"parent",
")",
";",
"}",
"}",
"if",
"(",
"parent",
"==",
"null",
")",
"{",
"m_projectFile",
".",
"getChildTasks",
"(",
")",
".",
"add",
"(",
"task",
")",
";",
"}",
"else",
"{",
"parent",
".",
"addChildTask",
"(",
"task",
")",
";",
"}",
"}",
"}",
"}"
] |
This method is used to recreate the hierarchical structure of the
project file from scratch. The method sorts the list of all tasks,
then iterates through it creating the parent-child structure defined
by the outline level field.
|
[
"This",
"method",
"is",
"used",
"to",
"recreate",
"the",
"hierarchical",
"structure",
"of",
"the",
"project",
"file",
"from",
"scratch",
".",
"The",
"method",
"sorts",
"the",
"list",
"of",
"all",
"tasks",
"then",
"iterates",
"through",
"it",
"creating",
"the",
"parent",
"-",
"child",
"structure",
"defined",
"by",
"the",
"outline",
"level",
"field",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/TaskContainer.java#L159-L234
|
157,385
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/utility/MppCleanUtility.java
|
MppCleanUtility.process
|
private void process(String input, String output) throws MPXJException, IOException
{
//
// Extract the project data
//
MPPReader reader = new MPPReader();
m_project = reader.read(input);
String varDataFileName;
String projectDirName;
int mppFileType = NumberHelper.getInt(m_project.getProjectProperties().getMppFileType());
switch (mppFileType)
{
case 8:
{
projectDirName = " 1";
varDataFileName = "FixDeferFix 0";
break;
}
case 9:
{
projectDirName = " 19";
varDataFileName = "Var2Data";
break;
}
case 12:
{
projectDirName = " 112";
varDataFileName = "Var2Data";
break;
}
case 14:
{
projectDirName = " 114";
varDataFileName = "Var2Data";
break;
}
default:
{
throw new IllegalArgumentException("Unsupported file type " + mppFileType);
}
}
//
// Load the raw file
//
FileInputStream is = new FileInputStream(input);
POIFSFileSystem fs = new POIFSFileSystem(is);
is.close();
//
// Locate the root of the project file system
//
DirectoryEntry root = fs.getRoot();
m_projectDir = (DirectoryEntry) root.getEntry(projectDirName);
//
// Process Tasks
//
Map<String, String> replacements = new HashMap<String, String>();
for (Task task : m_project.getTasks())
{
mapText(task.getName(), replacements);
}
processReplacements(((DirectoryEntry) m_projectDir.getEntry("TBkndTask")), varDataFileName, replacements, true);
//
// Process Resources
//
replacements.clear();
for (Resource resource : m_project.getResources())
{
mapText(resource.getName(), replacements);
mapText(resource.getInitials(), replacements);
}
processReplacements((DirectoryEntry) m_projectDir.getEntry("TBkndRsc"), varDataFileName, replacements, true);
//
// Process project properties
//
replacements.clear();
ProjectProperties properties = m_project.getProjectProperties();
mapText(properties.getProjectTitle(), replacements);
processReplacements(m_projectDir, "Props", replacements, true);
replacements.clear();
mapText(properties.getProjectTitle(), replacements);
mapText(properties.getSubject(), replacements);
mapText(properties.getAuthor(), replacements);
mapText(properties.getKeywords(), replacements);
mapText(properties.getComments(), replacements);
processReplacements(root, "\005SummaryInformation", replacements, false);
replacements.clear();
mapText(properties.getManager(), replacements);
mapText(properties.getCompany(), replacements);
mapText(properties.getCategory(), replacements);
processReplacements(root, "\005DocumentSummaryInformation", replacements, false);
//
// Write the replacement raw file
//
FileOutputStream os = new FileOutputStream(output);
fs.writeFilesystem(os);
os.flush();
os.close();
fs.close();
}
|
java
|
private void process(String input, String output) throws MPXJException, IOException
{
//
// Extract the project data
//
MPPReader reader = new MPPReader();
m_project = reader.read(input);
String varDataFileName;
String projectDirName;
int mppFileType = NumberHelper.getInt(m_project.getProjectProperties().getMppFileType());
switch (mppFileType)
{
case 8:
{
projectDirName = " 1";
varDataFileName = "FixDeferFix 0";
break;
}
case 9:
{
projectDirName = " 19";
varDataFileName = "Var2Data";
break;
}
case 12:
{
projectDirName = " 112";
varDataFileName = "Var2Data";
break;
}
case 14:
{
projectDirName = " 114";
varDataFileName = "Var2Data";
break;
}
default:
{
throw new IllegalArgumentException("Unsupported file type " + mppFileType);
}
}
//
// Load the raw file
//
FileInputStream is = new FileInputStream(input);
POIFSFileSystem fs = new POIFSFileSystem(is);
is.close();
//
// Locate the root of the project file system
//
DirectoryEntry root = fs.getRoot();
m_projectDir = (DirectoryEntry) root.getEntry(projectDirName);
//
// Process Tasks
//
Map<String, String> replacements = new HashMap<String, String>();
for (Task task : m_project.getTasks())
{
mapText(task.getName(), replacements);
}
processReplacements(((DirectoryEntry) m_projectDir.getEntry("TBkndTask")), varDataFileName, replacements, true);
//
// Process Resources
//
replacements.clear();
for (Resource resource : m_project.getResources())
{
mapText(resource.getName(), replacements);
mapText(resource.getInitials(), replacements);
}
processReplacements((DirectoryEntry) m_projectDir.getEntry("TBkndRsc"), varDataFileName, replacements, true);
//
// Process project properties
//
replacements.clear();
ProjectProperties properties = m_project.getProjectProperties();
mapText(properties.getProjectTitle(), replacements);
processReplacements(m_projectDir, "Props", replacements, true);
replacements.clear();
mapText(properties.getProjectTitle(), replacements);
mapText(properties.getSubject(), replacements);
mapText(properties.getAuthor(), replacements);
mapText(properties.getKeywords(), replacements);
mapText(properties.getComments(), replacements);
processReplacements(root, "\005SummaryInformation", replacements, false);
replacements.clear();
mapText(properties.getManager(), replacements);
mapText(properties.getCompany(), replacements);
mapText(properties.getCategory(), replacements);
processReplacements(root, "\005DocumentSummaryInformation", replacements, false);
//
// Write the replacement raw file
//
FileOutputStream os = new FileOutputStream(output);
fs.writeFilesystem(os);
os.flush();
os.close();
fs.close();
}
|
[
"private",
"void",
"process",
"(",
"String",
"input",
",",
"String",
"output",
")",
"throws",
"MPXJException",
",",
"IOException",
"{",
"//",
"// Extract the project data",
"//",
"MPPReader",
"reader",
"=",
"new",
"MPPReader",
"(",
")",
";",
"m_project",
"=",
"reader",
".",
"read",
"(",
"input",
")",
";",
"String",
"varDataFileName",
";",
"String",
"projectDirName",
";",
"int",
"mppFileType",
"=",
"NumberHelper",
".",
"getInt",
"(",
"m_project",
".",
"getProjectProperties",
"(",
")",
".",
"getMppFileType",
"(",
")",
")",
";",
"switch",
"(",
"mppFileType",
")",
"{",
"case",
"8",
":",
"{",
"projectDirName",
"=",
"\" 1\"",
";",
"varDataFileName",
"=",
"\"FixDeferFix 0\"",
";",
"break",
";",
"}",
"case",
"9",
":",
"{",
"projectDirName",
"=",
"\" 19\"",
";",
"varDataFileName",
"=",
"\"Var2Data\"",
";",
"break",
";",
"}",
"case",
"12",
":",
"{",
"projectDirName",
"=",
"\" 112\"",
";",
"varDataFileName",
"=",
"\"Var2Data\"",
";",
"break",
";",
"}",
"case",
"14",
":",
"{",
"projectDirName",
"=",
"\" 114\"",
";",
"varDataFileName",
"=",
"\"Var2Data\"",
";",
"break",
";",
"}",
"default",
":",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Unsupported file type \"",
"+",
"mppFileType",
")",
";",
"}",
"}",
"//",
"// Load the raw file",
"//",
"FileInputStream",
"is",
"=",
"new",
"FileInputStream",
"(",
"input",
")",
";",
"POIFSFileSystem",
"fs",
"=",
"new",
"POIFSFileSystem",
"(",
"is",
")",
";",
"is",
".",
"close",
"(",
")",
";",
"//",
"// Locate the root of the project file system",
"//",
"DirectoryEntry",
"root",
"=",
"fs",
".",
"getRoot",
"(",
")",
";",
"m_projectDir",
"=",
"(",
"DirectoryEntry",
")",
"root",
".",
"getEntry",
"(",
"projectDirName",
")",
";",
"//",
"// Process Tasks",
"//",
"Map",
"<",
"String",
",",
"String",
">",
"replacements",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"for",
"(",
"Task",
"task",
":",
"m_project",
".",
"getTasks",
"(",
")",
")",
"{",
"mapText",
"(",
"task",
".",
"getName",
"(",
")",
",",
"replacements",
")",
";",
"}",
"processReplacements",
"(",
"(",
"(",
"DirectoryEntry",
")",
"m_projectDir",
".",
"getEntry",
"(",
"\"TBkndTask\"",
")",
")",
",",
"varDataFileName",
",",
"replacements",
",",
"true",
")",
";",
"//",
"// Process Resources",
"//",
"replacements",
".",
"clear",
"(",
")",
";",
"for",
"(",
"Resource",
"resource",
":",
"m_project",
".",
"getResources",
"(",
")",
")",
"{",
"mapText",
"(",
"resource",
".",
"getName",
"(",
")",
",",
"replacements",
")",
";",
"mapText",
"(",
"resource",
".",
"getInitials",
"(",
")",
",",
"replacements",
")",
";",
"}",
"processReplacements",
"(",
"(",
"DirectoryEntry",
")",
"m_projectDir",
".",
"getEntry",
"(",
"\"TBkndRsc\"",
")",
",",
"varDataFileName",
",",
"replacements",
",",
"true",
")",
";",
"//",
"// Process project properties",
"//",
"replacements",
".",
"clear",
"(",
")",
";",
"ProjectProperties",
"properties",
"=",
"m_project",
".",
"getProjectProperties",
"(",
")",
";",
"mapText",
"(",
"properties",
".",
"getProjectTitle",
"(",
")",
",",
"replacements",
")",
";",
"processReplacements",
"(",
"m_projectDir",
",",
"\"Props\"",
",",
"replacements",
",",
"true",
")",
";",
"replacements",
".",
"clear",
"(",
")",
";",
"mapText",
"(",
"properties",
".",
"getProjectTitle",
"(",
")",
",",
"replacements",
")",
";",
"mapText",
"(",
"properties",
".",
"getSubject",
"(",
")",
",",
"replacements",
")",
";",
"mapText",
"(",
"properties",
".",
"getAuthor",
"(",
")",
",",
"replacements",
")",
";",
"mapText",
"(",
"properties",
".",
"getKeywords",
"(",
")",
",",
"replacements",
")",
";",
"mapText",
"(",
"properties",
".",
"getComments",
"(",
")",
",",
"replacements",
")",
";",
"processReplacements",
"(",
"root",
",",
"\"\\005SummaryInformation\"",
",",
"replacements",
",",
"false",
")",
";",
"replacements",
".",
"clear",
"(",
")",
";",
"mapText",
"(",
"properties",
".",
"getManager",
"(",
")",
",",
"replacements",
")",
";",
"mapText",
"(",
"properties",
".",
"getCompany",
"(",
")",
",",
"replacements",
")",
";",
"mapText",
"(",
"properties",
".",
"getCategory",
"(",
")",
",",
"replacements",
")",
";",
"processReplacements",
"(",
"root",
",",
"\"\\005DocumentSummaryInformation\"",
",",
"replacements",
",",
"false",
")",
";",
"//",
"// Write the replacement raw file",
"//",
"FileOutputStream",
"os",
"=",
"new",
"FileOutputStream",
"(",
"output",
")",
";",
"fs",
".",
"writeFilesystem",
"(",
"os",
")",
";",
"os",
".",
"flush",
"(",
")",
";",
"os",
".",
"close",
"(",
")",
";",
"fs",
".",
"close",
"(",
")",
";",
"}"
] |
Process an MPP file to make it anonymous.
@param input input file name
@param output output file name
@throws Exception
|
[
"Process",
"an",
"MPP",
"file",
"to",
"make",
"it",
"anonymous",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/MppCleanUtility.java#L108-L219
|
157,386
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/utility/MppCleanUtility.java
|
MppCleanUtility.mapText
|
private void mapText(String oldText, Map<String, String> replacements)
{
char c2 = 0;
if (oldText != null && oldText.length() != 0 && !replacements.containsKey(oldText))
{
StringBuilder newText = new StringBuilder(oldText.length());
for (int loop = 0; loop < oldText.length(); loop++)
{
char c = oldText.charAt(loop);
if (Character.isUpperCase(c))
{
newText.append('X');
}
else
{
if (Character.isLowerCase(c))
{
newText.append('x');
}
else
{
if (Character.isDigit(c))
{
newText.append('0');
}
else
{
if (Character.isLetter(c))
{
// Handle other codepages etc. If possible find a way to
// maintain the same code page as original.
// E.g. replace with a character from the same alphabet.
// This 'should' work for most cases
if (c2 == 0)
{
c2 = c;
}
newText.append(c2);
}
else
{
newText.append(c);
}
}
}
}
}
replacements.put(oldText, newText.toString());
}
}
|
java
|
private void mapText(String oldText, Map<String, String> replacements)
{
char c2 = 0;
if (oldText != null && oldText.length() != 0 && !replacements.containsKey(oldText))
{
StringBuilder newText = new StringBuilder(oldText.length());
for (int loop = 0; loop < oldText.length(); loop++)
{
char c = oldText.charAt(loop);
if (Character.isUpperCase(c))
{
newText.append('X');
}
else
{
if (Character.isLowerCase(c))
{
newText.append('x');
}
else
{
if (Character.isDigit(c))
{
newText.append('0');
}
else
{
if (Character.isLetter(c))
{
// Handle other codepages etc. If possible find a way to
// maintain the same code page as original.
// E.g. replace with a character from the same alphabet.
// This 'should' work for most cases
if (c2 == 0)
{
c2 = c;
}
newText.append(c2);
}
else
{
newText.append(c);
}
}
}
}
}
replacements.put(oldText, newText.toString());
}
}
|
[
"private",
"void",
"mapText",
"(",
"String",
"oldText",
",",
"Map",
"<",
"String",
",",
"String",
">",
"replacements",
")",
"{",
"char",
"c2",
"=",
"0",
";",
"if",
"(",
"oldText",
"!=",
"null",
"&&",
"oldText",
".",
"length",
"(",
")",
"!=",
"0",
"&&",
"!",
"replacements",
".",
"containsKey",
"(",
"oldText",
")",
")",
"{",
"StringBuilder",
"newText",
"=",
"new",
"StringBuilder",
"(",
"oldText",
".",
"length",
"(",
")",
")",
";",
"for",
"(",
"int",
"loop",
"=",
"0",
";",
"loop",
"<",
"oldText",
".",
"length",
"(",
")",
";",
"loop",
"++",
")",
"{",
"char",
"c",
"=",
"oldText",
".",
"charAt",
"(",
"loop",
")",
";",
"if",
"(",
"Character",
".",
"isUpperCase",
"(",
"c",
")",
")",
"{",
"newText",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"if",
"(",
"Character",
".",
"isLowerCase",
"(",
"c",
")",
")",
"{",
"newText",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"if",
"(",
"Character",
".",
"isDigit",
"(",
"c",
")",
")",
"{",
"newText",
".",
"append",
"(",
"'",
"'",
")",
";",
"}",
"else",
"{",
"if",
"(",
"Character",
".",
"isLetter",
"(",
"c",
")",
")",
"{",
"// Handle other codepages etc. If possible find a way to",
"// maintain the same code page as original.",
"// E.g. replace with a character from the same alphabet.",
"// This 'should' work for most cases",
"if",
"(",
"c2",
"==",
"0",
")",
"{",
"c2",
"=",
"c",
";",
"}",
"newText",
".",
"append",
"(",
"c2",
")",
";",
"}",
"else",
"{",
"newText",
".",
"append",
"(",
"c",
")",
";",
"}",
"}",
"}",
"}",
"}",
"replacements",
".",
"put",
"(",
"oldText",
",",
"newText",
".",
"toString",
"(",
")",
")",
";",
"}",
"}"
] |
Converts plan text into anonymous text. Preserves upper case, lower case,
punctuation, whitespace and digits while making the text unreadable.
@param oldText text to replace
@param replacements map of find/replace pairs
|
[
"Converts",
"plan",
"text",
"into",
"anonymous",
"text",
".",
"Preserves",
"upper",
"case",
"lower",
"case",
"punctuation",
"whitespace",
"and",
"digits",
"while",
"making",
"the",
"text",
"unreadable",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/MppCleanUtility.java#L282-L332
|
157,387
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/utility/MppCleanUtility.java
|
MppCleanUtility.getBytes
|
private byte[] getBytes(String value, boolean unicode)
{
byte[] result;
if (unicode)
{
int start = 0;
// Get the bytes in UTF-16
byte[] bytes;
try
{
bytes = value.getBytes("UTF-16");
}
catch (UnsupportedEncodingException e)
{
bytes = value.getBytes();
}
if (bytes.length > 2 && bytes[0] == -2 && bytes[1] == -1)
{
// Skip the unicode identifier
start = 2;
}
result = new byte[bytes.length - start];
for (int loop = start; loop < bytes.length - 1; loop += 2)
{
// Swap the order here
result[loop - start] = bytes[loop + 1];
result[loop + 1 - start] = bytes[loop];
}
}
else
{
result = new byte[value.length() + 1];
System.arraycopy(value.getBytes(), 0, result, 0, value.length());
}
return (result);
}
|
java
|
private byte[] getBytes(String value, boolean unicode)
{
byte[] result;
if (unicode)
{
int start = 0;
// Get the bytes in UTF-16
byte[] bytes;
try
{
bytes = value.getBytes("UTF-16");
}
catch (UnsupportedEncodingException e)
{
bytes = value.getBytes();
}
if (bytes.length > 2 && bytes[0] == -2 && bytes[1] == -1)
{
// Skip the unicode identifier
start = 2;
}
result = new byte[bytes.length - start];
for (int loop = start; loop < bytes.length - 1; loop += 2)
{
// Swap the order here
result[loop - start] = bytes[loop + 1];
result[loop + 1 - start] = bytes[loop];
}
}
else
{
result = new byte[value.length() + 1];
System.arraycopy(value.getBytes(), 0, result, 0, value.length());
}
return (result);
}
|
[
"private",
"byte",
"[",
"]",
"getBytes",
"(",
"String",
"value",
",",
"boolean",
"unicode",
")",
"{",
"byte",
"[",
"]",
"result",
";",
"if",
"(",
"unicode",
")",
"{",
"int",
"start",
"=",
"0",
";",
"// Get the bytes in UTF-16",
"byte",
"[",
"]",
"bytes",
";",
"try",
"{",
"bytes",
"=",
"value",
".",
"getBytes",
"(",
"\"UTF-16\"",
")",
";",
"}",
"catch",
"(",
"UnsupportedEncodingException",
"e",
")",
"{",
"bytes",
"=",
"value",
".",
"getBytes",
"(",
")",
";",
"}",
"if",
"(",
"bytes",
".",
"length",
">",
"2",
"&&",
"bytes",
"[",
"0",
"]",
"==",
"-",
"2",
"&&",
"bytes",
"[",
"1",
"]",
"==",
"-",
"1",
")",
"{",
"// Skip the unicode identifier",
"start",
"=",
"2",
";",
"}",
"result",
"=",
"new",
"byte",
"[",
"bytes",
".",
"length",
"-",
"start",
"]",
";",
"for",
"(",
"int",
"loop",
"=",
"start",
";",
"loop",
"<",
"bytes",
".",
"length",
"-",
"1",
";",
"loop",
"+=",
"2",
")",
"{",
"// Swap the order here",
"result",
"[",
"loop",
"-",
"start",
"]",
"=",
"bytes",
"[",
"loop",
"+",
"1",
"]",
";",
"result",
"[",
"loop",
"+",
"1",
"-",
"start",
"]",
"=",
"bytes",
"[",
"loop",
"]",
";",
"}",
"}",
"else",
"{",
"result",
"=",
"new",
"byte",
"[",
"value",
".",
"length",
"(",
")",
"+",
"1",
"]",
";",
"System",
".",
"arraycopy",
"(",
"value",
".",
"getBytes",
"(",
")",
",",
"0",
",",
"result",
",",
"0",
",",
"value",
".",
"length",
"(",
")",
")",
";",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Convert a Java String instance into the equivalent array of single or
double bytes.
@param value Java String instance representing text
@param unicode true if double byte characters are required
@return byte array representing the supplied text
|
[
"Convert",
"a",
"Java",
"String",
"instance",
"into",
"the",
"equivalent",
"array",
"of",
"single",
"or",
"double",
"bytes",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/MppCleanUtility.java#L373-L410
|
157,388
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/utility/MppCleanUtility.java
|
MppCleanUtility.compareBytes
|
private boolean compareBytes(byte[] lhs, byte[] rhs, int rhsOffset)
{
boolean result = true;
for (int loop = 0; loop < lhs.length; loop++)
{
if (lhs[loop] != rhs[rhsOffset + loop])
{
result = false;
break;
}
}
return (result);
}
|
java
|
private boolean compareBytes(byte[] lhs, byte[] rhs, int rhsOffset)
{
boolean result = true;
for (int loop = 0; loop < lhs.length; loop++)
{
if (lhs[loop] != rhs[rhsOffset + loop])
{
result = false;
break;
}
}
return (result);
}
|
[
"private",
"boolean",
"compareBytes",
"(",
"byte",
"[",
"]",
"lhs",
",",
"byte",
"[",
"]",
"rhs",
",",
"int",
"rhsOffset",
")",
"{",
"boolean",
"result",
"=",
"true",
";",
"for",
"(",
"int",
"loop",
"=",
"0",
";",
"loop",
"<",
"lhs",
".",
"length",
";",
"loop",
"++",
")",
"{",
"if",
"(",
"lhs",
"[",
"loop",
"]",
"!=",
"rhs",
"[",
"rhsOffset",
"+",
"loop",
"]",
")",
"{",
"result",
"=",
"false",
";",
"break",
";",
"}",
"}",
"return",
"(",
"result",
")",
";",
"}"
] |
Compare an array of bytes with a subsection of a larger array of bytes.
@param lhs small array of bytes
@param rhs large array of bytes
@param rhsOffset offset into larger array of bytes
@return true if a match is found
|
[
"Compare",
"an",
"array",
"of",
"bytes",
"with",
"a",
"subsection",
"of",
"a",
"larger",
"array",
"of",
"bytes",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/utility/MppCleanUtility.java#L420-L432
|
157,389
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeCurrency
|
private void writeCurrency()
{
ProjectProperties props = m_projectFile.getProjectProperties();
CurrencyType currency = m_factory.createCurrencyType();
m_apibo.getCurrency().add(currency);
String positiveSymbol = getCurrencyFormat(props.getSymbolPosition());
String negativeSymbol = "(" + positiveSymbol + ")";
currency.setDecimalPlaces(props.getCurrencyDigits());
currency.setDecimalSymbol(getSymbolName(props.getDecimalSeparator()));
currency.setDigitGroupingSymbol(getSymbolName(props.getThousandsSeparator()));
currency.setExchangeRate(Double.valueOf(1.0));
currency.setId("CUR");
currency.setName("Default Currency");
currency.setNegativeSymbol(negativeSymbol);
currency.setObjectId(DEFAULT_CURRENCY_ID);
currency.setPositiveSymbol(positiveSymbol);
currency.setSymbol(props.getCurrencySymbol());
}
|
java
|
private void writeCurrency()
{
ProjectProperties props = m_projectFile.getProjectProperties();
CurrencyType currency = m_factory.createCurrencyType();
m_apibo.getCurrency().add(currency);
String positiveSymbol = getCurrencyFormat(props.getSymbolPosition());
String negativeSymbol = "(" + positiveSymbol + ")";
currency.setDecimalPlaces(props.getCurrencyDigits());
currency.setDecimalSymbol(getSymbolName(props.getDecimalSeparator()));
currency.setDigitGroupingSymbol(getSymbolName(props.getThousandsSeparator()));
currency.setExchangeRate(Double.valueOf(1.0));
currency.setId("CUR");
currency.setName("Default Currency");
currency.setNegativeSymbol(negativeSymbol);
currency.setObjectId(DEFAULT_CURRENCY_ID);
currency.setPositiveSymbol(positiveSymbol);
currency.setSymbol(props.getCurrencySymbol());
}
|
[
"private",
"void",
"writeCurrency",
"(",
")",
"{",
"ProjectProperties",
"props",
"=",
"m_projectFile",
".",
"getProjectProperties",
"(",
")",
";",
"CurrencyType",
"currency",
"=",
"m_factory",
".",
"createCurrencyType",
"(",
")",
";",
"m_apibo",
".",
"getCurrency",
"(",
")",
".",
"add",
"(",
"currency",
")",
";",
"String",
"positiveSymbol",
"=",
"getCurrencyFormat",
"(",
"props",
".",
"getSymbolPosition",
"(",
")",
")",
";",
"String",
"negativeSymbol",
"=",
"\"(\"",
"+",
"positiveSymbol",
"+",
"\")\"",
";",
"currency",
".",
"setDecimalPlaces",
"(",
"props",
".",
"getCurrencyDigits",
"(",
")",
")",
";",
"currency",
".",
"setDecimalSymbol",
"(",
"getSymbolName",
"(",
"props",
".",
"getDecimalSeparator",
"(",
")",
")",
")",
";",
"currency",
".",
"setDigitGroupingSymbol",
"(",
"getSymbolName",
"(",
"props",
".",
"getThousandsSeparator",
"(",
")",
")",
")",
";",
"currency",
".",
"setExchangeRate",
"(",
"Double",
".",
"valueOf",
"(",
"1.0",
")",
")",
";",
"currency",
".",
"setId",
"(",
"\"CUR\"",
")",
";",
"currency",
".",
"setName",
"(",
"\"Default Currency\"",
")",
";",
"currency",
".",
"setNegativeSymbol",
"(",
"negativeSymbol",
")",
";",
"currency",
".",
"setObjectId",
"(",
"DEFAULT_CURRENCY_ID",
")",
";",
"currency",
".",
"setPositiveSymbol",
"(",
"positiveSymbol",
")",
";",
"currency",
".",
"setSymbol",
"(",
"props",
".",
"getCurrencySymbol",
"(",
")",
")",
";",
"}"
] |
Create a handful of default currencies to keep Primavera happy.
|
[
"Create",
"a",
"handful",
"of",
"default",
"currencies",
"to",
"keep",
"Primavera",
"happy",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L239-L258
|
157,390
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.getSymbolName
|
private String getSymbolName(char c)
{
String result = null;
switch (c)
{
case ',':
{
result = "Comma";
break;
}
case '.':
{
result = "Period";
break;
}
}
return result;
}
|
java
|
private String getSymbolName(char c)
{
String result = null;
switch (c)
{
case ',':
{
result = "Comma";
break;
}
case '.':
{
result = "Period";
break;
}
}
return result;
}
|
[
"private",
"String",
"getSymbolName",
"(",
"char",
"c",
")",
"{",
"String",
"result",
"=",
"null",
";",
"switch",
"(",
"c",
")",
"{",
"case",
"'",
"'",
":",
"{",
"result",
"=",
"\"Comma\"",
";",
"break",
";",
"}",
"case",
"'",
"'",
":",
"{",
"result",
"=",
"\"Period\"",
";",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Map the currency separator character to a symbol name.
@param c currency separator character
@return symbol name
|
[
"Map",
"the",
"currency",
"separator",
"character",
"to",
"a",
"symbol",
"name",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L266-L286
|
157,391
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.getCurrencyFormat
|
private String getCurrencyFormat(CurrencySymbolPosition position)
{
String result;
switch (position)
{
case AFTER:
{
result = "1.1#";
break;
}
case AFTER_WITH_SPACE:
{
result = "1.1 #";
break;
}
case BEFORE_WITH_SPACE:
{
result = "# 1.1";
break;
}
default:
case BEFORE:
{
result = "#1.1";
break;
}
}
return result;
}
|
java
|
private String getCurrencyFormat(CurrencySymbolPosition position)
{
String result;
switch (position)
{
case AFTER:
{
result = "1.1#";
break;
}
case AFTER_WITH_SPACE:
{
result = "1.1 #";
break;
}
case BEFORE_WITH_SPACE:
{
result = "# 1.1";
break;
}
default:
case BEFORE:
{
result = "#1.1";
break;
}
}
return result;
}
|
[
"private",
"String",
"getCurrencyFormat",
"(",
"CurrencySymbolPosition",
"position",
")",
"{",
"String",
"result",
";",
"switch",
"(",
"position",
")",
"{",
"case",
"AFTER",
":",
"{",
"result",
"=",
"\"1.1#\"",
";",
"break",
";",
"}",
"case",
"AFTER_WITH_SPACE",
":",
"{",
"result",
"=",
"\"1.1 #\"",
";",
"break",
";",
"}",
"case",
"BEFORE_WITH_SPACE",
":",
"{",
"result",
"=",
"\"# 1.1\"",
";",
"break",
";",
"}",
"default",
":",
"case",
"BEFORE",
":",
"{",
"result",
"=",
"\"#1.1\"",
";",
"break",
";",
"}",
"}",
"return",
"result",
";",
"}"
] |
Generate a currency format.
@param position currency symbol position
@return currency format
|
[
"Generate",
"a",
"currency",
"format",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L294-L327
|
157,392
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeUserFieldDefinitions
|
private void writeUserFieldDefinitions()
{
for (CustomField cf : m_sortedCustomFieldsList)
{
if (cf.getFieldType() != null && cf.getFieldType().getDataType() != null)
{
UDFTypeType udf = m_factory.createUDFTypeType();
udf.setObjectId(Integer.valueOf(FieldTypeHelper.getFieldID(cf.getFieldType())));
udf.setDataType(UserFieldDataType.inferUserFieldDataType(cf.getFieldType().getDataType()));
udf.setSubjectArea(UserFieldDataType.inferUserFieldSubjectArea(cf.getFieldType()));
udf.setTitle(cf.getAlias());
m_apibo.getUDFType().add(udf);
}
}
}
|
java
|
private void writeUserFieldDefinitions()
{
for (CustomField cf : m_sortedCustomFieldsList)
{
if (cf.getFieldType() != null && cf.getFieldType().getDataType() != null)
{
UDFTypeType udf = m_factory.createUDFTypeType();
udf.setObjectId(Integer.valueOf(FieldTypeHelper.getFieldID(cf.getFieldType())));
udf.setDataType(UserFieldDataType.inferUserFieldDataType(cf.getFieldType().getDataType()));
udf.setSubjectArea(UserFieldDataType.inferUserFieldSubjectArea(cf.getFieldType()));
udf.setTitle(cf.getAlias());
m_apibo.getUDFType().add(udf);
}
}
}
|
[
"private",
"void",
"writeUserFieldDefinitions",
"(",
")",
"{",
"for",
"(",
"CustomField",
"cf",
":",
"m_sortedCustomFieldsList",
")",
"{",
"if",
"(",
"cf",
".",
"getFieldType",
"(",
")",
"!=",
"null",
"&&",
"cf",
".",
"getFieldType",
"(",
")",
".",
"getDataType",
"(",
")",
"!=",
"null",
")",
"{",
"UDFTypeType",
"udf",
"=",
"m_factory",
".",
"createUDFTypeType",
"(",
")",
";",
"udf",
".",
"setObjectId",
"(",
"Integer",
".",
"valueOf",
"(",
"FieldTypeHelper",
".",
"getFieldID",
"(",
"cf",
".",
"getFieldType",
"(",
")",
")",
")",
")",
";",
"udf",
".",
"setDataType",
"(",
"UserFieldDataType",
".",
"inferUserFieldDataType",
"(",
"cf",
".",
"getFieldType",
"(",
")",
".",
"getDataType",
"(",
")",
")",
")",
";",
"udf",
".",
"setSubjectArea",
"(",
"UserFieldDataType",
".",
"inferUserFieldSubjectArea",
"(",
"cf",
".",
"getFieldType",
"(",
")",
")",
")",
";",
"udf",
".",
"setTitle",
"(",
"cf",
".",
"getAlias",
"(",
")",
")",
";",
"m_apibo",
".",
"getUDFType",
"(",
")",
".",
"add",
"(",
"udf",
")",
";",
"}",
"}",
"}"
] |
Add UDFType objects to a PM XML file.
@author kmahan
@date 2014-09-24
@author lsong
@date 2015-7-24
|
[
"Add",
"UDFType",
"objects",
"to",
"a",
"PM",
"XML",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L337-L352
|
157,393
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeCalendar
|
private void writeCalendar(ProjectCalendar mpxj)
{
CalendarType xml = m_factory.createCalendarType();
m_apibo.getCalendar().add(xml);
String type = mpxj.getResource() == null ? "Global" : "Resource";
xml.setBaseCalendarObjectId(getCalendarUniqueID(mpxj.getParent()));
xml.setIsPersonal(mpxj.getResource() == null ? Boolean.FALSE : Boolean.TRUE);
xml.setName(mpxj.getName());
xml.setObjectId(mpxj.getUniqueID());
xml.setType(type);
StandardWorkWeek xmlStandardWorkWeek = m_factory.createCalendarTypeStandardWorkWeek();
xml.setStandardWorkWeek(xmlStandardWorkWeek);
for (Day day : EnumSet.allOf(Day.class))
{
StandardWorkHours xmlHours = m_factory.createCalendarTypeStandardWorkWeekStandardWorkHours();
xmlStandardWorkWeek.getStandardWorkHours().add(xmlHours);
xmlHours.setDayOfWeek(getDayName(day));
for (DateRange range : mpxj.getHours(day))
{
WorkTimeType xmlWorkTime = m_factory.createWorkTimeType();
xmlHours.getWorkTime().add(xmlWorkTime);
xmlWorkTime.setStart(range.getStart());
xmlWorkTime.setFinish(getEndTime(range.getEnd()));
}
}
HolidayOrExceptions xmlExceptions = m_factory.createCalendarTypeHolidayOrExceptions();
xml.setHolidayOrExceptions(xmlExceptions);
if (!mpxj.getCalendarExceptions().isEmpty())
{
Calendar calendar = DateHelper.popCalendar();
for (ProjectCalendarException mpxjException : mpxj.getCalendarExceptions())
{
calendar.setTime(mpxjException.getFromDate());
while (calendar.getTimeInMillis() < mpxjException.getToDate().getTime())
{
HolidayOrException xmlException = m_factory.createCalendarTypeHolidayOrExceptionsHolidayOrException();
xmlExceptions.getHolidayOrException().add(xmlException);
xmlException.setDate(calendar.getTime());
for (DateRange range : mpxjException)
{
WorkTimeType xmlHours = m_factory.createWorkTimeType();
xmlException.getWorkTime().add(xmlHours);
xmlHours.setStart(range.getStart());
if (range.getEnd() != null)
{
xmlHours.setFinish(getEndTime(range.getEnd()));
}
}
calendar.add(Calendar.DAY_OF_YEAR, 1);
}
}
DateHelper.pushCalendar(calendar);
}
}
|
java
|
private void writeCalendar(ProjectCalendar mpxj)
{
CalendarType xml = m_factory.createCalendarType();
m_apibo.getCalendar().add(xml);
String type = mpxj.getResource() == null ? "Global" : "Resource";
xml.setBaseCalendarObjectId(getCalendarUniqueID(mpxj.getParent()));
xml.setIsPersonal(mpxj.getResource() == null ? Boolean.FALSE : Boolean.TRUE);
xml.setName(mpxj.getName());
xml.setObjectId(mpxj.getUniqueID());
xml.setType(type);
StandardWorkWeek xmlStandardWorkWeek = m_factory.createCalendarTypeStandardWorkWeek();
xml.setStandardWorkWeek(xmlStandardWorkWeek);
for (Day day : EnumSet.allOf(Day.class))
{
StandardWorkHours xmlHours = m_factory.createCalendarTypeStandardWorkWeekStandardWorkHours();
xmlStandardWorkWeek.getStandardWorkHours().add(xmlHours);
xmlHours.setDayOfWeek(getDayName(day));
for (DateRange range : mpxj.getHours(day))
{
WorkTimeType xmlWorkTime = m_factory.createWorkTimeType();
xmlHours.getWorkTime().add(xmlWorkTime);
xmlWorkTime.setStart(range.getStart());
xmlWorkTime.setFinish(getEndTime(range.getEnd()));
}
}
HolidayOrExceptions xmlExceptions = m_factory.createCalendarTypeHolidayOrExceptions();
xml.setHolidayOrExceptions(xmlExceptions);
if (!mpxj.getCalendarExceptions().isEmpty())
{
Calendar calendar = DateHelper.popCalendar();
for (ProjectCalendarException mpxjException : mpxj.getCalendarExceptions())
{
calendar.setTime(mpxjException.getFromDate());
while (calendar.getTimeInMillis() < mpxjException.getToDate().getTime())
{
HolidayOrException xmlException = m_factory.createCalendarTypeHolidayOrExceptionsHolidayOrException();
xmlExceptions.getHolidayOrException().add(xmlException);
xmlException.setDate(calendar.getTime());
for (DateRange range : mpxjException)
{
WorkTimeType xmlHours = m_factory.createWorkTimeType();
xmlException.getWorkTime().add(xmlHours);
xmlHours.setStart(range.getStart());
if (range.getEnd() != null)
{
xmlHours.setFinish(getEndTime(range.getEnd()));
}
}
calendar.add(Calendar.DAY_OF_YEAR, 1);
}
}
DateHelper.pushCalendar(calendar);
}
}
|
[
"private",
"void",
"writeCalendar",
"(",
"ProjectCalendar",
"mpxj",
")",
"{",
"CalendarType",
"xml",
"=",
"m_factory",
".",
"createCalendarType",
"(",
")",
";",
"m_apibo",
".",
"getCalendar",
"(",
")",
".",
"add",
"(",
"xml",
")",
";",
"String",
"type",
"=",
"mpxj",
".",
"getResource",
"(",
")",
"==",
"null",
"?",
"\"Global\"",
":",
"\"Resource\"",
";",
"xml",
".",
"setBaseCalendarObjectId",
"(",
"getCalendarUniqueID",
"(",
"mpxj",
".",
"getParent",
"(",
")",
")",
")",
";",
"xml",
".",
"setIsPersonal",
"(",
"mpxj",
".",
"getResource",
"(",
")",
"==",
"null",
"?",
"Boolean",
".",
"FALSE",
":",
"Boolean",
".",
"TRUE",
")",
";",
"xml",
".",
"setName",
"(",
"mpxj",
".",
"getName",
"(",
")",
")",
";",
"xml",
".",
"setObjectId",
"(",
"mpxj",
".",
"getUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setType",
"(",
"type",
")",
";",
"StandardWorkWeek",
"xmlStandardWorkWeek",
"=",
"m_factory",
".",
"createCalendarTypeStandardWorkWeek",
"(",
")",
";",
"xml",
".",
"setStandardWorkWeek",
"(",
"xmlStandardWorkWeek",
")",
";",
"for",
"(",
"Day",
"day",
":",
"EnumSet",
".",
"allOf",
"(",
"Day",
".",
"class",
")",
")",
"{",
"StandardWorkHours",
"xmlHours",
"=",
"m_factory",
".",
"createCalendarTypeStandardWorkWeekStandardWorkHours",
"(",
")",
";",
"xmlStandardWorkWeek",
".",
"getStandardWorkHours",
"(",
")",
".",
"add",
"(",
"xmlHours",
")",
";",
"xmlHours",
".",
"setDayOfWeek",
"(",
"getDayName",
"(",
"day",
")",
")",
";",
"for",
"(",
"DateRange",
"range",
":",
"mpxj",
".",
"getHours",
"(",
"day",
")",
")",
"{",
"WorkTimeType",
"xmlWorkTime",
"=",
"m_factory",
".",
"createWorkTimeType",
"(",
")",
";",
"xmlHours",
".",
"getWorkTime",
"(",
")",
".",
"add",
"(",
"xmlWorkTime",
")",
";",
"xmlWorkTime",
".",
"setStart",
"(",
"range",
".",
"getStart",
"(",
")",
")",
";",
"xmlWorkTime",
".",
"setFinish",
"(",
"getEndTime",
"(",
"range",
".",
"getEnd",
"(",
")",
")",
")",
";",
"}",
"}",
"HolidayOrExceptions",
"xmlExceptions",
"=",
"m_factory",
".",
"createCalendarTypeHolidayOrExceptions",
"(",
")",
";",
"xml",
".",
"setHolidayOrExceptions",
"(",
"xmlExceptions",
")",
";",
"if",
"(",
"!",
"mpxj",
".",
"getCalendarExceptions",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"{",
"Calendar",
"calendar",
"=",
"DateHelper",
".",
"popCalendar",
"(",
")",
";",
"for",
"(",
"ProjectCalendarException",
"mpxjException",
":",
"mpxj",
".",
"getCalendarExceptions",
"(",
")",
")",
"{",
"calendar",
".",
"setTime",
"(",
"mpxjException",
".",
"getFromDate",
"(",
")",
")",
";",
"while",
"(",
"calendar",
".",
"getTimeInMillis",
"(",
")",
"<",
"mpxjException",
".",
"getToDate",
"(",
")",
".",
"getTime",
"(",
")",
")",
"{",
"HolidayOrException",
"xmlException",
"=",
"m_factory",
".",
"createCalendarTypeHolidayOrExceptionsHolidayOrException",
"(",
")",
";",
"xmlExceptions",
".",
"getHolidayOrException",
"(",
")",
".",
"add",
"(",
"xmlException",
")",
";",
"xmlException",
".",
"setDate",
"(",
"calendar",
".",
"getTime",
"(",
")",
")",
";",
"for",
"(",
"DateRange",
"range",
":",
"mpxjException",
")",
"{",
"WorkTimeType",
"xmlHours",
"=",
"m_factory",
".",
"createWorkTimeType",
"(",
")",
";",
"xmlException",
".",
"getWorkTime",
"(",
")",
".",
"add",
"(",
"xmlHours",
")",
";",
"xmlHours",
".",
"setStart",
"(",
"range",
".",
"getStart",
"(",
")",
")",
";",
"if",
"(",
"range",
".",
"getEnd",
"(",
")",
"!=",
"null",
")",
"{",
"xmlHours",
".",
"setFinish",
"(",
"getEndTime",
"(",
"range",
".",
"getEnd",
"(",
")",
")",
")",
";",
"}",
"}",
"calendar",
".",
"add",
"(",
"Calendar",
".",
"DAY_OF_YEAR",
",",
"1",
")",
";",
"}",
"}",
"DateHelper",
".",
"pushCalendar",
"(",
"calendar",
")",
";",
"}",
"}"
] |
This method writes data for an individual calendar to a PM XML file.
@param mpxj ProjectCalander instance
|
[
"This",
"method",
"writes",
"data",
"for",
"an",
"individual",
"calendar",
"to",
"a",
"PM",
"XML",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L439-L503
|
157,394
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeResources
|
private void writeResources()
{
for (Resource resource : m_projectFile.getResources())
{
if (resource.getUniqueID().intValue() != 0)
{
writeResource(resource);
}
}
}
|
java
|
private void writeResources()
{
for (Resource resource : m_projectFile.getResources())
{
if (resource.getUniqueID().intValue() != 0)
{
writeResource(resource);
}
}
}
|
[
"private",
"void",
"writeResources",
"(",
")",
"{",
"for",
"(",
"Resource",
"resource",
":",
"m_projectFile",
".",
"getResources",
"(",
")",
")",
"{",
"if",
"(",
"resource",
".",
"getUniqueID",
"(",
")",
".",
"intValue",
"(",
")",
"!=",
"0",
")",
"{",
"writeResource",
"(",
"resource",
")",
";",
"}",
"}",
"}"
] |
This method writes resource data to a PM XML file.
|
[
"This",
"method",
"writes",
"resource",
"data",
"to",
"a",
"PM",
"XML",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L508-L517
|
157,395
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeResource
|
private void writeResource(Resource mpxj)
{
ResourceType xml = m_factory.createResourceType();
m_apibo.getResource().add(xml);
xml.setAutoComputeActuals(Boolean.TRUE);
xml.setCalculateCostFromUnits(Boolean.TRUE);
xml.setCalendarObjectId(getCalendarUniqueID(mpxj.getResourceCalendar()));
xml.setCurrencyObjectId(DEFAULT_CURRENCY_ID);
xml.setDefaultUnitsPerTime(Double.valueOf(1.0));
xml.setEmailAddress(mpxj.getEmailAddress());
xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
xml.setId(RESOURCE_ID_PREFIX + mpxj.getUniqueID());
xml.setIsActive(Boolean.TRUE);
xml.setMaxUnitsPerTime(getPercentage(mpxj.getMaxUnits()));
xml.setName(mpxj.getName());
xml.setObjectId(mpxj.getUniqueID());
xml.setParentObjectId(mpxj.getParentID());
xml.setResourceNotes(mpxj.getNotes());
xml.setResourceType(getResourceType(mpxj));
xml.getUDF().addAll(writeUDFType(FieldTypeClass.RESOURCE, mpxj));
}
|
java
|
private void writeResource(Resource mpxj)
{
ResourceType xml = m_factory.createResourceType();
m_apibo.getResource().add(xml);
xml.setAutoComputeActuals(Boolean.TRUE);
xml.setCalculateCostFromUnits(Boolean.TRUE);
xml.setCalendarObjectId(getCalendarUniqueID(mpxj.getResourceCalendar()));
xml.setCurrencyObjectId(DEFAULT_CURRENCY_ID);
xml.setDefaultUnitsPerTime(Double.valueOf(1.0));
xml.setEmailAddress(mpxj.getEmailAddress());
xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
xml.setId(RESOURCE_ID_PREFIX + mpxj.getUniqueID());
xml.setIsActive(Boolean.TRUE);
xml.setMaxUnitsPerTime(getPercentage(mpxj.getMaxUnits()));
xml.setName(mpxj.getName());
xml.setObjectId(mpxj.getUniqueID());
xml.setParentObjectId(mpxj.getParentID());
xml.setResourceNotes(mpxj.getNotes());
xml.setResourceType(getResourceType(mpxj));
xml.getUDF().addAll(writeUDFType(FieldTypeClass.RESOURCE, mpxj));
}
|
[
"private",
"void",
"writeResource",
"(",
"Resource",
"mpxj",
")",
"{",
"ResourceType",
"xml",
"=",
"m_factory",
".",
"createResourceType",
"(",
")",
";",
"m_apibo",
".",
"getResource",
"(",
")",
".",
"add",
"(",
"xml",
")",
";",
"xml",
".",
"setAutoComputeActuals",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"xml",
".",
"setCalculateCostFromUnits",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"xml",
".",
"setCalendarObjectId",
"(",
"getCalendarUniqueID",
"(",
"mpxj",
".",
"getResourceCalendar",
"(",
")",
")",
")",
";",
"xml",
".",
"setCurrencyObjectId",
"(",
"DEFAULT_CURRENCY_ID",
")",
";",
"xml",
".",
"setDefaultUnitsPerTime",
"(",
"Double",
".",
"valueOf",
"(",
"1.0",
")",
")",
";",
"xml",
".",
"setEmailAddress",
"(",
"mpxj",
".",
"getEmailAddress",
"(",
")",
")",
";",
"xml",
".",
"setGUID",
"(",
"DatatypeConverter",
".",
"printUUID",
"(",
"mpxj",
".",
"getGUID",
"(",
")",
")",
")",
";",
"xml",
".",
"setId",
"(",
"RESOURCE_ID_PREFIX",
"+",
"mpxj",
".",
"getUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setIsActive",
"(",
"Boolean",
".",
"TRUE",
")",
";",
"xml",
".",
"setMaxUnitsPerTime",
"(",
"getPercentage",
"(",
"mpxj",
".",
"getMaxUnits",
"(",
")",
")",
")",
";",
"xml",
".",
"setName",
"(",
"mpxj",
".",
"getName",
"(",
")",
")",
";",
"xml",
".",
"setObjectId",
"(",
"mpxj",
".",
"getUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setParentObjectId",
"(",
"mpxj",
".",
"getParentID",
"(",
")",
")",
";",
"xml",
".",
"setResourceNotes",
"(",
"mpxj",
".",
"getNotes",
"(",
")",
")",
";",
"xml",
".",
"setResourceType",
"(",
"getResourceType",
"(",
"mpxj",
")",
")",
";",
"xml",
".",
"getUDF",
"(",
")",
".",
"addAll",
"(",
"writeUDFType",
"(",
"FieldTypeClass",
".",
"RESOURCE",
",",
"mpxj",
")",
")",
";",
"}"
] |
Write a single resource.
@param mpxj Resource instance
|
[
"Write",
"a",
"single",
"resource",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L524-L545
|
157,396
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeTask
|
private void writeTask(Task task)
{
if (!task.getNull())
{
if (extractAndConvertTaskType(task) == null || task.getSummary())
{
writeWBS(task);
}
else
{
writeActivity(task);
}
}
}
|
java
|
private void writeTask(Task task)
{
if (!task.getNull())
{
if (extractAndConvertTaskType(task) == null || task.getSummary())
{
writeWBS(task);
}
else
{
writeActivity(task);
}
}
}
|
[
"private",
"void",
"writeTask",
"(",
"Task",
"task",
")",
"{",
"if",
"(",
"!",
"task",
".",
"getNull",
"(",
")",
")",
"{",
"if",
"(",
"extractAndConvertTaskType",
"(",
"task",
")",
"==",
"null",
"||",
"task",
".",
"getSummary",
"(",
")",
")",
"{",
"writeWBS",
"(",
"task",
")",
";",
"}",
"else",
"{",
"writeActivity",
"(",
"task",
")",
";",
"}",
"}",
"}"
] |
Given a Task instance, this task determines if it should be written to the
PM XML file as an activity or as a WBS item, and calls the appropriate
method.
@param task Task instance
|
[
"Given",
"a",
"Task",
"instance",
"this",
"task",
"determines",
"if",
"it",
"should",
"be",
"written",
"to",
"the",
"PM",
"XML",
"file",
"as",
"an",
"activity",
"or",
"as",
"a",
"WBS",
"item",
"and",
"calls",
"the",
"appropriate",
"method",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L579-L592
|
157,397
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeWBS
|
private void writeWBS(Task mpxj)
{
if (mpxj.getUniqueID().intValue() != 0)
{
WBSType xml = m_factory.createWBSType();
m_project.getWBS().add(xml);
String code = mpxj.getWBS();
code = code == null || code.length() == 0 ? DEFAULT_WBS_CODE : code;
Task parentTask = mpxj.getParentTask();
Integer parentObjectID = parentTask == null ? null : parentTask.getUniqueID();
xml.setCode(code);
xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
xml.setName(mpxj.getName());
xml.setObjectId(mpxj.getUniqueID());
xml.setParentObjectId(parentObjectID);
xml.setProjectObjectId(PROJECT_OBJECT_ID);
xml.setSequenceNumber(Integer.valueOf(m_wbsSequence++));
xml.setStatus("Active");
}
writeChildTasks(mpxj);
}
|
java
|
private void writeWBS(Task mpxj)
{
if (mpxj.getUniqueID().intValue() != 0)
{
WBSType xml = m_factory.createWBSType();
m_project.getWBS().add(xml);
String code = mpxj.getWBS();
code = code == null || code.length() == 0 ? DEFAULT_WBS_CODE : code;
Task parentTask = mpxj.getParentTask();
Integer parentObjectID = parentTask == null ? null : parentTask.getUniqueID();
xml.setCode(code);
xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
xml.setName(mpxj.getName());
xml.setObjectId(mpxj.getUniqueID());
xml.setParentObjectId(parentObjectID);
xml.setProjectObjectId(PROJECT_OBJECT_ID);
xml.setSequenceNumber(Integer.valueOf(m_wbsSequence++));
xml.setStatus("Active");
}
writeChildTasks(mpxj);
}
|
[
"private",
"void",
"writeWBS",
"(",
"Task",
"mpxj",
")",
"{",
"if",
"(",
"mpxj",
".",
"getUniqueID",
"(",
")",
".",
"intValue",
"(",
")",
"!=",
"0",
")",
"{",
"WBSType",
"xml",
"=",
"m_factory",
".",
"createWBSType",
"(",
")",
";",
"m_project",
".",
"getWBS",
"(",
")",
".",
"add",
"(",
"xml",
")",
";",
"String",
"code",
"=",
"mpxj",
".",
"getWBS",
"(",
")",
";",
"code",
"=",
"code",
"==",
"null",
"||",
"code",
".",
"length",
"(",
")",
"==",
"0",
"?",
"DEFAULT_WBS_CODE",
":",
"code",
";",
"Task",
"parentTask",
"=",
"mpxj",
".",
"getParentTask",
"(",
")",
";",
"Integer",
"parentObjectID",
"=",
"parentTask",
"==",
"null",
"?",
"null",
":",
"parentTask",
".",
"getUniqueID",
"(",
")",
";",
"xml",
".",
"setCode",
"(",
"code",
")",
";",
"xml",
".",
"setGUID",
"(",
"DatatypeConverter",
".",
"printUUID",
"(",
"mpxj",
".",
"getGUID",
"(",
")",
")",
")",
";",
"xml",
".",
"setName",
"(",
"mpxj",
".",
"getName",
"(",
")",
")",
";",
"xml",
".",
"setObjectId",
"(",
"mpxj",
".",
"getUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setParentObjectId",
"(",
"parentObjectID",
")",
";",
"xml",
".",
"setProjectObjectId",
"(",
"PROJECT_OBJECT_ID",
")",
";",
"xml",
".",
"setSequenceNumber",
"(",
"Integer",
".",
"valueOf",
"(",
"m_wbsSequence",
"++",
")",
")",
";",
"xml",
".",
"setStatus",
"(",
"\"Active\"",
")",
";",
"}",
"writeChildTasks",
"(",
"mpxj",
")",
";",
"}"
] |
Writes a WBS entity to the PM XML file.
@param mpxj MPXJ Task entity
|
[
"Writes",
"a",
"WBS",
"entity",
"to",
"the",
"PM",
"XML",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L599-L624
|
157,398
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.writeActivity
|
private void writeActivity(Task mpxj)
{
ActivityType xml = m_factory.createActivityType();
m_project.getActivity().add(xml);
Task parentTask = mpxj.getParentTask();
Integer parentObjectID = parentTask == null ? null : parentTask.getUniqueID();
xml.setActualStartDate(mpxj.getActualStart());
xml.setActualFinishDate(mpxj.getActualFinish());
xml.setAtCompletionDuration(getDuration(mpxj.getDuration()));
xml.setCalendarObjectId(getCalendarUniqueID(mpxj.getCalendar()));
xml.setDurationPercentComplete(getPercentage(mpxj.getPercentageComplete()));
xml.setDurationType(DURATION_TYPE_MAP.get(mpxj.getType()));
xml.setFinishDate(mpxj.getFinish());
xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
xml.setId(getActivityID(mpxj));
xml.setName(mpxj.getName());
xml.setObjectId(mpxj.getUniqueID());
xml.setPercentComplete(getPercentage(mpxj.getPercentageComplete()));
xml.setPercentCompleteType("Duration");
xml.setPrimaryConstraintType(CONSTRAINT_TYPE_MAP.get(mpxj.getConstraintType()));
xml.setPrimaryConstraintDate(mpxj.getConstraintDate());
xml.setPlannedDuration(getDuration(mpxj.getDuration()));
xml.setPlannedFinishDate(mpxj.getFinish());
xml.setPlannedStartDate(mpxj.getStart());
xml.setProjectObjectId(PROJECT_OBJECT_ID);
xml.setRemainingDuration(getDuration(mpxj.getRemainingDuration()));
xml.setRemainingEarlyFinishDate(mpxj.getEarlyFinish());
xml.setRemainingEarlyStartDate(mpxj.getResume());
xml.setRemainingLaborCost(NumberHelper.DOUBLE_ZERO);
xml.setRemainingLaborUnits(NumberHelper.DOUBLE_ZERO);
xml.setRemainingNonLaborCost(NumberHelper.DOUBLE_ZERO);
xml.setRemainingNonLaborUnits(NumberHelper.DOUBLE_ZERO);
xml.setStartDate(mpxj.getStart());
xml.setStatus(getActivityStatus(mpxj));
xml.setType(extractAndConvertTaskType(mpxj));
xml.setWBSObjectId(parentObjectID);
xml.getUDF().addAll(writeUDFType(FieldTypeClass.TASK, mpxj));
writePredecessors(mpxj);
}
|
java
|
private void writeActivity(Task mpxj)
{
ActivityType xml = m_factory.createActivityType();
m_project.getActivity().add(xml);
Task parentTask = mpxj.getParentTask();
Integer parentObjectID = parentTask == null ? null : parentTask.getUniqueID();
xml.setActualStartDate(mpxj.getActualStart());
xml.setActualFinishDate(mpxj.getActualFinish());
xml.setAtCompletionDuration(getDuration(mpxj.getDuration()));
xml.setCalendarObjectId(getCalendarUniqueID(mpxj.getCalendar()));
xml.setDurationPercentComplete(getPercentage(mpxj.getPercentageComplete()));
xml.setDurationType(DURATION_TYPE_MAP.get(mpxj.getType()));
xml.setFinishDate(mpxj.getFinish());
xml.setGUID(DatatypeConverter.printUUID(mpxj.getGUID()));
xml.setId(getActivityID(mpxj));
xml.setName(mpxj.getName());
xml.setObjectId(mpxj.getUniqueID());
xml.setPercentComplete(getPercentage(mpxj.getPercentageComplete()));
xml.setPercentCompleteType("Duration");
xml.setPrimaryConstraintType(CONSTRAINT_TYPE_MAP.get(mpxj.getConstraintType()));
xml.setPrimaryConstraintDate(mpxj.getConstraintDate());
xml.setPlannedDuration(getDuration(mpxj.getDuration()));
xml.setPlannedFinishDate(mpxj.getFinish());
xml.setPlannedStartDate(mpxj.getStart());
xml.setProjectObjectId(PROJECT_OBJECT_ID);
xml.setRemainingDuration(getDuration(mpxj.getRemainingDuration()));
xml.setRemainingEarlyFinishDate(mpxj.getEarlyFinish());
xml.setRemainingEarlyStartDate(mpxj.getResume());
xml.setRemainingLaborCost(NumberHelper.DOUBLE_ZERO);
xml.setRemainingLaborUnits(NumberHelper.DOUBLE_ZERO);
xml.setRemainingNonLaborCost(NumberHelper.DOUBLE_ZERO);
xml.setRemainingNonLaborUnits(NumberHelper.DOUBLE_ZERO);
xml.setStartDate(mpxj.getStart());
xml.setStatus(getActivityStatus(mpxj));
xml.setType(extractAndConvertTaskType(mpxj));
xml.setWBSObjectId(parentObjectID);
xml.getUDF().addAll(writeUDFType(FieldTypeClass.TASK, mpxj));
writePredecessors(mpxj);
}
|
[
"private",
"void",
"writeActivity",
"(",
"Task",
"mpxj",
")",
"{",
"ActivityType",
"xml",
"=",
"m_factory",
".",
"createActivityType",
"(",
")",
";",
"m_project",
".",
"getActivity",
"(",
")",
".",
"add",
"(",
"xml",
")",
";",
"Task",
"parentTask",
"=",
"mpxj",
".",
"getParentTask",
"(",
")",
";",
"Integer",
"parentObjectID",
"=",
"parentTask",
"==",
"null",
"?",
"null",
":",
"parentTask",
".",
"getUniqueID",
"(",
")",
";",
"xml",
".",
"setActualStartDate",
"(",
"mpxj",
".",
"getActualStart",
"(",
")",
")",
";",
"xml",
".",
"setActualFinishDate",
"(",
"mpxj",
".",
"getActualFinish",
"(",
")",
")",
";",
"xml",
".",
"setAtCompletionDuration",
"(",
"getDuration",
"(",
"mpxj",
".",
"getDuration",
"(",
")",
")",
")",
";",
"xml",
".",
"setCalendarObjectId",
"(",
"getCalendarUniqueID",
"(",
"mpxj",
".",
"getCalendar",
"(",
")",
")",
")",
";",
"xml",
".",
"setDurationPercentComplete",
"(",
"getPercentage",
"(",
"mpxj",
".",
"getPercentageComplete",
"(",
")",
")",
")",
";",
"xml",
".",
"setDurationType",
"(",
"DURATION_TYPE_MAP",
".",
"get",
"(",
"mpxj",
".",
"getType",
"(",
")",
")",
")",
";",
"xml",
".",
"setFinishDate",
"(",
"mpxj",
".",
"getFinish",
"(",
")",
")",
";",
"xml",
".",
"setGUID",
"(",
"DatatypeConverter",
".",
"printUUID",
"(",
"mpxj",
".",
"getGUID",
"(",
")",
")",
")",
";",
"xml",
".",
"setId",
"(",
"getActivityID",
"(",
"mpxj",
")",
")",
";",
"xml",
".",
"setName",
"(",
"mpxj",
".",
"getName",
"(",
")",
")",
";",
"xml",
".",
"setObjectId",
"(",
"mpxj",
".",
"getUniqueID",
"(",
")",
")",
";",
"xml",
".",
"setPercentComplete",
"(",
"getPercentage",
"(",
"mpxj",
".",
"getPercentageComplete",
"(",
")",
")",
")",
";",
"xml",
".",
"setPercentCompleteType",
"(",
"\"Duration\"",
")",
";",
"xml",
".",
"setPrimaryConstraintType",
"(",
"CONSTRAINT_TYPE_MAP",
".",
"get",
"(",
"mpxj",
".",
"getConstraintType",
"(",
")",
")",
")",
";",
"xml",
".",
"setPrimaryConstraintDate",
"(",
"mpxj",
".",
"getConstraintDate",
"(",
")",
")",
";",
"xml",
".",
"setPlannedDuration",
"(",
"getDuration",
"(",
"mpxj",
".",
"getDuration",
"(",
")",
")",
")",
";",
"xml",
".",
"setPlannedFinishDate",
"(",
"mpxj",
".",
"getFinish",
"(",
")",
")",
";",
"xml",
".",
"setPlannedStartDate",
"(",
"mpxj",
".",
"getStart",
"(",
")",
")",
";",
"xml",
".",
"setProjectObjectId",
"(",
"PROJECT_OBJECT_ID",
")",
";",
"xml",
".",
"setRemainingDuration",
"(",
"getDuration",
"(",
"mpxj",
".",
"getRemainingDuration",
"(",
")",
")",
")",
";",
"xml",
".",
"setRemainingEarlyFinishDate",
"(",
"mpxj",
".",
"getEarlyFinish",
"(",
")",
")",
";",
"xml",
".",
"setRemainingEarlyStartDate",
"(",
"mpxj",
".",
"getResume",
"(",
")",
")",
";",
"xml",
".",
"setRemainingLaborCost",
"(",
"NumberHelper",
".",
"DOUBLE_ZERO",
")",
";",
"xml",
".",
"setRemainingLaborUnits",
"(",
"NumberHelper",
".",
"DOUBLE_ZERO",
")",
";",
"xml",
".",
"setRemainingNonLaborCost",
"(",
"NumberHelper",
".",
"DOUBLE_ZERO",
")",
";",
"xml",
".",
"setRemainingNonLaborUnits",
"(",
"NumberHelper",
".",
"DOUBLE_ZERO",
")",
";",
"xml",
".",
"setStartDate",
"(",
"mpxj",
".",
"getStart",
"(",
")",
")",
";",
"xml",
".",
"setStatus",
"(",
"getActivityStatus",
"(",
"mpxj",
")",
")",
";",
"xml",
".",
"setType",
"(",
"extractAndConvertTaskType",
"(",
"mpxj",
")",
")",
";",
"xml",
".",
"setWBSObjectId",
"(",
"parentObjectID",
")",
";",
"xml",
".",
"getUDF",
"(",
")",
".",
"addAll",
"(",
"writeUDFType",
"(",
"FieldTypeClass",
".",
"TASK",
",",
"mpxj",
")",
")",
";",
"writePredecessors",
"(",
"mpxj",
")",
";",
"}"
] |
Writes an activity to a PM XML file.
@param mpxj MPXJ Task instance
|
[
"Writes",
"an",
"activity",
"to",
"a",
"PM",
"XML",
"file",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L631-L672
|
157,399
|
joniles/mpxj
|
src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java
|
PrimaveraPMFileWriter.extractAndConvertTaskType
|
private String extractAndConvertTaskType(Task task)
{
String activityType = (String) task.getCachedValue(m_activityTypeField);
if (activityType == null)
{
activityType = "Resource Dependent";
}
else
{
if (ACTIVITY_TYPE_MAP.containsKey(activityType))
{
activityType = ACTIVITY_TYPE_MAP.get(activityType);
}
}
return activityType;
}
|
java
|
private String extractAndConvertTaskType(Task task)
{
String activityType = (String) task.getCachedValue(m_activityTypeField);
if (activityType == null)
{
activityType = "Resource Dependent";
}
else
{
if (ACTIVITY_TYPE_MAP.containsKey(activityType))
{
activityType = ACTIVITY_TYPE_MAP.get(activityType);
}
}
return activityType;
}
|
[
"private",
"String",
"extractAndConvertTaskType",
"(",
"Task",
"task",
")",
"{",
"String",
"activityType",
"=",
"(",
"String",
")",
"task",
".",
"getCachedValue",
"(",
"m_activityTypeField",
")",
";",
"if",
"(",
"activityType",
"==",
"null",
")",
"{",
"activityType",
"=",
"\"Resource Dependent\"",
";",
"}",
"else",
"{",
"if",
"(",
"ACTIVITY_TYPE_MAP",
".",
"containsKey",
"(",
"activityType",
")",
")",
"{",
"activityType",
"=",
"ACTIVITY_TYPE_MAP",
".",
"get",
"(",
"activityType",
")",
";",
"}",
"}",
"return",
"activityType",
";",
"}"
] |
Attempts to locate the activity type value extracted from an existing P6 schedule.
If necessary converts to the form which can be used in the PMXML file.
Returns "Resource Dependent" as the default value.
@param task parent task
@return activity type
|
[
"Attempts",
"to",
"locate",
"the",
"activity",
"type",
"value",
"extracted",
"from",
"an",
"existing",
"P6",
"schedule",
".",
"If",
"necessary",
"converts",
"to",
"the",
"form",
"which",
"can",
"be",
"used",
"in",
"the",
"PMXML",
"file",
".",
"Returns",
"Resource",
"Dependent",
"as",
"the",
"default",
"value",
"."
] |
143ea0e195da59cd108f13b3b06328e9542337e8
|
https://github.com/joniles/mpxj/blob/143ea0e195da59cd108f13b3b06328e9542337e8/src/main/java/net/sf/mpxj/primavera/PrimaveraPMFileWriter.java#L682-L697
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.